Prestashop

Prestashop: Limit the number of Products on Manufacturer list

We have about 5000 products from a certain manufacturer but we only want to issue 500 per query, as the 5000 product query is hurting our server.

To do this you go to

~/classes/Manufacturer.php

You need to add the limit on 2 queries:

  • The first one (line ~364) count the number of products per manufacturer
  • The second one (line ~420) actually pulls the data from the server and organizes the products per page. *** UPDATE *** Maybe this is not necessary to update.

This has been done easily and correctly.

The problem that now arises is that that query will only show the same 500 products every time (which I do not want). I would like to show different products, so that all the products from that manufacturer are exposed to the customers and also (and most importantly), to the google bot for SEO purposes.

Ths way I found to do this (which I did not implement), was to add at the end of the query (before the LIMIT), the line

ORDER BY RAND()

While this does exactly what I need it to do, it defeats the original purpose because the RAND command puts a load on the server and we get a memory leak.

Will leave AS IS for now and resolve on the near future.

Attachments:

Leave a Reply

Your email address will not be published. Required fields are marked *