Jump to content

Random showcase products


daninapoli

Recommended Posts

Hi I use version 1.6.1.2, I need to randomly display the products of my catalog in the showcase.

I saw that there is a possibility directly from the module configuration but the same products are always displayed.

I found some previous post postings by modifying the homefeatured.php file for the version I use i will not work.

Also I have set other products in the HOME category but are displayed always think of the last inserted.

Is there a solution?

Link to comment
Share on other sites

try to replace original function hookdisplayhome() with function that i attached below:

	public function hookDisplayHome($params)
	{
        $category = new Category((int)Configuration::get('HOME_FEATURED_CAT'), (int)Context::getContext()->language->id);
	    $nb = (int)Configuration::get('HOME_FEATURED_NBR');
		
		$this->_cacheProducts();
		$this->smarty->assign(
			array(
				'products' => $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), null, null, false, true, true, ($nb ? $nb : 8)),
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			)
		);
		
		return $this->display(__FILE__, 'homefeatured.tpl');
	}
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...