Jump to content

Hook New Products Block to displayHome


Ben90

Recommended Posts

Hi guys,

 

Just a quick question, I would like to move New Products Block to displayHome (Homepage content) but this notification appeared when I try to do it: This module cannot be transplanted to this hook

 

Is there any way to do this? I just simply want to move this "new arrival products" to appear on the bottom of the homepage content.

 

I thank you in advance for your help  :)

Link to comment
Share on other sites

Hi guys,

 

Just a quick question, I would like to move New Products Block to displayHome (Homepage content) but this notification appeared when I try to do 

 

Hello,

 

Add this file -  modules\blocknewproducts\blocknewproducts.php

 

This code after line 180

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'));
}
  • Like 2
Link to comment
Share on other sites

 

Hello,

 

Add this file -  modules\blocknewproducts\blocknewproducts.php

 

This code after line 180

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'));
}

 

Thank you so much! Much appreciated! It works perfectly!

Link to comment
Share on other sites

 

Hello,

 

Add this file -  modules\blocknewproducts\blocknewproducts.php

 

This code after line 180

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'));
}

 

Hi, there's a problem with this new products block module. After I move it down to  displayHome (Homepage content), it last for 1 day, after that it shown "no new products at this time" even though I set the products considered new to 30 days.

 

I need to reset the module to make them appear again, but after I move it to displayHome (Homepage content), it happened again. Maybe there's additional set of code I need to add?

 

I just want to add this new products in the displayHome (Homepage content). So I remove it from another hook (left side bar or anywhere else). Guess this code need to be modified, right?

if ($success)
		{
			// Hook the module either on the left or right column
			$theme = new Theme(Context::getContext()->shop->id_theme);
			if ((!$theme->default_left_column || !$this->registerHook('leftColumn'))
				&& (!$theme->default_right_column || !$this->registerHook('rightColumn')))
			{
				// If there are no colums implemented by the template, throw an error and uninstall the module
				$this->_errors[] = $this->l('This module need to be hooked in a column and your theme does not implement one');
				parent::uninstall();
				return false;
			}
		} 
Edited by rukano (see edit history)
Link to comment
Share on other sites

Hi WebtetDev

I have the same problem as rukano, worked at the begining but after some time stopped working until i reset the module, etc

 

Any help?

 

Best regards.

 

Hello,

 

After line 52 past this code - 

$this->registerHook('displayHome') &&

and after line 199 past -

public function hookDisplayHome($params)
{
return $this->hookdisplayHomeTabContent($params);
}
Link to comment
Share on other sites

 

Hello,

 

After line 52 past this code - 

$this->registerHook('displayHome') &&

and after line 199 past -

public function hookDisplayHome($params)
{
return $this->hookdisplayHomeTabContent($params);
}

 

 

Yeah still the same, unless I left the left column active. But there's no point using both of them on the same page. Put this on displayHome is the best idea. Still not working though...   :unsure:

Link to comment
Share on other sites

×
×
  • Create New...