[Skip to main content](#vessel-content)

#   Category and product display very slow

##

- **[mazard](/forum/user/38821-mazard "View mazard's Profile")**
- [![mazard's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38821-mazard "View mazard's Profile") Topic Author
- [ Offline](/forum/user/38821-mazard)

Less More

- Posts: 4
- Thank you received: 0
-
-

10 years 11 months ago [\#224612](#224612) by [mazard](/forum/user/38821-mazard "View mazard's Profile")  *[Category and product display very slow](/forum/26-product-category-display/881172-category-and-product-display-very-slow#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.&#42; FROM j5yie&#95;hikashop&#95;product&#95;category AS a LEFT JOIN j5yie&#95;hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE b.product&#95;published=1 AND b.product&#95;type = 'main' AND a.category&#95;id IN (2) AND b.product&#95;quantity!=0 AND (b.product&#95;access = 'all' OR b.product&#95;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&#95;hikashop/views/product/view.html.php (adding an &quot;if&quot; 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")* was created by *[mazard](/forum/user/38821-mazard "View mazard's Profile")*

-- 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODExNzItY2F0ZWdvcnktYW5kLXByb2R1Y3QtZGlzcGxheS12ZXJ5LXNsb3c/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 11 months ago [\#224662](#224662) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Category and product display very slow](/forum/26-product-category-display/881172-category-and-product-display-very-slow#224662 "-- 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.&#42; FROM j5yie&#95;hikashop&#95;product&#95;category AS a LEFT JOIN j5yie&#95;hikashop&#95;product AS b ON a.product&#95;id=b.product&#95;id WHERE b.product&#95;published=1 AND b.product&#95;type = 'main' AND a.category&#95;id IN (2) AND b.product&#95;quantity!=0 AND (b.product&#95;access = 'all' OR b.product&#95;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&#95;hikashop/views/product/view.html.php (adding an &quot;if&quot; 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")*

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](https://www.hikashop.com/support/support/documentation/62-hikashop-developer-documentation.html#onBeforeProductListingLoad)
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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODExNzItY2F0ZWdvcnktYW5kLXByb2R1Y3QtZGlzcGxheS12ZXJ5LXNsb3c/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.047 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
