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

Smarty help

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-19-2009, 04:57 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Smarty help

Ok, this one is perplexing me - one of you Smarty gurus should be able to help. Using Firetank's featured product manager for some category-specific featured product groups. I want to call the template automatically based on the category name, so I use this in subcategories.tpl:

{include file="customer/fts_featured_products.tpl" group="`$current_category.category`"}

Works great - except for categories with multiple words in them. The Firetank mod doesn't accept spaces for the group, just _ characters. So I need to replace any spaces in the Smarty variable with _. I've tried using |replace, but with Smarty inside Smarty it is getting a bit crazy and spitting out SQL errors. Any help? Thanks!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #2  
Old 02-19-2009, 05:14 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Smarty help

How about using the category ID instead?
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 02-19-2009, 05:39 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Smarty help

Because the client will have no clue what that is when they are adding 1000 of those to the featured product manager, and I'd hate to have to make them go back and forth each time to look it up Trust me, that was my first thought as well
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 02-19-2009, 09:57 PM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: Smarty help

Try this:
{include file="customer/fts_featured_products.tpl" group="`$current_category.category`"|replace:' ':'_'}

or else
assign the value to the variable and then use it in the include
like this:

{assign var="catname" value="`$current_category.category`"|replace:' ':'_'}
{include file="customer/fts_featured_products.tpl" group="`$catname`"}
Reply With Quote
  #5  
Old 02-20-2009, 03:38 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Smarty help

Thanks Vetrivel, it was the closing quote after the current_category variable that I was missing - works great!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
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 06:55 AM.

   

 
X-Cart forums © 2001-2020