X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   $subcat.product_count no longer works (https://forum.x-cart.com/showthread.php?t=56730)

Sisom 11-25-2010 05:23 AM

$subcat.product_count no longer works
 
Hi, I've recently had my site moved to a new server, and I've just noticed that my subcategory product boxes no longer display the number of items in them.

My site is at

http://www.3drom.com/store/


and you can view an example at


http://www.3drom.com/store/home.php?cat=3


The template is customer/main/category_box.tpl, and the relevant code is as follows:


Code:


<td class="P_Count">{if $config.Appearance.count_products eq "Y"} {if $subcat.product_count} { $subcat.product_count } {$lng.lbl_product}{if $subcat.product_count > 1}s{/if}
                {elseif $subcat.subcategory_count}{ $subcat.subcategory_count } {$lng.lbl_categories|lower}{/if}{/if}</td>


I've tried commenting out
{if $subcat.product_count}
and it then displays
"0 product"

It just no longer seems to find the variable { $subcat.product_count }. I've made sure that "
Show quantity in stock: " is ticked in General Settings, Appearance.

Sisom 06-12-2011 01:47 PM

Re: $subcat.product_count no longer works
 
Sorry to bump this, but I wondered if anybody had any ideas.

If I put

Code:

{$subcat.product_count} {$lng.lbl_product}{if $subcat.product_count > 1}s{/if}

then it displays

"1 product" (or however many products there are)

but if I put

Code:

{if $subcat.product_count}{$subcat.product_count} {$lng.lbl_product}{if $subcat.product_count > 1}s{/if}{/if}

it doesn't display anything! Surely if it displays a value for {$subcat.product_count} then {if $subcat.product_count} should work?

cflsystems 06-12-2011 03:13 PM

Re: $subcat.product_count no longer works
 
{$subcat.product_count} {$lng.lbl_product}{if $subcat.product_count ne 1}s{/if}

Sisom 06-12-2011 10:42 PM

Re: $subcat.product_count no longer works
 
Thanks for your help Steve - should it say "0 products" because I have set all product quantities to zero? I thought it would show "5 products" if there are five products in that subcategory, even though the quantity of each product is zero.

I currently have the following code:


Code:

<td class="P_Count">{$subcat.product_count} {$lng.lbl_product}{if $subcat.product_count ne 1}s{/if}
Code:


                {if $config.Appearance.count_products eq "Y"} {if $subcat.product_count} { $subcat.product_count } {$lng.lbl_product}{if $subcat.product_count > 1}s{/if}
                {elseif $subcat.subcategory_count}{ $subcat.subcategory_count } {$lng.lbl_categories|lower}{/if}{/if}</td>


Nothing from {if $config.Appearance.count_products eq "Y"} onwards works, even though it's turned on in the Control Panel.

And if I put

Code:

{if $subcat.product_count}{$subcat.product_count}{$subcat.product_count} {$lng.lbl_product}{if $subcat.product_count ne 1}s{/if}{/if}

it doesn't work. Why is that? Is it because $subcat.product_count has a value of zero? I thought it was counting the number of products, not product quantities.

cflsystems 06-13-2011 03:13 AM

Re: $subcat.product_count no longer works
 
Not sure what you are trying to do but if it doesn't work then you are not using it correctly. And yes I think the product count should count products not their quantities

gb2world 06-13-2011 09:18 AM

Re: $subcat.product_count no longer works
 
try
{if subcat.product_count gt 0} or {if subcat.product_count neq 0}

You appear to be testing for the existence of the variable instead of that it is not 0.

---


All times are GMT -8. The time now is 04:53 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.