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

Original Message
"Discounts in v3.5"

Posted by Nancy Bohs [nbohs@altmoor.com] on at 11:04 AM
Is there any work-around for the uShopDiscount1 applet and Javascript Discount only working with percentage values?

OR

Is there any way to automatically apply coupons based on subtotal?

(I really miss the subtotal flat rate discount from version 2.)

Thanks!


Table of contents

Messages in this discussion
"RE: Discounts in v3.5"
Posted by Bill Weiner on at 04:49 AM
There are a couple ways to handle that... here's one:

Try utilizing the uShopJSI JavaScript function "setCouponNumber(String newValue)" to set the coupon number based on the "getSubtotal()" value.

That is:

STEP 1: Add the uShopJSI applet to the page where you want to set the coupon number.

STEP 2: Write a JavaScript like this that get's kicked off probably from the page's "onLoad" function:

function setCouponBasedOnSubtotal()
{
var subtotal = document.uShopJSI.getSubtotal();
if (subtotal >= 100)
{
document.uShopJSI.setCouponNumber("12345");
}
else if (subtotal >= 10)
{
document.uShopJSI.setCouponNumber("67890");
}
else
{
document.uShopJSI.setCouponNumber("12321");
}
}

Refer to the uShop Programmer's Guide for more information on using JavaScripts with uShop:

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

Also refer to the JavaScript Example in the Online Applet Reference:

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


"discount solution"
Posted by Nancy Bohs on at 01:19 PM
Thanks for the quick reply! This is exactly what I need. I had tried using setDiscountRate() but got hung up by the percentage thing.