tutorials:zencartmods:coupon.html
|
|
|
|
— |
tutorials:zencartmods:coupon.html [2016/01/28 18:05] (current) |
| | ====== Improving Coupon Reports ====== |
| | Want to know how much was 'saved' by your customers by using a discount coupon? Here is a mod for v1.38 that will add it in the Admin coupon report. Enjoy :) |
| |
| | in **admin/coupon_admin.php** change lines 455+ to the following, adding the two statements marked "START MOD" and "END MOD" |
| | |
| | <code php> |
| | <?php |
| | $heading = array(); |
| | $contents = array(); |
| | $coupon_desc = $db->Execute("select coupon_name |
| | from " . TABLE_COUPONS_DESCRIPTION . " |
| | where coupon_id = '" . $_GET['cid'] . "' |
| | and language_id = '" . $_SESSION['languages_id'] . "'"); |
| | $count_customers = $db->Execute("select * from " . TABLE_COUPON_REDEEM_TRACK . " |
| | where coupon_id = '" . $_GET['cid'] . "' |
| | and customer_id = '" . $cInfo->customer_id . "'"); |
| | // START MOD |
| | $coupon_saved = $db->Execute("SELECT sum(value) as saved FROM " . TABLE_COUPON_REDEEM_TRACK . ", " . TABLE_ORDERS_TOTAL . " WHERE coupon_id = " . $_GET['cid'] . " AND orders_id = order_id AND class = 'ot_coupon'"); |
| | // END MOD |
| | $heading[] = array('text' => '<b>[' . $_GET['cid'] . ']' . COUPON_NAME . ' ' . $coupon_desc->fields['coupon_name'] . '</b>'); |
| | $contents[] = array('text' => '<b>' . TEXT_REDEMPTIONS . '</b>'); |
| | // $contents[] = array('text' => TEXT_REDEMPTIONS_TOTAL . '=' . $cc_list->RecordCount()); |
| | $contents[] = array('text' => TEXT_REDEMPTIONS_TOTAL . '=' . $cc_query_numrows); |
| | $contents[] = array('text' => TEXT_REDEMPTIONS_CUSTOMER . '=' . $count_customers->RecordCount()); |
| | // START MOD |
| | $contents[] = array('text' => TEXT_REDEMPTIONS_SAVED . '=' . $coupon_saved->fields['saved']); |
| | // END MOD |
| | $contents[] = array('text' => ''); |
| | ?> |
| | </code> |
/home/ladyada/public_html/wiki/data/pages/tutorials/zencartmods/coupon.html.txt · Last modified: 2016/01/28 18:05 (external edit)