Jump to content

[Solved] New Products Block - Different Numbers Of Products Home | Category


Recommended Posts

Hi, and welcome to the forum.


You will need  1) ftp access and 2) a code editor of some sort


We are going to work with this file:



The following is 'untested'.


1) make a back up moudles/blocknewproducts/blocknewproducts.php  (download/rename to something like blocknewproducts_bkup.php)

2) find this function protected function getNewProducts()

3) replace entire function with:  (note in this example I use 10 for category)

protected function getNewProducts()
	if (!Configuration::get('NEW_PRODUCTS_NBR'))
	$newProducts = false;
	if (Configuration::get('PS_NB_DAYS_NEW_PRODUCT'))
		if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'category')	
			$newProducts = Product::getNewProducts((int) $this->context->language->id, 0, 10);
			$newProducts = Product::getNewProducts((int) $this->context->language->id, 0, (int)Configuration::get('NEW_PRODUCTS_NBR'));

	if (!$newProducts && Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
	return $newProducts;

Note: back office-->advanced parms-->clear cache (top right of screen)...

Edited by El Patron (see edit history)
  • Like 2

Share this post

Link to post
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More