Display products in price order

  • Posts: 26
  • Thank you received: 0
4 years 6 months ago #312047

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.12

Hi,

I have a list of products that I would like to display in price order by default.

I have tried setting the "Ordering field" in the menu to "product_sort_price" but this doesn't seem to affect all the products on the page. I have set up filters to "sort by price" which works correctly, but this requires a user activating them before the products get sorted.

Is there a way to have the same effect as the filter "sort by price" by default? OR can I set a filter to display by default (on page load?)

thanks

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

  • Posts: 81509
  • Thank you received: 13064
  • MODERATOR
4 years 6 months ago #312049

Hi,

The "product_sort_price" choice of the "ordering field" is what I would recommend.
Note that this field is set by HikaShop each time to save a product in the backend interface.
If you import products via CSV, or a script, or modify the prices via the database or a mass action, the code to (re)calculate that product_sort_price won't be called.
That could explain why it doesn't work properly for some of your products.
An alternative to this would be to use the "sort by price" filter, and add the parameter of the filter in the URL of the page accessing the listing. But that's kind of a trick. It would be better to use the product_sort_price which is meant for that.

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

  • Posts: 26
  • Thank you received: 0
4 years 6 months ago #312093

Hi,

Thanks for the extra information, I thought I had my settings wrong :)

I ended up exporting all the products then copying the "Price" column and pasting the data into the "product_sort_price" column, then importing all the products again.

This seems to have fixed the issue when I set "product_sort_price" as the new option.

thanks for the help :)

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

Time to create page: 0.062 seconds
Powered by Kunena Forum