Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2007
    Location
    Sacramento, CA
    Posts
    64
    Plugin Contributions
    1

    Default Trying to add coupon code to packing slip

    I'm trying to add the coupon code that the customer used to the packing slip of the order they create.

    The SQL code I'm using is

    SELECT coupon_code FROM zen_coupons,zen_coupon_redeem_track WHERE zen_coupons.coupon_id = zen_coupon_redeem_track.coupon_id AND zen_coupon_redeem_track.order_id =whatevertheordernumberis;

    Translated into ZenCart PHP, it turns into

    <?php
    $order_coupon_slip = $db->Execute("SELECT coupon_code FROM " . TABLE_COUPONS . "," . TABLE_COUPON_REDEEM_TRACK . " WHERE " . TABLE_COUPONS . ".coupon_id = " . TABLE_COUPON_REDEEM_TRACK . ".coupon_id AND " . TABLE_COUPON_REDEEM_TRACK . ".order_id = '" . (int)$oID . "'");
    ?>


    inserted into super_packingslip.php. (Me using Super Orders shouldn't matter.)

    I'm attempting to call $order_coupon_slip within super_packingslip.php using either

    <?php echo $order_coupon_slip->customer['coupon_code']; ?>


    or

    <?php echo $order_coupon_slip; ?>

    I'm pretty sure I have the SQL query correct: however, what would be the best way to call the function? Currently just calling the variable results in "Object" appearing on the output page, while calling the longer function doesn't display anything. The ZenCart Developer's Wiki didn't help much, unfortunately.

    I'm using Zen Cart 1.3.7 with Apache 1.3, MySQL 3.23, PHP 4.4.6 and Slackware 10.

    Thanks for your help.

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

    Default Re: Trying to add coupon code to packing slip

    Perhaps pulling the coupon_code field from the orders table might be easier?
    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: v1.5.5]
    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!

  3. #3
    Join Date
    Feb 2007
    Location
    Sacramento, CA
    Posts
    64
    Plugin Contributions
    1

    Default Re: Trying to add coupon code to packing slip

    Hm...

    yeah, calling zen_orders.coupon_code is simpler. :-) I guess when there's 57 columns in a table, it's easy to miss an important one.

    I'm still getting the same result though: when I call the variable I have the SQL query stored as, I'm getting "Object" displaying on the page where the coupon code should be.

    My new code (thanks Ajeh!):

    <?php
    $order_coupon_slip = $db->Execute("SELECT coupon_code FROM " . TABLE_ORDERS . " WHERE orders_id = '" . (int)$oID . "'");
    ?>

    and it's called by

    <?php echo $order_coupon_slip; ?>

    Any ideas?

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

    Default Re: Trying to add coupon code to packing slip

    Try to call it with:
    PHP Code:
    $order_coupon_slip->fields['coupon_code'
    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: v1.5.5]
    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!

  5. #5
    Join Date
    Feb 2007
    Location
    Sacramento, CA
    Posts
    64
    Plugin Contributions
    1

    Default Re: Trying to add coupon code to packing slip

    Thanks for the help, Ajeh.

    Unfortunately, however,

    <?php echo $order_coupon_slip->fields['coupon_code']; ?> isn't working. "Object" isn't being returned: there's just nothing appearing.

  6. #6
    Join Date
    Feb 2007
    Location
    Sacramento, CA
    Posts
    64
    Plugin Contributions
    1

    Default Re: Trying to add coupon code to packing slip

    Alright, I figured it out: there just wasn't a coupon code associated with the particular orders I was looking at. When I viewed the packing slip of an order that I knew had a coupon code with it, it worked fine.

    Thanks Ajeh. :-)

    To everyone else: this thread

    http://www.zen-cart.com/forum/showth...t=37905&page=1

    Deals with basically the same thing, and it helped me some too.

 

 

Similar Threads

  1. v154 Trying to add help text in Coupon code field
    By strelitzia in forum General Questions
    Replies: 4
    Last Post: 20 Jan 2016, 05:45 AM
  2. Add shipping method to packing slip ?
    By NullMind in forum Managing Customers and Orders
    Replies: 9
    Last Post: 2 Jun 2011, 03:38 AM
  3. Add Shipping Method to Packing Slip
    By sarahwhg in forum Managing Customers and Orders
    Replies: 6
    Last Post: 3 Oct 2010, 12:36 AM
  4. How to add image in packing slip?
    By teflonchest in forum Managing Customers and Orders
    Replies: 1
    Last Post: 3 May 2010, 04:09 PM
  5. Add a Universal Message to Packing Slip
    By paperthreads in forum Managing Customers and Orders
    Replies: 8
    Last Post: 2 Apr 2010, 03:48 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR