Jump to content

New products - changing hook to Home Content


Recommended Posts

Hi,

 

I have tried to adjust New products to be shown on Home hook (cannot do that by default) - PS 1.6. I have therefore inserted following code to blocknewproducts.php:

 

public function hookdisplayHome($params)
{
if (!$this->isCached('blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')))
{
$this->smarty->assign(array(
'new_products' => BlockNewProducts::$cache_new_products,
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
));
}
 
if (BlockNewProducts::$cache_new_products === false)
return false;
 
return $this->display(__FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home'));
}
 
I am able to select this hook but new products are shown only if New products module is also hooked to left column. 
 
Could you advise me what I did wrong or what needs to be further changed (and how)?
 
Thank you!!!
Edited by adam.zaydlar (see edit history)
Link to comment
Share on other sites

Hi vekia,

 

thank you for your reply! Could you please also advise me how the whole code should look like? I got error in presta after implementing this (I guess it was my fault).

 

Thank you!

 

EDIT: now it is ok and working perfectly!

 

 

you forgot about this code:
 

if (!isset(BlockNewProducts::$cache_new_products))
				BlockNewProducts::$cache_new_products = $this->getNewProducts();
Edited by adam.zaydlar (see edit history)
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...