- Posts: 24
- Thank you received: 1
Sorting Error for product codes >= 100
- pcomelearning
-
Topic Author
- Offline
Less
More
8 years 6 months ago #289146
by pcomelearning
Sorting Error for product codes >= 100 was created by pcomelearning
-- HikaShop version -- : 3.3.0
-- Joomla version -- : 3.8.5
-- PHP version -- : 7.0.18
-- Browser(s) name and version -- : Chrome 64.0.3282.186
Product codes over 100 do not sort correctly.
Mass actions and sorting do not consider any values greater than or equal to 100 as being greater than 99.
Instead, it considers 100 as being equal to 0.
This is easy to test.
Just create a product with the code of 100 and a couple of products with codes less than 100 and see how it sorts incorrectly.
Hoping this is an easy issue to fix. :blink:
-- Joomla version -- : 3.8.5
-- PHP version -- : 7.0.18
-- Browser(s) name and version -- : Chrome 64.0.3282.186
Product codes over 100 do not sort correctly.
Mass actions and sorting do not consider any values greater than or equal to 100 as being greater than 99.
Instead, it considers 100 as being equal to 0.
This is easy to test.
Just create a product with the code of 100 and a couple of products with codes less than 100 and see how it sorts incorrectly.
Hoping this is an easy issue to fix. :blink:
Please Log in or Create an account to join the conversation.
8 years 6 months ago #289150
by nicolas
Replied by nicolas on topic Sorting Error for product codes >= 100
Hi,
I'm sorry but it is not clear.
Please provide precise information.
Did you configure the "ordering column" of your menu item to "product_code" ?
Or are you using filters to sort the products ? In that case, how did you configure the filter ? Could you provide a screenshot of its settings ?
Also note that if you try to order the product listing based on the product_code column, it's normal that 100 is smaller than 99 since the product_code column is a VARCHAR (meaning that you can enter letters, not only numbers) and thus the sorting is done alphabetically, letter by letter, and first letter of 99, 9, is higher than the first letter of 100, 1.
You would have to change the type of that column to "integer" instead in the hikashop_product via your phpmyadmin if you want to have an ordering done as numbers and not as text.
I'm sorry but it is not clear.
Please provide precise information.
Did you configure the "ordering column" of your menu item to "product_code" ?
Or are you using filters to sort the products ? In that case, how did you configure the filter ? Could you provide a screenshot of its settings ?
Also note that if you try to order the product listing based on the product_code column, it's normal that 100 is smaller than 99 since the product_code column is a VARCHAR (meaning that you can enter letters, not only numbers) and thus the sorting is done alphabetically, letter by letter, and first letter of 99, 9, is higher than the first letter of 100, 1.
You would have to change the type of that column to "integer" instead in the hikashop_product via your phpmyadmin if you want to have an ordering done as numbers and not as text.
Please Log in or Create an account to join the conversation.
- pcomelearning
-
Topic Author
- Offline
Less
More
- Posts: 24
- Thank you received: 1
8 years 6 months ago #289326
by pcomelearning
Replied by pcomelearning on topic Sorting Error for product codes >= 100
Hi,
That was the exact answer I was looking for.
Thank you
That was the exact answer I was looking for.
Thank you
Please Log in or Create an account to join the conversation.
- pcomelearning
-
Topic Author
- Offline
Less
More
- Posts: 24
- Thank you received: 1
8 years 6 months ago - 8 years 6 months ago #289328
by pcomelearning
Replied by pcomelearning on topic Sorting Error for product codes >= 100
The product_code column is already using alpha characters in many of the products, so changing the data type to integer is not an option.
Will it work if I create a custom field then set it column type to integer in my database and use that to sort the products on the front-end?
Will it work if I create a custom field then set it column type to integer in my database and use that to sort the products on the front-end?
Last edit: 8 years 6 months ago by pcomelearning. Reason: Term clarity
Please Log in or Create an account to join the conversation.
8 years 6 months ago #289347
by nicolas
Replied by nicolas on topic Sorting Error for product codes >= 100
Hi,
Yes, you can do that.
Yes, you can do that.
Please Log in or Create an account to join the conversation.
8 years 6 months ago #289351
by lousyfool
Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Replied by lousyfool on topic Sorting Error for product codes >= 100
Hi,
I'd think that adding zeros in front of product codes beginning with < 100 should also do. Like so:
001...
002...
003...
...
010...
011...
...
099...
100...
I'd think that adding zeros in front of product codes beginning with < 100 should also do. Like so:
001...
002...
003...
...
010...
011...
...
099...
100...
Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Please Log in or Create an account to join the conversation.
Time to create page: 0.222 seconds