Jump to content

[Solved] New Products block doesn't show any products


Recommended Posts

I uploaded a new product over the weekend and it doesn't show in the sidebar. The number of days to show as new is set to 20. What am I doing wrong?

 

well, for the first, you should try:

 

1) clear cache in your prestashop store

2) turn on force compilation

3) go to preferences > products and try to increase the value of:

SjpWpuH.png

4) this is for debug purposes: in the blocknewsproducts.tpl file try to add {$new_products|var_dump} right before the:

<!-- MODULE Block new products -->

  • Like 1
Link to comment
Share on other sites

Hi, vekia!

 

The cache in the store is cleared, force compilation is turned on, changed 20 to 21, and made the change to the blocknewproducts.tpl file - nothing changed on the page.

 

I also changed the wording "Do not allow new products at this time" to "No new products at this time" and that doesn't show, either.

 

I just checked and no new products show on the page after clicking the "New Products" link.

 

3 hours later I have uninstalled and reinstalled the module, made the changes and changed the wording again, and it still doesn't show anything, except the change in wording.

 

I have again changed the wording to "???Do not allow new products at this time.", but I still do not see a change.

 

Another thing I see, is that I have a module blocknewproducts in my shop/modules folder and another one in my themes/ nice/modules folder. Is that how it should be?

Edited by touchdez (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
  • 2 months later...

I also meet that problem on my [spam-filter] website,

 

I try to fix like this, and it work for me.

 

added BlockNewProducts::$cache_new_products = $this->getNewProducts(); to hook function.

public function hookdisplayHomeTabContent($params)
	{
		if (!$this->isCached('blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')))
		{
			BlockNewProducts::$cache_new_products = $this->getNewProducts();
			$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

  • 1 year later...

Hi

 

I try with above solution but it not shoe new product block on my displayHome.

 

This is my code

// 0035 Added to display new product to displayHome page.
	public function hookDisplayHome($params)
	{
		if (!$this->isCached('blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')))
		{
			BlockNewProducts::$cache_new_products = $this->getNewProducts();
			$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 found solution later. Need to turn on "Always display this block" from admin/modules/new product block/configuration.

 

Please see image for reference.

 

Thanks

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Hi

 

I try with above solution but it not shoe new product block on my displayHome.

 

This is my code

// 0035 Added to display new product to displayHome page.
	public function hookDisplayHome($params)
	{
		if (!$this->isCached('blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')))
		{
			BlockNewProducts::$cache_new_products = $this->getNewProducts();
			$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 found solution later. Need to turn on "Always display this block" from admin/modules/new product block/configuration.

 

Please see image for reference.

 

Thanks

 

Ok, i realized i did not have force compilation on, and put cache off,  Now it works for New Products.  Now do i leave it set to force compilation? and cache to yes or no?

Edited by UnionShirtSupply (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...