You are here

function uc_coupon_workflow_uc_coupon_revalidate in Ubercart Discount Coupons 7.2

Same name and namespace in other branches
  1. 7.3 uc_coupon_workflow/uc_coupon_workflow.module \uc_coupon_workflow_uc_coupon_revalidate()

Implements hook_uc_coupon_revalidate().

Parameters

$products: The list of products to valiate against (usually the current cart contents).

File

uc_coupon_workflow/uc_coupon_workflow.module, line 27
Discount coupon workflow.

Code

function uc_coupon_workflow_uc_coupon_revalidate($products) {
  if (isset($_SESSION['cart_order']) && ($order = uc_order_load($_SESSION['cart_order']))) {

    // If checkout is in progress, use the cart_order to provide additional information.
    $order = clone $order;
  }
  else {

    // Otherwise create an empty order
    $order = new UcOrder();
  }
  $order->products = $products;
  rules_invoke_event('uc_coupon_workflow_automatic', $order);
}