Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 1 of 1

Thread: Tiered Coupon

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default Tiered Coupon

    I am looking to add a tiered coupon to our website (i.e. $5 off $25+, $10 off $50+...). I have added a field to the coupon table that is "CouponTiered". This is a 1 or 0 field. In coupons.cs I added the following:
    public class CouponObject
    Code:
    internal bool m_coupontiered = false;
    public List<CouponObject> InitCoupon
    Code:
    co.m_coupontiered = DB.RSFieldBool(rs, "CouponTiered");
    Code:
            public bool CouponTiered
            {
                get { return m_coupontiered; }
            }
    public static CouponObject GetCoupon()
    Code:
    co.m_coupontiered = DB.RSFieldBool(rscoup, "CouponTiered");
    public static String CheckIfCouponIsValidForOrder()
    Code:
    if (status == AppLogic.ro_OK)
                    {
                        if (co.m_coupontiered && st < 25)
                        {
                            status = String.Format(AppLogic.GetString("shoppingcart.cs.73", ThisCustomer.SkinID, ThisCustomer.LocaleSetting), ThisCustomer.CurrencyString(25));
                        }
                        // If we get here, we need to change the discount amount to match the tiered pricing
                        else
                        {
                            if (co.m_coupontiered && st >= 25)
                            {
                                if (st >= 25 && st < 50) // $5 off $25+
                                {
                                    co.m_discountamount = 5;
                                    co.m_description = "$5 off $25+";
                                }
                                else if (st >= 50 && st < 100) // $10 off $50+
                                {
                                    co.m_discountamount = 10;
                                    co.m_description = "$10 off $50+";
                                }
                                else if (st >= 100) // $20 off $100+
                                {
                                    co.m_discountamount = 20;
                                    co.m_description = "$20 off $100+";
                                }
                            }
                        }
                    }
    With this code, I can type the coupon code in on shoppingcart.aspx and click the update button to the right, and it will show the $X off $X+ but I have to push the update button again for it to reflect in the subtotal. Any ideas why this is or if there is a better way to do this?
    Last edited by chrismartz; 06-15-2011 at 12:25 PM.