Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

$subcat.product_count no longer works

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-25-2010, 05:23 AM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default $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.
__________________
X-Cart Gold Version 4.3.2
Reply With Quote
  #2  
Old 06-12-2011, 01:47 PM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default 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?
__________________
X-Cart Gold Version 4.3.2
Reply With Quote
  #3  
Old 06-12-2011, 03:13 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: $subcat.product_count no longer works

{$subcat.product_count} {$lng.lbl_product}{if $subcat.product_count ne 1}s{/if}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #4  
Old 06-12-2011, 10:42 PM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default 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.
__________________
X-Cart Gold Version 4.3.2
Reply With Quote
  #5  
Old 06-13-2011, 03:13 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 06-13-2011, 09:18 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default 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.

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:46 AM.

   

 
X-Cart forums © 2001-2020