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

Parsing Smarty Tags in Extra Fields

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-17-2007, 08:27 AM
 
jillsybte jillsybte is offline
 

eXpert
  
Join Date: Jun 2006
Location: New York, USA
Posts: 389
 

Question Parsing Smarty Tags in Extra Fields

Is there a way to parse Smarty tags in extra fields? I went to the product.tpl file in skin1/modules/Extra_Fields and changed

Code:
{$extra_fields[field].field_value}

to

Code:
{eval var=$extra_fields[field].field_value}

but it just kept the field from displaying at all.

I want to have a manufacturer extra field that would be a link to the manufacturer's page of products (like thay do at Amazon, etc.) The link would be the same as clicking on the manufacturer's name in the Manufacturers menu. I know I could just do a regular HTML link with the actual URL, but using variables would save me from having to look up the ID each time and would also prevent mistakes.

I'm not a Smarty expert so I don't know what else is involved. I just looked at the pages.tpl file under skin1/customer/main because I know we have the option of parsing Smarty tags in embedded static pages. I'm thinking something needs to be captured in addition to the eval.

If anyone has more expertise in Smarty templates and might know how to make this happen, I'd really appreciate it.

Thanks,
Jill
__________________
X-Cart Gold 4.1.8 (Live)
BCSE Shipping Estimator for FLC Mod
BCSE Shipping Methods per Product Mod
BCSE Customer Review Management Mod
BCSE Catalog Order Form Mod
X-Cart Gold 4.5.2 (Building/Testing)
USA
Reply With Quote
  #2  
Old 10-17-2007, 08:28 AM
 
balinor balinor is offline
 

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

Default Re: Parsing Smarty Tags in Extra Fields

Moving to the Template Editing forum
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 10-17-2007, 11:04 AM
 
jillsybte jillsybte is offline
 

eXpert
  
Join Date: Jun 2006
Location: New York, USA
Posts: 389
 

Thumbs up Re: Parsing Smarty Tags in Extra Fields

Sorry I placed my post in the wrong spot...

It turns out adding eval was working. I was just over-complicating and not placing the correct information between my link tags , so I was just seeing a blank space. All I had to do was place this in the extra field:

Quote:
{if $product.manufacturerid gt 0}<a href="manufacturers.php?manufacturerid={$product.m anufacturerid}">{$product.manufacturer}</a>{else}None Specified{/if}

and make the change to skin1/modules/Extra_Fields/product.tpl that I mentioned above. I placed the if else statement in case I forget and place this code in the Manufacturer extra field of a product for which I haven't specified a manufacturer. I may instead place an if statement in the Extra_Fields/product.tpl to have it not display the field at all if $product.manufacturerid = 0.

Jill
__________________
X-Cart Gold 4.1.8 (Live)
BCSE Shipping Estimator for FLC Mod
BCSE Shipping Methods per Product Mod
BCSE Customer Review Management Mod
BCSE Catalog Order Form Mod
X-Cart Gold 4.5.2 (Building/Testing)
USA
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 05:54 AM.

   

 
X-Cart forums © 2001-2020