This thread really helped me out, however, I'm still having a few difficulties because the price variation I have on the selections for ADDITIONALINFO just won't increase the value in the cart with the change to radio buttons.
Here's the code for the dropdown version (that works OK):
if ( thisForm.ADDITIONALINFO3 != null ) {
var xx = thisForm.ADDITIONALINFO3[thisForm.ADDITIONALINFO3.selectedIndex].value.split("^");
strADDTLINFO += "; " + xx[0];
strPRICE = parseFloat(strPRICE) + parseFloat( xx[1] );
}
I've redone ADDITIONALINFO1 and 2 so that they are radio buttons, initially to get it working basically like this:
if ( thisForm.ADDITIONALINFO2 != null ) {
for (var i=0; i < thisForm.ADDITIONALINFO2.length; i++)
{
if (thisForm.ADDITIONALINFO2[i].checked)
{
if ( thisForm.ADDITIONALINFO2 != null ) {
for (var i=0; i < thisForm.ADDITIONALINFO2.length; i++)
{
if (thisForm.ADDITIONALINFO2[i].checked)
{
var rad_val = thisForm.ADDITIONALINFO2[i].value.split("^");
}
}
strADDTLINFO += "; " + rad_val;
}
}
}
strADDTLINFO += "; " + rad_val;
}
This got the items adding to cart - note the beginning of addition of the price variation in this line (marked in red):
var rad_val = thisForm.ADDITIONALINFO2[i].value
.split("^");
I then added the script to finish off the price uplift function, or so I thought:
if ( thisForm.ADDITIONALINFO2 != null ) {
for (var i=0; i < thisForm.ADDITIONALINFO2.length; i++)
{
if (thisForm.ADDITIONALINFO2[i].checked)
{
var rad_val = thisForm.ADDITIONALINFO2[i].value.split("^");
strADDTLINFO += "; " + xx[0];
strPRICE = parseFloat(strPRICE) + parseFloat( xx[1] );
}
}
strADDTLINFO += "; " + rad_val;
}
The product adds to cart with no problem but the price doesn't vary as expected. Its bound to be my very poor JavaScripting at fault but I can't see what the error is, and therefore no solution
Any help would be very greatly appreciated.
Here's the code from the html page that corresponds:
Select height:<br />
<input type="radio" name="ADDITIONALINFO" value="5' - £255^0"/><label>5' - £255</label><br />
<input type="radio" name="ADDITIONALINFO" value="6' - £275^50"/><label>6' - £275</label><br />
<input type="radio" name="ADDITIONALINFO" value="8' - £365^110"/><label>8' - £365</label><br />
<input type="radio" name="ADDITIONALINFO" value="10' - £475^220"/><label>10' - £475</label><br />
<input type="radio" name="ADDITIONALINFO" value="12' - £755^500"/><label>12' - £755</label><br />
<input type="radio" name="ADDITIONALINFO" value="15' - £1195^940"/><label>15' - £1195</label><br />
<input type="radio" name="ADDITIONALINFO" value="18' - £1195^940"/><label>18' - £1195</label><br />
<input type="radio" name="ADDITIONALINFO" value="20' - £1395^1140"/><label>20' - £1395</label><br />
<input type="radio" name="ADDITIONALINFO" value="25' - £1595^1340"/><label>25' - £1595</label><br />
Select colour scheme:<br />
<input type="radio" name="ADDITIONALINFO2" value="blue and silver^0" /><label>blue and silver</label><br />
<input type="radio" name="ADDITIONALINFO2" value="silver and white^0" /><label>silver and white</label><br />
<input type="radio" name="ADDITIONALINFO2" value="red and gold^0" /><label>red and gold</label><br />
<input type="radio" name="ADDITIONALINFO2" value="gold^0" /><label>gold</label><br />
<input type="radio" name="ADDITIONALINFO2" value="silver^0" /><label>silver</label><br />
<input type="radio" name="ADDITIONALINFO2" value="multi^0" /><label>multi</label><br />
<input name="button" type="button" onclick="AddToCart(this.form);" value=" Add to Cart " />
</form>
Thanks in advance
Simon A
