Jump to content

[SOLVED] Blockbestsellers - limit the number of products


tumil

Recommended Posts

Hi

 

Here's the site that I have a problem with:

http://sabipolsklep.pl/najczesciej-kupowane

 

This is the bestsellers page.

As you can see, there are over 1300 products here. I would like to have only 25 of them. How can I edit blockbestsellers module to reach my goal?

I tried to edit tpl and php files using solutions found in some old topics but nothing worked, so maybe I've done something wrong.

Could you please post the right solution for this problem? Because there were many

Edited by tumil (see edit history)
Link to comment
Share on other sites

controllers/BestSalesController.php

$products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);

change it to:
 

$products = ProductSale::getBestSales($this->context->language->id, 0, 25, $this->orderBy, $this->orderWay);

and
 

$this->productSort();
            $nb_products = (int)ProductSale::getNbSales();
            $this->pagination($nb_products);

to
 

$this->productSort();
            $nb_products = 25;
            $this->pagination($nb_products);

it may be necessary to clean shop cache too

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
  • 4 years later...

In 1.7 i changed the classes/PproductSale.php ln. 54:

$sql = 'SELECT COUNT(ps.`id_product`) AS nb

to

$sql = 'SELECT CASE WHEN COUNT(ps.`id_product`)<240 THEN COUNT(ps.`id_product`) ELSE 240 END AS nb

 

In my case it is possible that there might be less than the 240, so it will only show the amount there is a the time if it is less than 240.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...