Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    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

  2. #12

    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.

  3. #13
    Join Date
    Jan 2013
    Posts
    5
    Plugin Contributions
    0

    Default Coupon Code into URL

    Hello!
    After viewing the thread here: http://www.zen-cart.com/showthread.p...-code-from-URL

    I am having a bit of a problem
    I am trying to retrieve a coupon code from the URL .

    I entered in the index.php
    this code

    Code:
     
    // this is for http://localhost/?coupon=spring123
    
    $CouponCode = stripslashes($_GET["coupon"]);
     if ($CouponCode=='')	
     echo 'NO COUPON CODE';
    
     echo mysql_real_escape_string($CouponCode);
     
    ?>
    1. How do I exactly verify if the code is valid ?
    2. How to I enter the code in the box at the end of shipping ? Maybe I should include the coupon code in the session .... ?

    Thanks!

  4. #14

    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

 

 
Page 2 of 2 FirstFirst 12

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