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.
Bookmarks