Results 1 to 10 of 21

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    27
    Plugin Contributions
    0

    Default Coupon Code in URL

    Is there any way to attach the coupon code to a URL instead of having the customer enter the code upon checkout? We use codes to track advertising and it would be a lot easier if we could just embed those codes in the URL, then search orders by discount code.

    Please let me know if anyone knows of a way to accomplish this.

    Thanks!!

    Kevin

  2. #2
    Join Date
    May 2005
    Posts
    18
    Plugin Contributions
    0

    Default Re: Coupon Code in URL

    I just popped in here looking for the same thing! I have a programmer working on something similar. The plan is to use sessions to set the code, then input it into the cart during checkout.

    We will be using landing pages to capture the code, then on submit will send them to the main page.

    I'll let you know when he's got it situated.

    ;-) Amanda

  3. #3
    Join Date
    Feb 2005
    Posts
    27
    Plugin Contributions
    0

    Default Re: Coupon Code in URL

    Hey Amanda,

    That's awesome! I'm excited to hear how you guys approach it. I've been trying to figure out a way to add that feature without making it difficult to upgrade zencart when the time comes.

    It would also be nice to have a function that turns certain GET or POST vars into SESSION vars and then appends them to the order data. We use discount codes more for tracking advertising than actually offering discounts. It would be cool to look at an order and see the tracking/discount code as well as being able to track things like keywords from search engine ads.

    Anyway, definitely let me know if you figure out any good tricks!

    Thanks!

    Kevin

  4. #4
    Join Date
    Feb 2005
    Posts
    27
    Plugin Contributions
    0

    Default Re: Coupon Code in URL

    Hey again! Here is a possible, albeit ugly, solution. First, edit index.php and add something like:

    Code:
    if (!empty($_GET['visitor_code']))
        $_SESSION['visitor_code'] = trim(htmlspecialchars($_GET['visitor_code']));
    Then in includes/modules/order_total/ot_coupon.php

    Edit the line:

    Code:
    'field' => zen_draw_input_field('dc_redeem_code', '', 'id="disc-'.$this->code.'" onchange="submitFunction(0,0)"'),
    change the second value sent to the function so that it looks like this:

    Code:
    'field' => zen_draw_input_field('dc_redeem_code', $_SESSION['visitor_code'], 'id="disc-'.$this->code.'" onchange="submitFunction(0,0)"'),
    OK, I'm not much of a programmer, but if you go to yoursite.com/index.php?visitor_code=whatever it definitely puts 'whatever' in the discount coupon field during checkout :) Mostly, I just wanted to see if it was possible. The only problem with doing it this way is that it will make it difficult to do ZenCart upgrades. I'll keep working a more elegant solution.

    Kevin

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

    Default Re: Coupon Code in URL

    The email that customers recieve has the Discount Coupon code on it ...

    When they come to the site via the URL in the email ... it is automatically added when they login ...

    If you want to automate this on completion of signup ... you need to only add 1 line of code to the /includes/modules/create_account.php

    This will remain valid until the user logs out or the session times out ...

    If either should happen, they can then apply the code during checkout ...
    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!

  6. #6
    Join Date
    Feb 2005
    Posts
    27
    Plugin Contributions
    0

    Default Re: Coupon Code in URL

    Hey Linda! Thanks for the reply. I'm not quite sure that I understand though. Let me tell you what my goal is and if you get a minute, let me know if it will be easy to accomplish.

    For example, in our Google ads we would like to use a destination URL like "mysite.com/index.php?tracking_code=google&keyword=whatever"

    Then, when they checkout, I would like to put "google" into the discount code box and then append "whatever" to another piece of data, like order notes, before it goes into the database.

    So, basically, whether the customer is new or returning, I want to autofill the coupon code from the URL so that they don't have to think about what code to place in the box.

    I attempted to send myself a discount code from the admin panel, but the link in the email didn't contain the discount code - I would still have to enter it by hand.

    Let me know if the method that I proposed earlier seems salient, or if it could cause conflicts. Thanks again for your help!!

    Kevin

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

    Default Re: Coupon Code in URL

    What stops me from going to your site and just manually adding &tracking_code=google to get the discount?
    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!

 

 

Similar Threads

  1. Redeeming coupon code from URL?
    By Cindy2010 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 13
    Last Post: 2 Sep 2013, 03:58 AM
  2. how can I code in a default coupon code into checkout page redeem, then auto-refresh?
    By lankeeyankee in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 29 Nov 2008, 04:56 AM
  3. 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
  4. Coupon code URL
    By HardNutrition in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 2
    Last Post: 8 May 2008, 12:11 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