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)
-   -   Parsing Smarty Tags in Extra Fields (https://forum.x-cart.com/showthread.php?t=34675)

jillsybte 10-17-2007 08:27 AM

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

balinor 10-17-2007 08:28 AM

Re: Parsing Smarty Tags in Extra Fields
 
Moving to the Template Editing forum

jillsybte 10-17-2007 11:04 AM

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 :oops:, 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


All times are GMT -8. The time now is 01:41 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.