Custom field sorted by name and not a numeric value

  • Posts: 91
  • Thank you received: 5
7 years 5 months ago #271055

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.2
-- PHP version -- : 7.1
-- Browser(s) name and version -- : Chrome latest

I created a shop with tiles and each product has a custom field price/m2. When I sort products by this fields, the sort is A-Z, so it goes like
100, 129, 150, 40, 75
Is it possible to sort them by value: 40,75,100,129,150? How?

Thank you

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 5 months ago #271056

Hello,

I'm afraid that it won't be possible because the sorting is made directly by the database (MySQL) and the custom field is stored as text. So MySQL sort the content using an alphabetical ordering.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 91
  • Thank you received: 5
7 years 5 months ago #271164

It was possible - I changed in mySQL #__hikashop_product table this field from text to smallint and it works, I attach my table structure.

Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds
Powered by Kunena Forum