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)
-   -   Extra Fields... drop down box, not text field (https://forum.x-cart.com/showthread.php?t=11089)

g0t0pless 12-22-2004 09:55 PM

Extra Fields... drop down box, not text field
 
Is there a way to make the extra fields option into a drop down box where I could choose from 3 different options when I add the product?

I sell items that are in retail package, OEM package, and bulk package. I would like to add the info to the extra field, but I want to choose the options rather than typing them in.

g0t0pless 12-26-2004 07:31 PM

Anyone?

g0t0pless 01-19-2005 02:37 PM

I'M STILL LOOKING FOR A WAY TO DO THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Giray 04-09-2005 11:45 AM

*BUMP*

I would also like an option to be able to generate the extra field content either via a drop down, checkboxes, or whatever. Basically, I need all my providers to have a fixed set of choices for one of my extra fields.

Thanks.

micromedia 04-10-2005 01:34 AM

Actually I need to.
Anybody knows, how can we do?

shan 04-11-2005 03:46 AM

you would have to hard code a select drop down into the extra fields template

TheWrongGrape 06-13-2007 03:01 PM

Re: Extra Fields... drop down box, not text field
 
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!

MandV 02-29-2012 08:10 PM

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

The code you gave in the post works really well. However I have a problem with dropdown with multiple choices :( :
only the last choice will be implemented in the data base. Is there a way of changing this? Where should I change this features?

Thank you for your help and very nice code!

Cheers!

gozindagi 05-13-2014 03:49 AM

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?


All times are GMT -8. The time now is 05:31 PM.

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