Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Redeeming coupon code from URL?

    This would all have to be customize ...

    Currently, the Referral Code, even if used as a Discount Coupon still would need to be added during the Checkout on the checkout_payment ...

    So you would need a link in an email to take the customer to the Login ...

    That link would need to include the Discount Coupon code that could then be used for the referral code to pre populate the field ...

    You could take it a step further that on the successful creation of an account that the Referral code is used to set the Discount Coupon ... but if there are any restrictions on the Discount Coupon it will fail as there is nothing in the shopping cart to validate the Discount Coupon ...

    The other way the Referral can be done is to use the first Discount Coupon that the customer uses in the checkout ... this would then only need one entry of the Discount Coupon, providing the Shopping Cart Products qualify for the Discount Coupon ...

    Another way to do all of this is to build in a check for the URL in the email where there is a code passed and that code is tested for being a valid Discount Coupon code ...

    If valid, then per-populate the Referral Code on the create account and set that as the current Discount Coupon coupon_id on the session variable:
    $_SESSION['cc_id']

    then when the customer gets to the Checkout and the checkout_payment if the Discount Coupon is not valid for the Order it would be removed ...

    This would take quite a bit of customization but it could be done ...

    Granted, this would only work if the customer immediately creates an account, unless you take it a step further and try to set the
    $_SESSION['cc_id']

    from the referral code on the URL and it stays active during the session and the customer would eventually create an account and use that ...

    However, if the customer's session times out, then the:
    $_SESSION['cc_id']

    would be lost and the customer would need to manually enter the Discount Coupon code during the create account and/or during the checkout_payment ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  2. #2

    Default Re: Redeeming coupon code from URL?

    Thank you for your answer and time!
    It sounds to complicated for me.
    My idea was to know if there is something already build in...
    will figure out his one in the future:-)
    Thanks again

  3. #3

    Default Re: Redeeming coupon code from URL?

    I added this (early on in me execution line):

    $sopDiscountCode = $_GET["sopCode"];
    //sopCode is what is in my url ***.php?sopCode=balance2011

    if (isset($_GET["sopCode"]))
    {
    if ($_GET["sopCode"]=='balance2011')
    {$_SESSION['sopdcode']=1; //1 is the code from the admin consol for that string
    $_SESSION['sopddesc']="*** 20% off Active<br />Care of Tom Turner"; //this is what shows on the website}
    if ($_GET["sopCode"]=='relief2011')
    {$_SESSION['sopdcode']=3;
    $_SESSION['sopddesc']="*** 20% off Active<br />care of Tom Slusser";}
    }

    if (isset($_SESSION['sopdcode']))
    {$sopDiscountCode= $_SESSION['sopdcode'];}

    //I then place at the top of: templates/[myTemplate]/templates/checkout_shipping_default.php:

    $_SESSION['cc_id']=$sopDiscountCode;

    //Which seems to do the trick, hack as it may be..

    //We are doing all this for QR Code discounts ##

    //hope this helps
    Last edited by noKnots; 2 Dec 2011 at 12:02 AM.

  4. #4
    Join Date
    Jul 2008
    Posts
    1
    Plugin Contributions
    0

    Default Re: Redeeming coupon code from URL?

    @NoKnots: This is exactly what I was looking for: adding value to the use of QR codes. (more than just redirecting to your site)

    however, I tried to implement your instructions, so far nothing really happens:

    What do you mean "(early on in me execution line)"
    In which file is that? the index.php or another?

    What's the output/use for "1 is the code from the admin consol for that string"

    Where does the text show "*** 20% off Active<br />care of Tom Slusser"

    Also: you should place the } before the // in ...Tom Turner"; //this is what shows on the website} This becomes
    Tom Turner";} //this is what shows on the website
    otherwise you get an error further on in the PHPcode.

    Thanks for clarifying a little more!
    Greetings,

    Erik, www.oranjedas.nl

  5. #5

    Default Re: Redeeming coupon code from URL?

    Disclaimer: I am sure I will get some of the technical aspects wrong, so take what I say with a grain of salt. I am not a zencart or php expert.

    Most of what I have seen in zencart and php for that matter is php running as a scripting platform (vs Object Oriented). eg. a page is called say index.php and then in for the most part code is executed in a straight line via includes and function calls. So yes index.php should work for this. In my case I have added my code to set context in html_header.php primarily because is it in the common directory and executes just prior to any content being sent to the client. Anyway it has worked for me this way. Also nice in that much of the zencart context has been set at that point.

    My code has changed from my last post now reads:

    //start html_header.php mod

    $sopDiscountCode = $_GET["sopCode"];

    if (isset($_GET["sopCode"]) and (strlen($_GET["sopCode"])>0))
    {
    if ($_GET["sopCode"]=='balance2011')
    {$_SESSION['sopdcode']=1;
    $_SESSION['cc_id']=1;
    $_SESSION['sopddesc']="*** 20% off Active<br />Care of Tom Turner";
    $sopDiscountCode=1;
    }
    if ($_GET["sopCode"]=='relief2011')
    {$_SESSION['sopdcode']=3;
    $_SESSION['cc_id']=3;
    $_SESSION['sopddesc']="*** 20% off Active<br />care of Tom Slusser";
    $sopDiscountCode=3;
    }
    }
    else
    {
    if (strlen($_SESSION['sopdcode'])>0)
    {$_SESSION['cc_id']=$_SESSION['sopdcode'];
    $sopDiscountCode= $_SESSION['sopdcode'];}
    }

    if((strlen($_SESSION['cc_id'])>0 )&& ($_SESSION['sopdcode']!=$_SESSION['cc_id']) )
    {if ($_SESSION['cc_id']==1)
    {$_SESSION['sopdcode']=1;
    $_SESSION['sopddesc']="*** 20% off Active<br />Care of Tom Turner";
    $sopDiscountCode=1;
    }
    if ($_SESSION['cc_id']==3)
    {$_SESSION['sopdcode']=3;
    $_SESSION['sopddesc']="*** 20% off Active<br />care of Tom Slusser";
    $sopDiscountCode= 3;
    }
    unset($_SESSION['sopdcode']);
    }

    //end html_header

    then in modules/order_total/ot_coupon.php

    I modified the beginning of the function collect_posts() as follows:

    //start function edit

    function collect_posts() {

    global $db, $currencies, $messageStack, $order;

    global $discount_coupon;

    // remove discount coupon by request

    if (isset($_POST['dc_redeem_code']) && strtoupper($_POST['dc_redeem_code']) == 'REMOVE') {

    unset($_POST['dc_redeem_code']);

    unset($_SESSION['cc_id']);

    //sop edit
    unset($_SESSION['sopdcode']);
    unset($_SESSION['sopddesc']);
    unset($sopDiscountCode);

    // end function edit - the rest of this function remains unchanged



    again this is definitely a hatchet job but for us it works. Hope this helps others.

    http://www.massageblocks.com
    Last edited by noKnots; 14 Dec 2011 at 09:07 PM.

  6. #6

    Default Re: Redeeming coupon code from URL?

    Hello guys,

    I know this post is old but I would like to tell you that I have uploaded the following plugin:
    Redeem Coupon from URL

 

 

Similar Threads

  1. Redeeming coupon code on shopping cart page!
    By zfw88788301 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 8 Feb 2011, 05:23 PM
  2. Embedding coupon code in URL?
    By thewolf in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 2
    Last Post: 13 Jun 2008, 09:58 PM
  3. Coupon code URL
    By HardNutrition in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 2
    Last Post: 8 May 2008, 12:11 PM
  4. Coupon Code in URL
    By kevinhankens in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 20
    Last Post: 6 Oct 2007, 07:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg