I'm experimenting with this right now, and it (sort of) works..
I see the selection boxes, the first one is fully populated, but the second one doesn't include all possible variants..
Right now I'm just a bit too tired of setting up everything that I can't really see straight and follow the code, so please give me some advice here..
The generated selection box code on the page is this:
But the database contains the proper values, and as far as I can see, quite some more options to choose from in the second selection box.HTML Code:<!--bof Attributes Module --> <div id="productAttributes"> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><b>Glöm inte att välja: </b></td> </tr> <tr> <td align="right" class="main"><b>Storlek:</b></td> <td class="main"><select name="id[1]" onchange="i1(this.form);"> <option value="0" selected="selected">First select Storlek</option> <option value="1">8½</option> <option value="2">9</option> <option value="3">9½</option> <option value="4">10</option> <option value="5">10½</option> <option value="6">11</option> </select></td> </tr> <tr> <td align="right" class="main"><b>Färg:</b></td> <td class="main"><select name="id[2]"> <option value="0" selected="selected">Next select Färg</option> </select></td> </tr> <tr> <td colspan="2"> <script type="text/javascript" language="javascript"><!-- var stk={1:{8:1,9:1,13:1},2:{8:1,9:1,13:1},3:{8:1,9:1,13:1},4:{8:1,9:1,13:1},5:{8:1,9:1,13:1},6:{8:1,9:1,13:1}}; var txt2={8:'Svart ',9:'Barely black ',11:'Platina ',12:'Choklad ',13:'Brons '}; function i1(frm) { frm['id[2]'].length=1; for (opt in stk[frm['id[1]'].value]) { frm['id[2]'].options[frm['id[2]'].length]=new Option(txt2[opt],opt); } } i1(document.cart_quantity); function chksel() { var ok=true; if (this['id[1]'].value==0) ok=false; if (this['id[2]'].value==0) ok=false; if (!ok) alert('Du måste välja vilken storlek, färg med mera du vill ha.'); return ok; } document.cart_quantity.onsubmit=chksel; //--></script></td> </tr> </table> <br class="clearBoth" /> </div> <!--eof Attributes Module -->
Code:stock_id ; products_id ; stock_attributes ; quantity ; 1 ; 4 ; 1,7 ; 500000 2 ; 4 ; 2,7 ; 500000 3 ; 4 ; 3,7 ; 500000 4 ; 4 ; 4,7 ; 500000 5 ; 4 ; 5,7 ; 500000 6 ; 4 ; 6,7 ; 500000 7 ; 4 ; 1,8 ; 500000 8 ; 4 ; 2,8 ; 500000 9 ; 4 ; 3,8 ; 500000 10 ; 4 ; 4,8 ; 500000 11 ; 4 ; 5,8 ; 500000 12 ; 4 ; 6,8 ; 500000 13 ; 4 ; 11,1 ; 500000 14 ; 4 ; 11,2 ; 500000 15 ; 4 ; 11,3 ; 500000 16 ; 4 ; 11,4 ; 500000 17 ; 4 ; 11,5 ; 500000 18 ; 4 ; 11,6 ; 500000 19 ; 4 ; 10,1 ; 500000 20 ; 4 ; 10,2 ; 500000 21 ; 4 ; 10,3 ; 500000 22 ; 4 ; 10,4 ; 500000 23 ; 4 ; 10,5 ; 500000 24 ; 4 ; 10,6 ; 500000 25 ; 4 ; 1,9 ; 500000 26 ; 4 ; 2,9 ; 500000 27 ; 4 ; 3,9 ; 500000 28 ; 4 ; 4,9 ; 500000 29 ; 4 ; 5,9 ; 500000 30 ; 4 ; 6,9 ; 500000![]()








Bookmarks