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

Variables in product descriptions?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-09-2006, 12:00 PM
 
mocara mocara is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 55
 

Default 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.
__________________
4.0.15
Linux
Reply With Quote
  #2  
Old 04-09-2006, 05:16 PM
 
balinor balinor is offline
 

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

Default

Smarty tags won't work by default inside a product description, no.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-10-2006, 02:51 AM
 
mocara mocara is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 55
 

Default

'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.
__________________
4.0.15
Linux
Reply With Quote
  #4  
Old 04-15-2006, 03:18 PM
 
mocara mocara is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 55
 

Default

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
__________________
4.0.15
Linux
Reply With Quote
  #5  
Old 08-10-2006, 12:35 AM
 
alru111 alru111 is offline
 

eXpert
  
Join Date: Dec 2005
Posts: 244
 

Default

nice one, should be a sticky

are there any drawbacks to adding eval ?
__________________
X-Cart version 4.0.19
Reply With Quote
  #6  
Old 07-01-2008, 07:49 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default 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}
Reply With Quote
  #7  
Old 12-22-2008, 09:49 PM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default 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.
Reply With Quote
  #8  
Old 12-26-2008, 09:28 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #9  
Old 12-26-2008, 09:44 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default 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.
Reply With Quote
  #10  
Old 12-26-2008, 11:00 AM
 
Light Speed Light Speed is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 921
 

Default 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>
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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:44 AM.

   

 
X-Cart forums © 2001-2020