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)
-   -   Variables in product descriptions? (https://forum.x-cart.com/showthread.php?t=21027)

mocara 04-09-2006 12:00 PM

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.

balinor 04-09-2006 05:16 PM

Smarty tags won't work by default inside a product description, no.

mocara 04-10-2006 02:51 AM

'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.

mocara 04-15-2006 03:18 PM

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

alru111 08-10-2006 12:35 AM

nice one, should be a sticky

are there any drawbacks to adding eval ?

Light Speed 07-01-2008 07:49 PM

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}

Light Speed 12-22-2008 09:49 PM

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.

ADDISON 12-26-2008 09:28 AM

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.

Light Speed 12-26-2008 09:44 AM

Re: Variables in product descriptions?
 
Quote:

Originally Posted by am2003
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 you modifications.


Thanks for the confirmation!
I will try again.

Light Speed 12-26-2008 11:00 AM

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.