Product sorting question

ThemeBurn SupportForumsOpenCart ThemesShoppica 2 OpenCart ThemeProduct sorting question

This topic has been marked as not resolved.

Hi,

I don’t know, this is Opencart or Shoppica related problem, but need to find a solution to fix it.

I have a lot of product with same names and different numbers:
Product name 1.
Product name 2.
Product name …….
Product name 10.
Product name ……
Product name 100
etc.

When I set sorting in alphabetical order, the sorting will be wrong:
(A-Z sorting):
Product 1., Product 10., Product 100., Product 101, ….. Product 2., Product 20., Product 21, etc.

I need to sort it correctly:
Product 1., Product 2., Product 3., …… Product 100, Product 101., etc.

How can I fix this issue, when the product name contains numbers? I don’t want to set different sort order numbers for each products.

Here is an example:
https://www.ajandek24.hu/fenykepes-naptarak/eves-naptarak

Thanks,
Szilard

November 17, 2015 at 4:29 pm #43819

Hi Szilard,

The “problem” you describe is just a regular behavior of the PHP (and not only) string sorting algorithm. Since we sort products alphabetically and 1 is before 2 you will always get 1, 10, 100, 1000 etc. before 2.

The only partial solution would be to use 0 (001, 002, …., 010, …, 100 etc.) to keep the number order.

BR,
ThemeBurn team

November 27, 2015 at 4:32 pm #43908
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.