Daniel Ciornei Posted July 29, 2010 Share Posted July 29, 2010 I have been searching this forum for a way to limit the number of products displayed in best-sales page because after a while, if you have all products sold at least one time, eventually you end up with another product-list copy page only sorted by sales ( although i am no sure the order is quite right)so i made a "bypass" on that. so, what i did was : in best-sales.php i replaced this $nbProducts = intval(ProductSale::getNbSales()); with this $nbProducts = 20 ; My choice was 20 products, but you can change that to whatever ( 3 for top 3 sales)if anyone has a better solution please share. Link to comment Share on other sites More sharing options...
Christian Alias Posted June 2, 2016 Share Posted June 2, 2016 Any solution for 1.6 ? because there is no best-sales.php Link to comment Share on other sites More sharing options...
cthierry Posted June 9, 2016 Share Posted June 9, 2016 It's in controllers => front => bestsalescontronler.php Link to comment Share on other sites More sharing options...
Christian Alias Posted June 9, 2016 Share Posted June 9, 2016 (edited) It's in controllers => front => bestsalescontronler.php Thanks, then I must be doing something wrong because my code looks like: public function initContent() { if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) { parent::initContent(); $this->productSort(); $nb_products = (int)ProductSale::getNbSales(); $this->pagination($nb_products); if (!Tools::getValue('orderby')) $this->orderBy = 'sales'; $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, 40, $this->orderBy, $this->orderWay); $this->addColorsToProductList($products); $this->context->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => 40, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM') )); $this->setTemplate(_PS_THEME_DIR_.'best-sales.tpl'); } else Tools::redirect('index.php?controller=404'); } as you see: 'nbProducts' => 40 but anyway... in backend is like 94 pages with 12 products each ... Edited June 9, 2016 by Christian Alias (see edit history) Link to comment Share on other sites More sharing options...
zuzik Posted August 6, 2016 Share Posted August 6, 2016 Thanks, then I must be doing something wrong because my code looks like: public function initContent() { if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) { parent::initContent(); $this->productSort(); $nb_products = (int)ProductSale::getNbSales(); $this->pagination($nb_products); if (!Tools::getValue('orderby')) $this->orderBy = 'sales'; $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, 40, $this->orderBy, $this->orderWay); $this->addColorsToProductList($products); $this->context->smarty->assign(array( 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => 40, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM') )); $this->setTemplate(_PS_THEME_DIR_.'best-sales.tpl'); } else Tools::redirect('index.php?controller=404'); } as you see: 'nbProducts' => 40 but anyway... in backend is like 94 pages with 12 products each ... bestsales-problem.png try $this->productSort(); //$nb_products = (int)ProductSale::getNbSales(); $nb_products = 40; Link to comment Share on other sites More sharing options...
Dino87 Posted September 30, 2020 Share Posted September 30, 2020 Hello, I have same problem, I would like to limit the number of products on the "best seller" page of version 1.7.6.7, do you know how to do it? Thank you for your help Dino Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now