Have you had a chance to try this mod with the ver 4.1.9 release? I tried applying your modifications as shown below and added the validation codes below into the "Validation Script (Javascript)" section of the product options.
---------------------------------------------------------------------------------------------------------------------------------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;
---------------------------------------------------------------------------------------------------------------------------------
It doesn't work as expected. Am I missing something? When the customer click "Add to Cart", IE throw up the "error on page" message.
Thanks
-Tuan
Quote:
Originally Posted by carpeperdiem
Wow. Lovely mod. Very useful. Thank you.
Post #12 is required reading to make this work for 4.1.x
Here are the changes I made to my customer_options.tpl, as a reference (version 4.1.8 )
FIND:
Code:
{foreach from=$v.options item=o}
<option value="{$o.optionid}"{if $o.selected eq 'Y'} selected="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 plain_text_message=1}{else}{$o.price_modifier}%{/if}){/if}</option>
{/foreach}
REPLACE WITH:
Code:
{* I have 2 products that have a single-color option -- they will someday have more than one so I need to exclude these 2 products from this mod...
if you don't need to exclude any products, make the next line go away *}
{if $product.productid ne '9' && $product.productid ne '3' }
{* BEGIN "PLEASE SELECT" MOD *}
<option>Please Select Your {$v.classtext|default:$v.class}...{if $o.selected eq 'Y'} selected="selected"{/if}</option> {/if}
{foreach from=$v.options item=o}
<option value="{$o.optionid}">{$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 plain_text_message=1}{else}{$o.price_modifier}%{/if}){/if}</option>
{/foreach}
Mike -- this a GREAT addition. Thank you!
|