Zen Cart Logo
Forums / General Questions / Customized attribute template not passing attribute selection to shopping cart

Customized attribute template not passing attribute selection to shopping cart

Locked

Views: 1,656

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
29 Dec 2009, 10:45 PM
#1
forced avatar

forced

New Zenner

Join Date:
Oct 2007
Posts:
61
Plugin Contributions:
0

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/index.php?main_page=product_info&cPath=1&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:

<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:

30 Dec 2009, 4:50 AM
#2
forced avatar

forced

New Zenner

Join Date:
Oct 2007
Posts:
61
Plugin Contributions:
0

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.

30 Dec 2009, 6:59 AM
#3
forced avatar

forced

New Zenner

Join Date:
Oct 2007
Posts:
61
Plugin Contributions:
0

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 "]" ?

30 Dec 2009, 7:08 AM
#4
forced avatar

forced

New Zenner

Join Date:
Oct 2007
Posts:
61
Plugin Contributions:
0

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

30 Dec 2009, 5:20 PM
#5
forced avatar

forced

New Zenner

Join Date:
Oct 2007
Posts:
61
Plugin Contributions:
0

Re: Customized attribute template not passing attribute selection to shopping cart

Morning bump! :hug:

2 Jan 2010, 7:44 PM
#6
forced avatar

forced

New Zenner

Join Date:
Oct 2007
Posts:
61
Plugin Contributions:
0

Re: Customized attribute template not passing attribute selection to shopping cart