Force a shipping selection

Get help with nopcart formatting or style related issues.

Moderators: Koibito, Stefko, Randy

Force a shipping selection

Postby fifthacedk » Sat Jan 01, 2005 6:49 pm

Hi, I'm converting my website from using paypal buttons to using this excellent shopping cart with worldpay payments added.

My NOP product code looks like this:

<!--Shopping Cart Product Begin-->
<P><FORM NAME=order ACTION="managecart.html" onSubmit="AddToCart(this)">
Quantity: <input type=text size=2 maxlength=3 name=QUANTITY onChange='this.value=CKquantity(this.value)' value="1">
<input type=hidden name="PRICE" value="39">
<input type=hidden name="NAME" value="UK Black Kirk">
<input type=hidden name="ID_NUM" value="001">
<select name="SHIPPING">
<option value="0">Select shipping</option>
<option value="0">UK Second Class Recorded Free</option>
<option value="1.05">UK First Class Recorded £1.05</option>
<option value="7.85">Europe Recorded Airmail £7.85</option>
<option value="10.45">Worldwide Recorded Airmail £10.45</option>
</select>
<input type="image" src="UKpay.gif" border=0 value="Add to Cart" align=top>
</FORM>
<!--Shopping Cart Product End -->

This works excellently, but I used to have a bit of code above my items which made sure that customers choose a shipping option, stopping the <option value="0">Select shipping</option> from being selected.

The code above the items was

<script type="text/javascript">
<!-- Hide JS from HTL validators
function SetShip (obj1) { // record selected shipping option
var obj,pos;
obj = obj1.SHIPPING; // refer to shipping select
pos = obj.selectedIndex; // get selection
if (pos == 0) { // force a selection
alert ("Make a shipping selection!");
return false;
}
</script>

And then the form statement looked like this:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="iced.target='paypal';
return SetShip (iced);">

How do I incorporate the "return SetShip" statement into the new NOP form statement?

Thanks guys! :roll:
fifthacedk
 
Posts: 8
Joined: Sat Jan 01, 2005 6:32 pm
Location: Nottingham

Postby Randy » Sun Jan 02, 2005 5:25 am

You could stick it in the AddToCart function in nopcart.js.

I would think the PRODUCTSELECTOR mod would be better for this type of selection, or you could use the dropdown menu for shipping in the managecart table...search the web for posts on these subjects.

The latter would allow the customer to select a number of items and then the shipping method, rather than being able to select a different method with each product ordered.

Randy
Randy
Guru
 
Posts: 1511
Joined: Tue Apr 22, 2003 12:21 pm
Location: Thunder Bay, Ontario

Postby fifthacedk » Sun Jan 02, 2005 2:20 pm

Thanks Randy, did a bit more work (searched through forums like I should have done in the first place!) and found a decent bit of code!
fifthacedk
 
Posts: 8
Joined: Sat Jan 01, 2005 6:32 pm
Location: Nottingham


Return to Help: Formatting and Style

Who is online

Users browsing this forum: No registered users and 0 guests