function uc_coupon_purchase_ca_predicate in Ubercart Discount Coupons 6
Implementation of hook_ca_predicate().
File
- uc_coupon_purchase/
uc_coupon_purchase.ca.inc, line 6
Code
function uc_coupon_purchase_ca_predicate() {
$predicates = array();
$predicates['uc_coupon_purchase_single'] = array(
'#title' => t('Notify customer when a single coupon is purchased'),
'#description' => t('Notify the customer when they have successfully purchased a single coupon.'),
'#class' => 'notification',
'#trigger' => 'uc_coupon_purchase',
'#status' => 1,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_coupon_condition_is_bulk',
'#title' => t('If the coupon is not a bulk coupon.'),
'#argument_map' => array(
'coupon' => 'coupon',
),
'#settings' => array(
'negate' => TRUE,
),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_coupon_purchase_email',
'#title' => t('Send an e-mail to the customer'),
'#argument_map' => array(
'order' => 'order',
'coupon' => 'coupon',
),
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => '[order-email]',
'subject' => uc_get_message('uc_coupon_purchase_single_subject'),
'message' => uc_get_message('uc_coupon_purchase_single_message'),
'format' => 1,
),
),
),
);
$predicates['uc_coupon_purchase_bulk'] = array(
'#title' => t('Notify customer when a bulk coupon is purchased'),
'#description' => t('Notify the customer when they have successfully purchased a bulk coupon.'),
'#class' => 'notification',
'#trigger' => 'uc_coupon_purchase',
'#status' => 1,
'#conditions' => array(
'#operator' => 'AND',
'#conditions' => array(
array(
'#name' => 'uc_coupon_condition_is_bulk',
'#title' => t('If the coupon is a bulk coupon.'),
'#argument_map' => array(
'coupon' => 'coupon',
),
'#settings' => array(
'negate' => FALSE,
),
),
),
),
'#actions' => array(
array(
'#name' => 'uc_coupon_purchase_email',
'#title' => t('Send an e-mail to the customer'),
'#argument_map' => array(
'order' => 'order',
'coupon' => 'coupon',
),
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => '[order-email]',
'subject' => uc_get_message('uc_coupon_purchase_bulk_subject'),
'message' => uc_get_message('uc_coupon_purchase_bulk_message'),
'format' => 1,
),
),
),
);
return $predicates;
}