![]() |
Variables in product descriptions?
Saw a similar thread for very low x-cart versions around 2007.
Can this be done for 4.4.4? I would absolutely love it if it can be done. That way I can create a template using the smarty code for my product descriptions, saving me hours and hours of work. e.g {$product.product} and {if $main eq "manufacturers} etc Someone please shed light on this! :D |
Re: Variables in product descriptions?
Yes, it can be done, using the Webmaster mode, in which you can view the templates involved in the rendering of each page, also can click on the 'Show Variables' button of the webmaster mode popup window, in which section you can view all the smarty variables and their content.
|
Re: Variables in product descriptions?
Quote:
That's good to know, but how can I allow smarty variables to go in product descriptions? As they dont show up inside. |
Re: Variables in product descriptions?
I've tried a few ways of doing this but it doesn't work e.g
<td class="descr">{$product.fulldescr|default:$product .descr}</td> changed to <td class="descr">{eval var=$product.fulldescr|default:$product.descr}</td> Anyone got a suggestion? Editing skin/common_files/customer/main/product_details.tpl |
Re: Variables in product descriptions?
Doesn't matter, decided to do something different, thanks anyways! :)
|
Re: Variables in product descriptions?
How come
Code:
{$product.fulldescr|default:$product.descr} |
Re: Variables in product descriptions?
I can do it on the code itself it works fine, I just wanted to be able to do it via product description e.g using xcart admin to edit a product description,, hope that makes sense. :)
|
Re: Variables in product descriptions?
Not sure if this is what you are looking for. You could try using substitute. Just a thought as I haven't actually tried it in the description:
"This is my {{adjective}} description is." {$product.descr|substitute:"adjective":"amazing"} |
Re: Variables in product descriptions?
I have tried this, and it worked (using the 'replace' smarty modifier):
(the following code is used inside any template file that displays the product description) Code:
{assign var="varname" value=$some_variable}{$product.descr|amp|replace:'<placeholder>':$varname} |
Re: Variables in product descriptions?
This is a very good question. You want in your Admin -> Product page to use in product short or full description any kind of variables (XC variables or your own). For language labels I can confirm that eval() function works.
http://forum.x-cart.com/showthread.php?t=57707&highlight=eval http://forum.x-cart.com/showthread.php?t=44405&highlight=eval Till now I did not think using other variables in product description, just static text. |
All times are GMT -8. The time now is 12:45 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.