View Single Post
  #9  
Old 05-13-2014, 03:49 AM
 
gozindagi gozindagi is offline
 

Advanced Member
  
Join Date: Jul 2013
Posts: 61
 

Default Re: Extra Fields... drop down box, not text field

Quote:
Originally Posted by TheWrongGrape
Old post, so I don't know if this has already been solved elsewhere, but...

I wanted to accomplish the same thing and was searching the forums, couldn't find an answer but this thread helped me figure it out.

/modules/Extra_Fields/product_modify.tpl contains the code for what the Extra Fields area looks like when you're adding/modify one of your products. It basically codes a row with the 1st column being the extra field's name and the 2nd column being the input textbox for the extra field's value. This row loops for each of your Extra Fields.

I added an if-statement that coded a different kind of 2nd column (with a drop-down instead) if the Extra Field met one of my criterias. Here's my new code:

Code:
{section name=field loop=$extra_fields} <TR> {if $productids ne ''}<TD width="15" class="TableSubHead"><INPUT type="checkbox" value="Y" name="fields[efields][{$extra_fields[field].fieldid}]"></TD>{/if} <TD class="FormButton" nowrap> {$extra_fields[field].field} </TD> <TD> {* BEGIN NEW IF STATEMENT *} {if $extra_fields[field].field eq "Banana"} <select name="efields[{$extra_fields[field].fieldid}]"> <option value="Option1">Option1</option> <option value="Option2">Option2</option> <option value="Option3">Option3</option> </select> {else} {* BEGIN REGULAR TEXTBOX CODE *} <INPUT type="text" name="efields[{$extra_fields[field].fieldid}]" size="24" value="{if $extra_fields[field].is_value eq 'Y'}{$extra_fields[field].field_value|escape:"html"}{else}{$extra_fields[field].value|escape:"html"}{/if}"> {/if} {* END NEW IF STATEMENT *} </TD> </TR> {/section}

After the {else} is the regular code for the input textbox. Make sure to add an {/if} before the {/section} to close this new statement. Replace "Banana" with the actual name of the Extra Field you previously created and Option1, Option2, etc with your actual options. I tested in 4.0.18 and it works for me. Hope this helps someone. I know how frustrating it can be to search and search!
It works perfectly at front end of our store but at the back end section(provider admin area) extra field values have not updated.Please tell me how can I update Extra Field value from provider area?
__________________
X-cart Platinum 4.6.0
Reply With Quote