Jump to content

Customizing Order of Product Category List

Recommended Posts

Site URL: https://www.piquant.nyc

Hi,

My website uses the Brine template and I have two Products pages on my website that I would like to customize. The categories are automatically listed in alphabetical order and this is only editable with custom codes for this template.

Can someone please help me inject code so that I can list these product categories in a custom order. 

SHOP OBJECTS PAGE – https://www.piquant.nyc/objects

1) Aromatica
2) Catchall
3) Figures
4) Jewelry Box
5) Paperweight
6) Planter
7) Serveware
8) Smoking Accessories
9) Vase
10) Gifts 

SHOP JEWELRY PAGE – https://www.piquant.nyc/jewelry

1) Rings
2) Earrings
3) Necklaces
4) Bracelets
5) Pins, Clips & Others
6) Fashion Jewelry
7) Fine Jewelry
8) Gold
9) Silver

PIQUANT Home Finds screenshot.png

PIQUANT Jewelry Finds screenshot.png

Link to comment
  • Replies 5
  • Views 730
  • Created
  • Last Reply

Add the following to Store Settings > Advanced > Page Header Code Injection for Objects.

<style>

  /*
  
    Store Categories Reorder
    
    Brine template family
    
    */
  
  /* desktop */
  
  @media only screen and ( min-width: 641px ) {
  
    .ProductList-filter-list {
    
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      
      }
    }
    
  /* mobile */
  
  @media only screen and ( max-width: 640px ) {
  
    .ProductList-filter-dropdownToggle-checkbox:checked~.ProductList-filter-list {
    
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      
      }
    }
    
  .ProductList-filter-list-item:nth-child( 5 ) {
  
    -webkit-box-ordinal-group: 13;
    -ms-flex-order: 12;
    order: 12;
    
    }
    
  </style>

This is for a v7.0 site using a Brine family template.

This one is fairly simple as we only need to move one category to the end of the list.

Jewelry is more complicated so I start with my magic table.

Category                Natural Order   New Order   Group Order

All                     01              01          1

Bracelets               02              05          1

Earrings                03              03          1

Fashion Jewelry         04              07          1

Fine Jewelry            05              08          1

Gold                    06              09          1

Necklaces               07              04          1

Pins + Clips & Others   08              06          1

Rings                   09              02          1

Silver                  10              10          1

Add the following to Store Settings > Advanced > Page Header Code Injection for Jewelry.

<style>

  /*
  
    Store Categories Reorder
    
    Brine template family
    
    */
  
  .ProductList-filter-list {
  
    /* natural order 01, no need to define this doesn't change order */
    /* natural order 02 */ --scr-new-02:  5; --scr-new-group-02: 1;
    /* natural order 03 */ --scr-new-03:  3; --scr-new-group-03: 1;
    /* natural order 04 */ --scr-new-04:  7; --scr-new-group-04: 1;
    /* natural order 05 */ --scr-new-05:  8; --scr-new-group-05: 1;
    /* natural order 06 */ --scr-new-06:  9; --scr-new-group-06: 1;
    /* natural order 07 */ --scr-new-07:  4; --scr-new-group-07: 1;
    /* natural order 08 */ --scr-new-08:  6; --scr-new-group-08: 1;
    /* natural order 09 */ --scr-new-09:  2; --scr-new-group-09: 1;
    /* natural order 10 */ --scr-new-10: 10; --scr-new-group-10: 1;
    
    }
    
  /* desktop */
  
  @media only screen and ( min-width: 641px ) {
  
    .ProductList-filter-list {
    
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      
      }
    }
    
  /* mobile */
  
  @media only screen and ( max-width: 640px ) {
  
    .ProductList-filter-dropdownToggle-checkbox:checked~.ProductList-filter-list {
    
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      
      -webkit-box-orient: vertical;
      -webkit-box-direction: normal;
      -ms-flex-direction: column;
      flex-direction: column;
      
      }
    }
    
  /*
  
    begin reordering
    
    [natural order] is the natural order that elements display on the page
                    without any intervention
    
    repeat one of the following structures for as many categories you want to
    reorder
    
    new order
    
      .ProductList-filter-list-item:nth-child( [natural order] ) {
      
        -webkit-box-ordinal-group: calc( var( --scr-new-[natural order] ) + 1 );
        -ms-flex-order: var( --scr-new-[natural order] );
        order: var( --scr-new-[natural order] );
        
        }
        
    new order group
    
      .ProductList-filter-list-item:nth-child( [natural order] ) {
      
        -webkit-box-ordinal-group: calc( var( --new-group-[natural order] ) + 1 );
        -ms-flex-order: var( --new-group-[natural order] );
        order: var( --new-group-[natural order] );
        
        }
        
    */
    
  .ProductList-filter-list-item:nth-child( 2 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-02 ) + 1 );
    -ms-flex-order: var( --scr-new-02 );
    order: var( --scr-new-02 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 3 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-03 ) + 1 );
    -ms-flex-order: var( --scr-new-03 );
    order: var( --scr-new-03 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 4 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-04 ) + 1 );
    -ms-flex-order: var( --scr-new-04 );
    order: var( --scr-new-04 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 5 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-05 ) + 1 );
    -ms-flex-order: var( --scr-new-05 );
    order: var( --scr-new-05 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 6 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-06 ) + 1 );
    -ms-flex-order: var( --scr-new-06 );
    order: var( --scr-new-06 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 7 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-07 ) + 1 );
    -ms-flex-order: var( --scr-new-07 );
    order: var( --scr-new-07 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 8 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-08 ) + 1 );
    -ms-flex-order: var( --scr-new-08 );
    order: var( --scr-new-08 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 9 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-09 ) + 1 );
    -ms-flex-order: var( --scr-new-09 );
    order: var( --scr-new-09 );
    
    }
    
  .ProductList-filter-list-item:nth-child( 10 ) {
  
    -webkit-box-ordinal-group: calc( var( --scr-new-10 ) + 1 );
    -ms-flex-order: var( --scr-new-10 );
    order: var( --scr-new-10 );
    
    }
    
  /* end reordering */
  
  </style>

This is for a v7.0 site using a Brine family template.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 1 month later...

Hi @creedon 

I trust this finds you well. I am reaching out here in hopes that you can help me again as you were so helpful and descriptive with my last question –

SITE: www.piquant.nyc
ISSUE LINK: www.piquant.nyc/shops

The "Objects" page is working great with the newly re-ordered categories ("Gifts" to the bottom).

However, my "Shops" navigation page is reflecting the "Objects" page (automatically) but the 'Gifts' category is back in alphabetical order. The "Shops" dropdown is, of course, a folder, which means there's no "Page Header Code Injection" area (that I can see). And I also cannot change the link to /objects

Is there a way to get around this problem?

Thanks again in advance!

Link to comment
On 1/21/2021 at 1:42 PM, HMLee said:

Hi @creedon 

I trust this finds you well. I am reaching out here in hopes that you can help me again as you were so helpful and descriptive with my last question –

SITE: www.piquant.nyc
ISSUE LINK: www.piquant.nyc/shops

The "Objects" page is working great with the newly re-ordered categories ("Gifts" to the bottom).

However, my "Shops" navigation page is reflecting the "Objects" page (automatically) but the 'Gifts' category is back in alphabetical order. The "Shops" dropdown is, of course, a folder, which means there's no "Page Header Code Injection" area (that I can see). And I also cannot change the link to /objects

Is there a way to get around this problem?

Thanks again in advance!

Do you still need help?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.