Variables in product descriptions?
Hi,
As part of the description in our products we often quote the price. As this is different for different users, we would like to be able to put something link {price} in the description of a product to be replaced with the actual price. Is there a method of doing this? When I tried including smarty code it was displayed rather than executed. Mocara. |
Smarty tags won't work by default inside a product description, no.
|
'by default'? Does that mean it can be done? Does that envolve surrounding any time the product description is displayed by an {eval} or some such?
Mocara. |
For anyone interested in doing this. Place variables indside brackets in your description, e.g. {$products[product].list_price}
In skin1/customer/main/products.tpl change {$products[product].descr|truncate:900:"...":true} to {eval var=$products[product].descr|truncate:900:"...":true} Just in case anyone was interested :-) |
nice one, should be a sticky
are there any drawbacks to adding eval ? |
Re: Variables in product descriptions?
no longer DESPERATE!!!!! -SOLVED-
Since upgrading from 4.1.8 to 4.1.10 this no longer is working for me and my includes in product descriptions are printing as the include code rather than including the contents of the include file. What is the way in 4.1.10 to allow includes in product descriptions? EDIT: To implement this you should modify the 'skin12/customer/main/product.tpl' file. Find the following code: ------------------------------- {if $product.fulldescr ne ""}{ $product.fulldescr}{else}{$product.descr}{/if} ------------------------------- and replace it with this one: ------------------------------- {if $product.fulldescr ne ""}{eval var=$product.fulldescr}{else}{$product.descr}{/if} |
Re: Variables in product descriptions?
How can we accomplish this in 4.2???????
I use smarty to add in a custom tpl for sizing info and specific branding info that I have in one file rather than having to modify it in every individual product description when it changes. The eval var= does not work in 4.2. |
Re: Variables in product descriptions?
Light Speed: I can confirm the {eval var= ...} works fine in X-Cart 4.2. Just change the template using eval and you will see it works.
Double check your modifications. |
Re: Variables in product descriptions?
Quote:
Thanks for the confirmation! I will try again. |
Re: Variables in product descriptions?
Yup it works!
THIS IS FOR XCART 4.2 AND UP ONLY! skin1/customer/main/product.tpl Change this: Code:
<p class="descr">{$product.fulldescr|default:$product.descr}</p> to this: Code:
<p class="descr">{eval var=$product.fulldescr|default:$product.descr}</p> |
All times are GMT -8. The time now is 02:19 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.