View Single Post
  #6  
Old 03-07-2009, 11:26 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: extra fields, assigning a variable, using more than one extra field

I suspect you can't set the variable inside modules/Extra_Fields/product.tpl and it will be applied globally. If you can keep the setting of the variables inside product.tpl - you should be able to use the variables inside the nested templates. To have the variables available globally - I think you would have to set variables in the php files. But before doing that, maybe this will work for you:

At the top of skin1/customer/main/product.tpl - before you call any templates:
Set all the variables:
Code:
{section name=field loop=$extra_fields} {if $extra_fields[field].field eq "Ingredients" && $extra_fields[field].field_value ne ""} {assign var="ingredient" value=$extra_fields[field].field_value} {/if} {if $extra_fields[field].field eq "test exf A" && $extra_fields[field].field_value ne ""} {assign var="exfa" value=$extra_fields[field].field_value} {/if} {if $extra_fields[field].field eq "test exf B" && $extra_fields[field].field_value ne ""} {assign var="exfb" value=$extra_fields[field].field_value} {/if} {/section}


Then, you should be able to use the variables you set above later inside product.tpl and modules/Extra_Fields/product.tpl
Code:
<b>Ingredient:</b> {$ingredient}<br /> <b>Extra Field A:</b> {$exfa}<br /> <b>Extra Field B:</b> {$exfb}<br />
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote