Displaying new products in the New Products Block module

The "blocknewproducts" module shows new products only a certain number of days since they were added to the store. With our modification, the module will show products sorted by the date they were added, regardless of the time that has passed since they were added to the store.

To achieve this you need to override the BlockNewProducts::getNewProducts() method with the following code:

protected function getNewProducts()
{
	if (!Configuration::get('NEW_PRODUCTS_NBR'))
		return;

	$result = Product::getProducts((int) $this->context->language->id, 0, Configuration::get('NEW_PRODUCTS_NBR'), 'date_add', 'desc', false, true, null); 

	return Product::getProductsProperties((int)$this->context->language->id, $result);
}

You can find it in the file: /modules/blocknewproducts/blocknewproducts.php

Comments (0)
from 0

There are no comments. Be the first!

No entries yet.