You are here

function uc_coupon_workflow_apply_options in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 uc_coupon_workflow/uc_coupon_workflow.rules.inc \uc_coupon_workflow_apply_options()

Generate list of coupon options for auto apply action.

1 string reference to 'uc_coupon_workflow_apply_options'
uc_coupon_workflow_rules_action_info in uc_coupon_workflow/uc_coupon_workflow.rules.inc
Implements hook_rules_action_info().

File

uc_coupon_workflow/uc_coupon_workflow.rules.inc, line 306
Rules integration for uc_coupon_workflow

Code

function uc_coupon_workflow_apply_options() {

  // Only non-bulk coupons may be applied automatically to avoid ambiguity regarding which code to apply.
  $rows = db_query('SELECT cid, name, code FROM {uc_coupons} WHERE status = :status AND bulk = :bulk', array(
    ':status' => 1,
    ':bulk' => 0,
  ));
  $ops = array();
  foreach ($rows as $row) {
    $ops[$row->cid] = t("@name (Code: @code)", array(
      '@name' => $row->name,
      '@code' => $row->code,
    ));
  }
  return $ops;
}