Applying Discounts to a Product Subset by Price Thresholdh

General ShopSite user discussion

Applying Discounts to a Product Subset by Price Thresholdh

Postby OldSalt » Tue Mar 11, 2014 11:27 am

Hello,

We are trying to find a way to apply a 20% discount to only certain products if the ss_total_price[i] exceeds $250.

I tried to make this work by creating extra product fields:
Extra Product Field 1: Threshold (250)
Extra Product Field 2: Discount (20)

and the following script placed below the CheckIt function in the shopping cart:
Code: Select all
<script type="text/javascript">

    ss_subtotal = 0;
    var discountPercentage = 0;
    var discount = 0;
    var discountFlag = 0;

    for (var i = 0; i < ss_name.length; i++)
    {
        if (ss_field1[i] != '' && ss_field2[i] != '')
        {
            if (parseFloat(ss_field1[i]).toFixed(2) <= parseFloat(ss_total_price[i]).toFixed(2))
//            if (ss_field1[i] <= ss_total_price[i])
            {
                discountPercentage = ss_field2[i] / 100;
                discount = ss_total_price[i] * discountPercentage;
                ss_total_price[i] = ss_total_price[i] - discount;
                ss_total_price[i] = Math.round((ss_total_price[i]+ 0.00001) * 100) / 100;
                ss_total_price[i] = ss_total_price[i].toFixed(2);
                discountFlag = discountFlag + 1;
            }
        }
       
        ss_subtotal = ss_subtotal + ss_total_price[i];
    }
    ss_subtotal = parseFloat(ss_subtotal).toFixed(2);
</script>


This appears to work for the first item, but all the other potentially qualifying items get discounted without exceeding the $250 threshold and the ss_subtotal remains stuck at the first ss_total_price[0]. Non-qualifying items appear to be processed correctly, but are not reflected in ss_subtotal.

Can this be done via coupons?

Thanks!
OldSalt
 
Posts: 23
Joined: Mon Sep 28, 2009 4:37 pm
Location: MA

Re: Applying Discounts to a Product Subset by Price Threshol

Postby ShopSite Lauren » Tue Mar 11, 2014 12:55 pm

Yes it can be done with coupons. Go to Merchandising > Coupons > Add A Coupon, select the products that can be discounted, and make sure you specify that more than 1 product can get the discount. Then make sure you also set the cart minimum value.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Applying Discounts to a Product Subset by Price Threshol

Postby OldSalt » Tue Mar 11, 2014 1:16 pm

This discount is not based on the cart minimum value, it is based on the product minimum value.

Can I set the coupon in Merchandising > Coupons > Add A Coupon based on the product minimum value?

Thanks!
OldSalt
 
Posts: 23
Joined: Mon Sep 28, 2009 4:37 pm
Location: MA

Re: Applying Discounts to a Product Subset by Price Threshol

Postby Jim » Tue Mar 11, 2014 3:11 pm

No the coupon discount would be based on the cart total not the total of the discountable products.

Are the products similar in price? You might be able to use the Quantity Group pricing feature. It isn't based on a percentage discount but on a specific price when a certain number of products are purchased. See a description at http://shopsite.com/help/12.0/en-US/sc/pro/groups.html. You configure this on each product by setting the price for certain quantity of the products. You can assign multiple products to a group so that the items can be combined to meet the quantity value and then they will be given the discounted price. This would work best for products of similar price so you could get close to the same price based on the number of each type of products purchased.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 119 guests