uShop English (U.S.) for 179!

uStorekeeper English (U.S.) for 149!

 Products
       uTest
       uReserve
       uShop
       uStorekeeper
       uGolf
       uDirectory
       uSignIn
 Tech Support
       Support Policy
       Knowledge Base
            uTest
            uReserve
            uShop
            uStorekeeper
            uGolf
            uDirectory
            uSignIn
       Documentation
       Reference Sites
 Legal
       Software Piracy
       Legal Notices
       Privacy Policy
       Licensing
 Miscellaneous
       Reseller Info
       Contact Us
       Site Map
Prevent An Order If Cart Is Empty

Knowledge Base Lobby : uShop Support Conference : Applets are not being displayed
Oct-22-17 05:54 AM EST
Original Message
Prevent An Order If Cart Is Empty
Author Ron on 12-14-2002 at 21:28 (EST)
Is there any way I can prevent a customer from continuing with the order process if there are no items in the shopping cart?

Sometimes (and I know that we're dealing with humans here) customers continue through with an order with nothing in their cart and end up completing an order with only the fixed shipping charges being charged to their credit cards.

What, if anything, can be done?
E-MAIL AUTHOR | TABLE OF CONTENTS

Table Of Contents
  RE: Prevent An Order If Cart Is Empty Bill Weiner, 2002-12-16 05:22:01 (1)
            Works great, thanks! But... Ron, 2002-12-16 12:18:32 (2)
                 RE: Works great, thanks! But... Bill Weiner, 2002-12-17 06:35:11 (3)
                      That did it! Ron, 2002-12-17 23:49:19 (4)
  Cart Empty or Order Under minimum Ron Harter, 2003-05-29 09:41:16 (5)

Messages In This Discussion
         1. RE: Prevent An Order If Cart Is Empty
        Author Bill Weiner on 12-16-2002 at 05:22 (EST)
Here are some steps that could be used to make sure the customer has at least one item in the shopping cart before checking out:

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 < 1)
{
alert("Your shopping cart is empty. Please be sure to add your items to the shopping cart before beginning the checkout process.");
}
}
< /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
TABLE OF CONTENTS
                 2. Works great, thanks! But...
                Author Ron on 12-16-2002 at 12:18 (EST)
Thanks for the fix! Works great! However, one more question...

Is it possible to use this same code and have the customer's browser be re-directed to another page ONLY IF the alert window pops up?

We're at www.laila.com
TABLE OF CONTENTS
                         3. RE: Works great, thanks! But...
                        Author Bill Weiner on 12-17-2002 at 06:35 (EST)
Glad that worked for you. In regard to re-directing the customer to another page after the alert window pops up, you can do that by adding the following line after the alert() statement in the JavaScript:

window.location = "http://www.yourdomain.com";

(Where "http://www.yourdomain.com" is actually the URL of the page that you want to display).

So the whole checkQuantity() function would now look like this:

< SCRIPT LANGUAGE="Javascript" >
function checkQuantity()
{
var itemCount = document.uShopJSI.getTotalQuantity();
if (itemCount < 1)
{
alert("Your shopping cart is empty. Please be sure to add your items to the shopping cart before beginning the checkout process.");
window.location = "http://www.yourdomain.com";
}
}
< /SCRIPT >
TABLE OF CONTENTS
                                 4. That did it!
                                Author Ron on 12-17-2002 at 23:49 (EST)
Very cool. Works great. Looking forward to version 4.0 and even more spine-tingling improvements!
TABLE OF CONTENTS
         5. Cart Empty or Order Under minimum
        Author Ron Harter on 05-29-2003 at 09:41 (EST)
Thanks for this it helped me also. I used it a little differently. We have a $25.00 minimum so if the cart is under $25.00 the popup tells them they have not met it and sends them to a page where they can enter an additional handling fee or continue shopping for additional items.

Ron Harter
TABLE OF CONTENTS

© 2003 Microburst Technologies, Inc.