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

Product Options Dropdown "Select XXXX..."

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-03-2006, 03:42 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default Product Options Dropdown "Select XXXX..."

A lot of XC users have used the first product option as "Select Size" or "Choose..." whatever variant text is used. But, this isn't necessary. If you would rather this appeared automatically in your drop downs, then simply modify:

/modules/Product_Options/customer_options.tpl

Find:
Code:
<SELECT id="po{$v.classid}" name="{$poname}"{if $disable} disabled{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}> {foreach from=$v.options item=o} <OPTION value="{$o.optionid}"{if $o.selected eq 'Y'} selected{/if}>{$o.option_name}{if $v.is_modifier eq 'Y' && $o.price_modifier ne 0} ({if $o.modifier_type ne '%'}{include file="currency.tpl" value=$o.price_modifier display_sign=1}{else}{$o.price_modifier}%{/if}){/if}</OPTION> {/foreach} </SELECT>
and add:
Code:
<option>Select {$v.classtext|default:$v.class}...</option>
on the line before {foreach from=$v.options item=o} so that it doesn't loop for each option.

That will display "Select (Option)..." where (Option) is your option text. No big deal, so you might add a javascript error so a customer must make some selections....

Add a javascript error for a couple dropdowns- one for size and the other for color perhaps? Just change the number (like 'po3') to reflect the option # found next to the option class in "product options".

Put this into the bottom text area of the "product Options" page of the respective product.

Code:
if (document.getElementById('po3').selectedIndex == 0) { alert('Please select a size for your item.'); return false; } if (document.getElementById('po4').selectedIndex == 0) { alert('Please select a color for your item.'); return false; } else return true;

This is a 2-minute mod, but thought I'd share it nonetheless. I have worked many a site that uses the manual "Select..." text.

- Mike
__________________
4.1.9
Reply With Quote

The following 5 users thank mffowler for this useful post:
AG9V (07-16-2009), am2003 (07-11-2010), bjt (01-17-2011), McPace (03-17-2010), Mr. G (12-23-2010)
  #2  
Old 04-03-2006, 03:51 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Hey Mike...was just looking for this exact piece of JavaScript, as I used a similar mod on a couple of sites last month for the options. Where exactly are you putting the JS?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-03-2006, 06:31 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Bottom of product options page. If you like, I can dig up a stack of others that I have written and tested for multiple dropdown errors...

- Mike
__________________
4.1.9
Reply With Quote
  #4  
Old 04-03-2006, 06:42 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

You mean customer_options.tpl? Tried that with no success....
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 04-03-2006, 06:46 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

No, the javascript just goes in the javascript validation box at the bottom of a products "product options" when they have been created. That's the last text area of the product options, but only seen when/if a product has option.

- Mike
__________________
4.1.9
Reply With Quote
  #6  
Old 04-03-2006, 06:55 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Ahhhhhh.....I was trying to over-complicate things
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #7  
Old 04-04-2006, 06:49 PM
  jvleigh's Avatar 
jvleigh jvleigh is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Kentucky, USA
Posts: 30
 

Default

Would you mind posting a link to an example?

I'm having a hard time visualizing the result.

Thanks a bunch.
__________________
X-Cart Gold: 2 live sites running 4.1.x and 4.2.x Add ons: XAOM, XCONF & XFANCYCAT
Reply With Quote
  #8  
Old 04-04-2006, 06:51 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

http://www.bellalucce.com/Silk-Honey-Lotion-pr-3.html
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #9  
Old 04-04-2006, 07:41 PM
  jvleigh's Avatar 
jvleigh jvleigh is offline
 

Advanced Member
  
Join Date: Feb 2004
Location: Kentucky, USA
Posts: 30
 

Default

Thanks...Just what I needed.
__________________
X-Cart Gold: 2 live sites running 4.1.x and 4.2.x Add ons: XAOM, XCONF & XFANCYCAT
Reply With Quote
  #10  
Old 04-04-2006, 08:06 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Padraic- Nice simplicity to your sites. I can see your top 5 third-party mods.... good work.

- Mike
__________________
4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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:01 PM.

   

 
X-Cart forums © 2001-2020