Jump to content

"There are no products" of category with subcategories


Recommended Posts

Hi,

Im basically have a small issue regarding the displaying of categorys.

I have a category with several Sub-categories wich have the products in them.

The main category does not have any products. 

If i look at the category page on the front end it displays the error:

"There are no products"

I looked online an i found this fix:

 

Solution 2.
Make some changes make above "There are no products." only appear when the category is empty and also there is no sub-category.

Please make change at file /themes/yourtheme/category.tpl

Replace this line
{if $nb_products == 0}{l s='There are no products.'}

with following 4 lines

{if $nb_products == 0}
{if !isset($subcategories)}
{l s='There are no products.'}
{/if}

But unfortunatly the code in 1.5.x changed so it's no longer there.

Any idea on how to change it?

  • Like 1
Link to comment
Share on other sites

It's now in the category-count.tpl I believe.

 

Edit: Just tried it and it worked fine.

What do you mean?

How can i remove the count on just that category?

The category count code seems to check if the category has a id of 1 wich im guessing means it checks if it's a main category, wich i enabled. but it still shows that there are no products,.

Link to comment
Share on other sites

open file category-count.tpl

there is a code:

{if $category->id == 1 OR $nb_products == 0}
	{l s='There are no products in  this category'}
{else}
	{if $nb_products == 1}
		{l s='There is %d product.' sprintf=$nb_products}
	{else}
		{l s='There are %d products.' sprintf=$nb_products}
	{/if}
{/if}

change it to:

{if $category->id == 1 OR $nb_products == 0}
    {if !isset($subcategories)}
	{l s='There are no products in  this category'}
    {/if}
{else}
	{if $nb_products == 1}
		{l s='There is %d product.' sprintf=$nb_products}
	{else}
		{l s='There are %d products.' sprintf=$nb_products}
	{/if}
{/if}
  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...

SOLUTION IN THE BOTTOM

 

This is a cheap fix :(

 

We want that it counts all the products in subcategories.

I bought this template 

 

http://www.templatemonster.com/prestashop-themes/45052.html

 

It counts on 1.5.4 all. It said "There are 1700 products" and they appear on the bottom of the web.

 

But 1.5.5 and 1.5.6 doesn't count :(

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

as far as i know everything depends on your products configuration.

product have to be associated with category to be counted there.

by default system doesn't count products in subcategories if products aren't attached to "main" category too.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

 

open file category-count.tpl

there is a code:

{if $category->id == 1 OR $nb_products == 0}
	{l s='There are no products in  this category'}
{else}
	{if $nb_products == 1}
		{l s='There is %d product.' sprintf=$nb_products}
	{else}
		{l s='There are %d products.' sprintf=$nb_products}
	{/if}
{/if}

change it to:

{if $category->id == 1 OR $nb_products == 0}
    {if !isset($subcategories)}
	{l s='There are no products in  this category'}
    {/if}
{else}
	{if $nb_products == 1}
		{l s='There is %d product.' sprintf=$nb_products}
	{else}
		{l s='There are %d products.' sprintf=$nb_products}
	{/if}
{/if}

Hello

 

this code doesn't seems to work in version 1.6.1.1

I still keeping "There are no ...."

 

i changed the default en my template in use...

 

I don't have any products in the category only in subcategories.

Structure

 

Home

 -- Main cat

  -- sub cat

Link to comment
Share on other sites

×
×
  • Create New...