The blocknewproducts module (ver 2.1.3) does not show products on the categories page when I enable Smarty cache. It seems to me that in hookRightColumn() the BlockNewProducts::$cache_new_products is not checked there. I changed the function a bit, and then everything works:
Also in hookdisplayHomeTab(), the BlockNewProducts::$cache_new_products check should be used in the IF block, and in hookdisplayHomeTabContent(), the check is generally meaningless.
public function hookdisplayHomeTab()
{
if (!$this->isCached('tab.tpl', $this->getCacheId('blocknewproducts-tab'))) {
BlockNewProducts::$cache_new_products = $this->getNewProducts();
if (!BlockNewProducts::$cache_new_products)
return false;
}
return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blocknewproducts-tab'));
}
public function hookdisplayHomeTabContent()
{
if (!$this->isCached(
'blocknewproducts_home.tpl',
$this->getCacheId('blocknewproducts-home'))
) {
$this->smarty->assign([
'new_products' => BlockNewProducts::$cache_new_products,
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
]);
}
return $this->display(
__FILE__,
'blocknewproducts_home.tpl',
$this->getCacheId('blocknewproducts-home')
);
}
Question
Quant
The blocknewproducts module (ver 2.1.3) does not show products on the categories page when I enable Smarty cache.
It seems to me that in hookRightColumn() the BlockNewProducts::$cache_new_products is not checked there.
I changed the function a bit, and then everything works:
Also in hookdisplayHomeTab(), the BlockNewProducts::$cache_new_products check should be used in the IF block, and in hookdisplayHomeTabContent(), the check is generally meaningless.
public function hookdisplayHomeTab() { if (!$this->isCached('tab.tpl', $this->getCacheId('blocknewproducts-tab'))) { BlockNewProducts::$cache_new_products = $this->getNewProducts(); if (!BlockNewProducts::$cache_new_products) return false; } return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blocknewproducts-tab')); } public function hookdisplayHomeTabContent() { if (!$this->isCached( 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')) ) { $this->smarty->assign([ 'new_products' => BlockNewProducts::$cache_new_products, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), ]); } return $this->display( __FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home') ); }
Tell me, my corrections are correct?
0 answers to this question
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