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

Displaying "product" or "products" in subcategory pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-05-2010, 06:13 AM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default Displaying "product" or "products" in subcategory pages

Another simple mod for 4.3, but will probably work for earlier versions with a bit of tweaking.

I edited customer/main/subcategories_t.tpl

It originally said this at around line 14:

Code:
{if $config.Appearance.count_products eq "Y"} {if $subcategory.product_count} {$lng.lbl_N_products|substitute:products:$subcategory.product_count} {elseif $subcategory.subcategory_count} {$lng.lbl_N_categories|substitute:count:$subcategory.subcategory_count}{/if} {/if}

"lbl_N_products" merely says "{{products}} products"
and
"lbl_N_categories" merely says "{{count}} categories"

So I replaced the code above with:

Code:
{if $config.Appearance.count_products eq "Y"} {if $subcategory.product_count}{$subcategory.product_count} {$lng.lbl_product}{if $subcategory.product_count > 1}s{/if}{/if} {elseif $subcategory.subcategory_count} {$subcategory.subcategory_count}{if $subcategory.subcategory_count = 1}{$lng.lbl_subcategory}{elseif $subcategory.subcategory_count > 1}{$lng.lbl_subcategories}{/if} {/if}


Then I added the following labels:
lbl_subcategory "subcategory"
lbl_subcategories "subcategories"

I'm surprised they didn't do it this way in the first place.




__________________
X-Cart Gold Version 4.3.2
Reply With Quote
  #2  
Old 11-03-2010, 10:56 PM
 
BBM_ BBM_ is offline
 

X-Adept
  
Join Date: May 2010
Location: Australia
Posts: 595
 

Default Re: Displaying "product" or "products" in subcategory pages

Hi Sisom,

I'm trying to install your modification and I was getting a smarty error (Which has since disappeared).

Now it appears to be ok, but no subcategory are showing up.

Can I confirm you created the labels in the languages section of the back end?
__________________
Multiple instances of X-cart
Reply With Quote
  #3  
Old 11-18-2010, 10:56 PM
 
Sisom Sisom is offline
 

eXpert
  
Join Date: Sep 2006
Posts: 310
 

Default Re: Displaying "product" or "products" in subcategory pages

Hi BBM, yes, I created the labels in the languages section of the control panel.

Try just putting

{$lng.
lbl_subcategory}

somewhere else in the template (i.e. outside the 'if' statements) so that it should definitely be parsed, and then see if it displays 'subcategory' on the page.
__________________
X-Cart Gold Version 4.3.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 09:01 AM.

   

 
X-Cart forums © 2001-2020