URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushp_general_purpose
Thread Number: 327
[ Go back to previous page ]

Original Message
"LIMIT number of products to max no?"

Posted by Gary Torello [gary@hometoyparty.com] on at 11:16 AM
Hi again!

I'm playing with the script for a second possible application.. It will be used to browse/search, and send in requests for "library materials".. ($0 price items that will then be shipped on loan to a membership base)

is there a way to limit the number of products in this scenario to a maximum of say 5?

THANKS!


Table of contents

Messages in this discussion
"RE: LIMIT number of products to max no?"
Posted by Bill Weiner on at 06:07 AM
Here are some steps that could be used to put a maximum limit check on your "Place Order" page:

STEP 1: On your "begin order process" page (or whatever page(s) that you have the "uShopOrderButton" applet on) ... try adding the following JavaScript function:

< SCRIPT LANGUAGE="Javascript" >
function checkQuantity()
{
var itemCount = document.uShopJSI.getTotalQuantity();
if (itemCount > 5)
{
alert("Limit 5 per customer.");
}
}
< /SCRIPT >

You can put that script pretty much anywhere on the page (it won't be visible).

STEP 2: Also on that page, modify the "BODY" line of the page to call the new JavaScript function via the "onLoad" action.

For example, if your "BODY" line of your HTML page is:

< BODY BGCOLOR="#FFFFFF" >

Then change it to:

< BODY BGCOLOR="#FFFFFF" onLoad="checkQuantity();" >

STEP 3: And finally, on that page, don't forget to add the special "uShopJSI" applet so that the JavaScript can interface with uShop. The uShopJSI applet can usually put at the very bottom of your page with the following HTML:

< APPLET CODE="uShopJSI.class" CODEBASE="../classes/" NAME="uShopJSI" WIDTH="2" HEIGHT="2" >
< /APPLET >


NOTE: If you have any questions about using the uShopJSI applet with uShop or with just interfacing JavaScript with uShop, please refer to the "JavaScript Examples" in the uShop Applet Reference:

http://www.uburst.com/uShop/applets.html

Or the uShop Programmer's Guide:

http://www.uburst.com/uShop/reference/programmers_guide.html