Jump to content

Sort by name alphanumeric with spaces (AA 1, AA 2, etc)


sr83

Recommended Posts

My website lists all products with the catalogue number at the begining of the product title (format: AA 1 - Product Name, AA 2 - Product Name, etc ).

Part of the logic behind this is that customers could browse the catalogue in chronological order. However the sort by name logic in Prestashop is not as I expected.

For example when I sort by name (Asc) I get the following products listed in this order:
AA 179
AA 18
AA 181

However I want them to be listed in this order:
AA 18
AA 179
AA 181

I am using Prestashop 1.3 and would welcome any suggestions on how to resolve this?

Link to comment
Share on other sites

PrestaShop v1.4 lets you change the position of categories like you can with products, but since it isn't ready for public use yet and you are using v1.3, you will need to add a prefix in front of the categories to order them:

01.AA 18
02.AA 179
03.AA 181

Link to comment
Share on other sites

PrestaShop v1.4 lets you change the position of categories like you can with products, but since it isn't ready for public use yet and you are using v1.3, you will need to add a prefix in front of the categories to order them:

01.AA 18
02.AA 179
03.AA 181


It is products that I am trying to sort.

However I have thousands of products and manually sorting them will be a major task.

Is there not a file I can edit to get the products sorted correctly by default?
Link to comment
Share on other sites

In that case, go to Preferences > Products and change the "Default order by" field. You can use "Product added date" to sort them by date added, or you can use "Position inside category" and then use the arrows on the Catalog tab to reposition the products.

Link to comment
Share on other sites

In that case, go to Preferences > Products and change the "Default order by" field. You can use "Product added date" to sort them by date added, or you can use "Position inside category" and then use the arrows on the Catalog tab to reposition the products.


I am using Filter Search Community edition and that doesn't seem to support the 'Position inside category' sort option. That is why I was hoping I could change the Sort By Name functionality to fit my needs.
Link to comment
Share on other sites

You could try putting an extra space in front of the 179 and 181 products. That might change the sort order, while still being rendered with one space in HTML. Otherwise, the only solution I can think of is to modify your code so that the 01., 02., etc works on products as well as categories.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...