Customized attribute template not passing attribute selection to shopping cart
I'm so close to finding a solution! I thought I had everything wrapped up for my project, but ran into a problem.
Here's the page I am working on:
http://www.cacorvettecustoms.com/ind...&products_id=2
I have made an if/then statement when calling the "tpl_modules_attributes.php" from the "tpl_product_info_display.php" page. Basically, if it's any another product than this one, the standard attributes page loads. When this product, product_id=2, is loaded, i load a static attribute page.
The first 4 attributes are fine the way the are. I am trying to get the color option to be dynamic based off the year. I have used a simple way to get this done. However, it seems that using the standard form names causes an issue. In the line:
Code:
<select name="id[5]" id="attrib-5" onchange="setOptions(document.cart_quantity.id[5].options[document.cart_quantity.id[5].selectedIndex].value);">
The id[5] seems to be messing it up. I tried to rename the form components, and it worked for the page, but it does not carry the attributes over to the shopping cart.
Help!
:frusty:
Re: Customized attribute template not passing attribute selection to shopping cart
I see the title of the thread changed. Thanks! (I think:D) This does seem a more appropriate title.
Re: Customized attribute template not passing attribute selection to shopping cart
I'm not sure if I found something or not.
The actual code I am using in the onchange is:
document.cart_quantity.id[5].options
When I get an error, it shows...
Line: 357
Error: 'document.cart_quantity.id.5.options' is null or not an object
Does this have to do with the name of the select on the form having a "[" and "]" ?
Re: Customized attribute template not passing attribute selection to shopping cart
So I changed the id[5] to year and the id[6] to color and the page will work. However, as before, the attributes do not get passed to the shopping cart. :shocking:
So the special characters "[" and "]" are messing up the script. I've been searching all day for a way around this. Help!
-steve
Re: Customized attribute template not passing attribute selection to shopping cart
Re: Customized attribute template not passing attribute selection to shopping cart
Well I got this one solved. I used a script from the following URL:
http://roshanbh.com.np/2007/12/chang...x-and-php.html
Now it works! Check it out here:
http://www.cacorvettecustoms.com/ind...&products_id=2
:clap: