View Single Post
  #6  
Old 05-15-2004, 07:19 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

Thank you for the compliment on the site

Well, there is a littel bit going on there. First, I wanted to display the "name" of the option within the dropdowns. So, I had to modify the product.tpl file from this:
Code:
<select name=amount> {if $product.min_amount le 1} {assign var="start_quantity" value=1}
to this:
Code:
<select name="amount"> <option value="0">quantity</option> {if $product.min_amount le 1} {assign var="start_quantity" value=1}
This put the name "quantity" as the first value in the quantity dropdown.

Then when entering my product options, I added the name of the option as the first selection in each listing. So for instance, I create an option named Size. The options would be:

Code:
select a size Small Medium Large x-Large

Next I needed to edit the customer_options.tpl file to remove the feild names (since they would be displayed in the dropdown).

Then I have to add Product Option Validation to each product. If I have all three options (Size, Color, Quantity) then the validation would look like this:

Code:
if (product_option('Color').selectedIndex == 0) { alert('Please Select A Color'); return false; } if (product_option('Size').selectedIndex == 0) { alert('Please Select A Size'); return false; } if (product_option('amount').selectedIndex == 0) { alert('Please Select A Quantity'); return false; } { return true; }

If I only have to options (Size, Quantity), then I just enter the appropriate validations:

Code:
if (product_option('Size').selectedIndex == 0) { alert('Please Select A Size'); return false; } if (product_option('amount').selectedIndex == 0) { alert('Please Select A Quantity'); return false; } { return true; }

Since the default for any dropdown box is to have option "0" selected, this validation checks to make sure that "0" is not selected. So, they are not able to submit to the cart without making a selection from each of the dropdowns.

**Disclaimer** This is a modification that I made on my site and I do not make any warranties that it will work in your sitiation.
Reply With Quote