adam.zaydlar Posted June 9, 2014 Share Posted June 9, 2014 (edited) 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 June 9, 2014 by adam.zaydlar (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted June 10, 2014 Share Posted June 10, 2014 you forgot about this code: if (!isset(BlockNewProducts::$cache_new_products)) BlockNewProducts::$cache_new_products = $this->getNewProducts(); Link to comment Share on other sites More sharing options...
adam.zaydlar Posted June 10, 2014 Author Share Posted June 10, 2014 (edited) 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 June 19, 2014 by adam.zaydlar (see edit history) 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