You are here

function uc_cart_ca_predicate in Ubercart 6.2

Implements hook_ca_predicate().

File

uc_cart/uc_cart.ca.inc, line 57
This file contains the Conditional Actions hooks and functions necessary to make the cart related entity, conditions, events, and actions work.

Code

function uc_cart_ca_predicate() {
  $predicates = array();

  // Setup a default predicate for customer checkout notifications.
  $predicates['uc_checkout_customer_notification'] = array(
    '#title' => t('E-mail customer checkout notification'),
    '#description' => t('E-mail the customer an invoice from their recent order.'),
    '#class' => 'notification',
    '#status' => 1,
    '#trigger' => 'uc_checkout_complete',
    '#actions' => array(
      array(
        '#name' => 'uc_order_email_invoice',
        '#title' => t('Send an e-mail to the customer'),
        '#argument_map' => array(
          'order' => 'order',
        ),
        '#settings' => array(
          'from' => uc_store_email_from(),
          'addresses' => '[order-email-raw]',
          'subject' => t('Your Order at [store-name]'),
          'template' => 'customer',
          'view' => 'checkout-mail',
        ),
      ),
    ),
  );

  // Setup a default predicate for admin checkout notifications.
  $predicates['uc_checkout_admin_notification'] = array(
    '#title' => t('E-mail admin checkout notification'),
    '#description' => t('E-mail a short order summary to an administrator when a customer checks out.'),
    '#class' => 'notification',
    '#status' => 1,
    '#trigger' => 'uc_checkout_complete',
    '#actions' => array(
      array(
        '#name' => 'uc_order_email_invoice',
        '#title' => t('Send an e-mail to the administrator(s)'),
        '#argument_map' => array(
          'order' => 'order',
        ),
        '#settings' => array(
          'from' => uc_store_email_from(),
          'addresses' => uc_store_email(),
          'subject' => t('New Order at [store-name]'),
          'template' => 'admin',
          'view' => 'admin-mail',
        ),
      ),
    ),
  );
  return $predicates;
}