Is there a way to pass a coupon/discount code via the URL?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Los
Ensign (ENS)
Ensign (ENS)
Posts: 3
Joined: Tue May 10, 2005 11:13 am

Is there a way to pass a coupon/discount code via the URL?

Post by Los » Tue Jul 08, 2008 2:33 pm

If we do an email marketing campaign, instead of displaying the coupon code for people to retype, is there a way to place that coupon code as a string in the URL that AC7 can use?

Thanx,

Carlos

User avatar
nickc
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Thu Nov 29, 2007 3:48 pm

Re: Is there a way to pass a coupon/discount code via the URL?

Post by nickc » Tue Jul 08, 2008 3:34 pm

You'd have to code that, but it's easily do-able. Grab the value by assigning it to a session variable in Global.asax:

Code: Select all

    protected void Session_OnStart()
    {
        //SAVE THE REFERRER FOR USE BY THE ORDER MODULE
        if (Request.UrlReferrer != null) Session["SessionReferrerUrl"] = Request.UrlReferrer.ToString();

        // init any global behaviors found in the url or querystring
        Session["_GlobalAccess"] = (Request.QueryString["ga"] != null && Convert.ToInt32(Request.QueryString["ga"]) == 1) ? 1 : 0;
        Session["_ActiveVoucher"] = (Request.QueryString["v"] != null) ? Request.QueryString["v"] : "";
    }
We implement a generic persistable class that stores coupons and gift certificates passed in this way - if the user also signs in, the tokens are associated with their user id as well, with a nifty little control that lets them track basket balance and apply to a basket using a checkbox control:
coupon.png
couponbasket.png
loggedin.png

Post Reply