Link to home
Start Free TrialLog in
Avatar of kevin1983
kevin1983Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Send Item code value variant on website form

Hi
I have the following form code on a webpage below to allow a customer to select a product quantity and product variant from a website shop. What I would like to be able to do is send a different value to the shopping basket depending on what product variant the customer selects if possible?.
 
So for example if the customer selects “Standard head” the value passed to the shopping cart would be: “2390MSA” but if the customer instead selects: “Compact head” then the value passed to the shopping cart would be: “2390BBB”

Any help on this would be brilliant.

<form action=http://www.companywebsite.com/shop/addtocart.php method=get>
Price &pound;1.99<span class="style1">_______</span>Quantity&nbsp;
<select name=quantity><option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10</select>&nbsp;Variant&nbsp;
<select name=type><option>Standard Head<option>Compact Head</select>
<input type=submit value='Add to Basket'>
<input name="product" type="hidden" value="2390MSA"/>
</form>

The addtocart.php page code is below which sends the information to the romancart shopping cart software:

<iframe src="http://www.romancart.com/cart.asp?storeid=12345&itemcode=<?php echo $_GET['product']?>&quantity=<?php echo $_GET['quantity']?>&itemname2=<?php echo $_GET['type']?>" height="400" width="600" frameborder="0" scrolling="Yes"> IFrame. </iframe>
            </h2>
             <p>&nbsp;</p>
Avatar of MMDeveloper
MMDeveloper
Flag of United States of America image

<select name="type"><option value="2390MSA">Standard Head<option value="2390BBB">Compact Head</select>
ASKER CERTIFIED SOLUTION
Avatar of MMDeveloper
MMDeveloper
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kevin1983

ASKER

ok i tired that but i get this error message when adding either item to the cart:
"XError: 2390MSA is not a valid itemname2 value."
maybe the addtocart.php page needs to be modified also: (which includes the name "itemname2")

<iframe src="http://www.romancart.com/cart.asp?storeid=12345&itemcode=<?php echo $_GET['product']?>&quantity=<?php echo $_GET['quantity']?>&itemname2=<?php echo $_GET['type']?>" height="400" width="600" frameborder="0" scrolling="Yes"> IFrame. </iframe>
            </h2>
             <p>&nbsp;</p>
is this the correct code you think i need?:
<form action=http://www.companywebsite.com/shop/addtocart.php method=get>
Price &pound;1.99<span class="style1">_______</span>Quantity&nbsp;
<select name=quantity><option>1<option>2<option>3<option>4<option>5<option>6<option>7<option>8<option>9<option>10</select>&nbsp;Variant&nbsp;
<select name="type">
      <option value="2390MSA">Standard Head</option>
      <option value="2390BBB">Compact Head</option>
</select><input type=submit value='Add to Basket'>
<input name="product" type="hidden" value="2390MSA"/>
</form>
Ok ive got it working now, thanks for your help