You are here

function uc_coupon_codes_csv in Ubercart Discount Coupons 5

Same name and namespace in other branches
  1. 6 uc_coupon.admin.inc \uc_coupon_codes_csv()
  2. 7.3 uc_coupon.admin.inc \uc_coupon_codes_csv()
  3. 7.2 uc_coupon.admin.inc \uc_coupon_codes_csv()

Generate a list of bulk coupon codes.

1 string reference to 'uc_coupon_codes_csv'
uc_coupon_menu in ./uc_coupon.module
Implementation of hook_menu().

File

./uc_coupon.module, line 777
Provides discount coupons for Ubercart.

Code

function uc_coupon_codes_csv($cid) {
  $coupon = uc_coupon_load($cid);
  if (!$coupon->bulk) {
    drupal_not_found();
    return;
  }
  header('Content-Type: application/octet-stream');
  header('Content-Disposition: attachment; filename="' . $coupon->code . '.csv";');
  for ($id = 0; $id < $coupon->data['bulk_number']; $id++) {
    echo uc_coupon_get_bulk_code($coupon, $id) . "\n";
  }
  exit;
}