View Single Post
  #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