Filtering by price very slow

  • Posts: 42
  • Thank you received: 1
9 years 2 months ago #214980

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.6.13

Hello,

it seems there is a performance issue while using price filter on frontend, could you please take a look at attached screenshots, you can see there are four quite similar queries (each one is taking around 10 seconds and they are running at the same page load), could you tell me please is there any way to make them simplier/faster? These subqueries are killing my website load speed. Also while sorting by product price or product name etc. the same thing happens, but other filters are working fast (like brand or category filter), also other website pages are running quite fast - only filtering by price and 'sorting by' is running terribly slow, just like there is some issue in /administrator/components/com_hikashop/classes/filter.php I guess.

Best regards,
Chris

Attachments:

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
9 years 2 months ago #215095

Hi,

Filtering/ordering by price is indeed a lot slower than other filtering.
That's because there is a lot of calculation necessary to have a filtering which works not too bad:
- when you have several currencies, the product prices can be in some currencies only, and the system converts them automatically, so the prices of all the products on the listing have to be converted (when necessary) to the current currency.
- Filtering has to be done based on the user group of the user to only use relevant prices
- prices can have taxes applied to them and thus, again, the price with tax has to be calculated dynamically for all the products of the listing.
- prices might not be directly in the main product, but only in the variants of the products, so that also has to be taken into account.

Because of all this, the queries to handle the price filtering/ordering get very slow. Of course, you can simplify them in the /administrator/components/com_hikashop/classes/filter.php file. If you're a developer it shouldn't be a problem.
But a simpler solution is to just create a custom field of the table "product" and enter the price you want the order/filter to be based on for each product in that custom field. Then, you'll be able to base your filter on that custom product field and it will be really fast.
To make it simple to setup, you can configure a mass action via the menu System>Mass actions to automatically populate your custom product field with an operation {price.price_value} in an action "update the values" of your mass action.

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

  • Posts: 42
  • Thank you received: 1
9 years 2 months ago #215113

Hi,

I did it using custom field and mass action as you suggested and it's working great. Thanks a lot!

Best regards,
Chris

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

Time to create page: 0.059 seconds
Powered by Kunena Forum