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)
-   -   Smarty help (https://forum.x-cart.com/showthread.php?t=45701)

balinor 02-19-2009 04:57 PM

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!

PhilJ 02-19-2009 05:14 PM

Re: Smarty help
 
How about using the category ID instead?

balinor 02-19-2009 05:39 PM

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 :)

Vetrivel 02-19-2009 09:57 PM

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`"}

balinor 02-20-2009 03:38 AM

Re: Smarty help
 
Thanks Vetrivel, it was the closing quote after the current_category variable that I was missing - works great!


All times are GMT -8. The time now is 01:15 AM.

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