Category and product display very slow

  • Posts: 4
  • Thank you received: 0
9 years 8 months ago #224612

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.4.6

Hi,

I have the business version of hikashop configured to show a list of categories in the left with the product listing in the center of my page.

Everything worked fine until I started creating some products. Then it started to slow down, and it takes 43 seconds to load the page...

I traced the problem and found out that this query that takes 30 seconds to execute:
SELECT DISTINCT b.*
FROM j5yie_hikashop_product_category AS a
LEFT JOIN j5yie_hikashop_product AS b
ON a.product_id=b.product_id
WHERE b.product_published=1
AND b.product_type = 'main'
AND a.category_id IN (2)
AND b.product_quantity!=0
AND (b.product_access = 'all' OR b.product_access LIKE '%,9,%')
ORDER BY a.ordering ASC
LIMIT 0, 30

I have 63000 registers in the category table and 28000 registers in the product table. It isn't so much from my point of view.

My solution was to remove the order by clause of the query, editing the line 588 of components/com_hikashop/views/product/view.html.php (adding an "if" to only impact my specific query).

I think the ordering of the products and categories in my page is working without problems anyway. So my question is, which is the reason to have the order by clause in this query.

And, as I had to modify a core hikashop file to make it work, will any update remove my code? Is it possible to override the method like in the templates?

Regads,
Albert

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

  • Posts: 84306
  • Thank you received: 13701
  • MODERATOR
9 years 8 months ago #224662

Hi,

The order by allows you to get the products in the order that you define in the "order" column of your products listing in the backend.
By default that order is the order in which you created the products, so if you delete that order by and don't alter manually the ordering of the products, then indeed, you won't see any difference.
But it's still something really useful for a lot of people so it's not possible to remove it as it would break the proper functionality of the listing.

And yes, you will loose your change if you remove it directly from the view.html.php file.
You can actually create a small plugin implementing the onBeforeProductListingLoad trigger: www.hikashop.com/support/support/documen...reProductListingLoad
There, you can modify the $order parameter in order to deal with the order by of that query.
That way, you won't loose that change with future updates.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum