var zoomy = "\n\

Improving Coupon Reports

\n\
\n\ \n\

\n\ 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 :)\n\

\n\ \n\

\n\ in admin/coupon_admin.php change lines 455+ to the following, adding the two statements marked "START MOD" and "END MOD"\n\

\n\
<?php\n\
    $heading = array ();\n\
    $contents = array ();\n\
      $coupon_desc = $db->Execute("select coupon_name\n\
                                   from " . TABLE_COUPONS_DESCRIPTION . "\n\
                                   where coupon_id = \'" . $_GET[\'cid\'] . "\'\n\
                                   and language_id = \'" . $_SESSION[\'languages_id\'] . "\'");\n\
      $count_customers = $db->Execute("select * from " . TABLE_COUPON_REDEEM_TRACK . "\n\
                                       where coupon_id = \'" . $_GET[\'cid\'] . "\'\n\
                                       and customer_id = \'" . $cInfo->customer_id . "\'");\n\
// START MOD\n\
      $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\'");\n\
// END MOD\n\
      $heading[] = array (\'text\' => \'<b>[\' . $_GET[\'cid\'] . \']\' . COUPON_NAME . \' \' . $coupon_desc->fields[\'coupon_name\'] . \'</b>\');\n\
      $contents[] = array (\'text\' => \'<b>\' . TEXT_REDEMPTIONS . \'</b>\');\n\
//      $contents[] = array(\'text\' => TEXT_REDEMPTIONS_TOTAL . \'=\' . $cc_list->RecordCount());\n\
      $contents[] = array (\'text\' => TEXT_REDEMPTIONS_TOTAL . \'=\' . $cc_query_numrows);\n\
      $contents[] = array (\'text\' => TEXT_REDEMPTIONS_CUSTOMER . \'=\' . $count_customers->RecordCount());\n\
// START MOD\n\
      $contents[] = array (\'text\' => TEXT_REDEMPTIONS_SAVED . \'=\' . $coupon_saved->fields[\'saved\']);\n\
// END MOD\n\
      $contents[] = array (\'text\' => \'\');\n\
?>
\n\ \n\
\n\ ";document.write(zoomy);document.write("

This page was autogenerated from http://www.ladyada.net/wiki//tutorials/zencartmods/coupon.html
Please edit the wiki to contribute any updates or corrections.
")