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

Extra Fields... drop down box, not text field

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-22-2004, 09:55 PM
 
g0t0pless g0t0pless is offline
 

eXpert
  
Join Date: Jul 2003
Posts: 360
 

Default 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.
__________________
4.1.7
X-Cart Gold
Product Configurator Module
Advanced Order Management Module
RMA Module
Feature Compare Module
Blue Dream theme by 7Dana.com
Reply With Quote
  #2  
Old 12-26-2004, 07:31 PM
 
g0t0pless g0t0pless is offline
 

eXpert
  
Join Date: Jul 2003
Posts: 360
 

Default

Anyone?
__________________
4.1.7
X-Cart Gold
Product Configurator Module
Advanced Order Management Module
RMA Module
Feature Compare Module
Blue Dream theme by 7Dana.com
Reply With Quote
  #3  
Old 01-19-2005, 02:37 PM
 
g0t0pless g0t0pless is offline
 

eXpert
  
Join Date: Jul 2003
Posts: 360
 

Default

I'M STILL LOOKING FOR A WAY TO DO THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
__________________
4.1.7
X-Cart Gold
Product Configurator Module
Advanced Order Management Module
RMA Module
Feature Compare Module
Blue Dream theme by 7Dana.com
Reply With Quote
  #4  
Old 04-09-2005, 11:45 AM
 
Giray Giray is offline
 

Member
  
Join Date: Apr 2005
Posts: 21
 

Default

*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.
__________________
X-Cart 4.0.13
Add-ons: X-Affiliate, X-RMA, X-FeatureComparison, X-AOM, X-FancyCategories
Skin: Fashion Mosaic Green
Reply With Quote
  #5  
Old 04-10-2005, 01:34 AM
 
micromedia micromedia is offline
 

Member
  
Join Date: Feb 2005
Posts: 27
 

Default

Actually I need to.
Anybody knows, how can we do?
__________________
X Cart Gold Ver. 4.1.6
Reply With Quote
  #6  
Old 04-11-2005, 03:46 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

you would have to hard code a select drop down into the extra fields template
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #7  
Old 06-13-2007, 03:01 PM
 
TheWrongGrape TheWrongGrape is offline
 

Advanced Member
  
Join Date: Nov 2002
Location: Los Angeles, CA
Posts: 68
 

Talking 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!
Reply With Quote
  #8  
Old 02-29-2012, 08:10 PM
 
MandV MandV is offline
 

Newbie
  
Join Date: Feb 2012
Posts: 1
 

Default 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!
__________________
x-cart gold version 4.3.1
Modules: lib Curl 7.21.6
Reply With Quote
  #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
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 01:28 PM.

   

 
X-Cart forums © 2001-2020