Price filter and discount

  • Posts: 278
  • Thank you received: 14
  • Hikashop Business
4 weeks 1 day ago #360154

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 4

I use sort filter by price. It works, but only on regular price. If I add some discount on products, filter still use regular price for sorting.
Is any way to take discounted price (lowest) for sorting?

Attachments:

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
4 weeks 21 hours ago #360156

Hi,

No. The discounts are calculated dynamically in PHP when the prices of the product are loaded, after the list of the products is queried from the database. The sorting and filtering is done during the querying of the list of the products.
So it's not possible to take into account the discounts in a filter.
What you can do is to use the "product_sort_price" column instead of the "price" column for your sorting.
This is a value which is calculated dynamically when the price is changed.
You could use a "Display the results" action on this column (with a mass action) to edit the value in order to reflect the discount.
But beware that next time you change the price of these products, you'll loose the modification in the product_sort_price.
You could also create a mass action which would run after each product modification to set the product_sort_price based on the price minus a flat fee. That way it will allow to keep the synchronization when the products are updated.
This still means that when the discounts are changes, you would have to update your mass actions. And if you have complex discounts, it might not be practical either.

You could also develop a plugin to recalculate the sort price periodically with your own algorithm, and store it in a custom product field, which you could select for the sorting of your filter. But this require to be well versed in PHP and it's not just a few lines as supporting all the different kind of discounts on products requires quite a bit of processing.

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

  • Posts: 278
  • Thank you received: 14
  • Hikashop Business
3 weeks 2 days ago #360228

Sorry to hear that. Then filter by price is in most case useless. I dont know of well made shop with that logic.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum