You are here

function uc_coupon_uc_cart_pane in Ubercart Discount Coupons 7.3

Same name and namespace in other branches
  1. 7.2 uc_coupon.module \uc_coupon_uc_cart_pane()

Implements hook_uc_cart_pane().

File

./uc_coupon.module, line 1163
Provides discount codes and gift certificates for Ubercart.

Code

function uc_coupon_uc_cart_pane($items) {
  drupal_add_css(drupal_get_path('module', 'uc_coupon') . '/uc_coupon.css');

  // The coupon entry cart pane.
  $body = drupal_get_form('uc_coupon_form', 'cart') + array(
    '#prefix' => '<div id="uc-cart-pane-coupon">',
    '#suffix' => '</div>',
  );
  $panes[] = array(
    'id' => 'coupon',
    'body' => $body,
    'title' => t('Coupon discount'),
    'desc' => t('Allows shoppers to use a coupon during checkout for order discounts.'),
    'weight' => 1,
    'enabled' => TRUE,
  );

  // The "Special Discounts" cart pane.
  $body = array();
  $discounts = _uc_coupon_options_list(uc_coupon_session_validate(), FALSE);
  if (!empty($discounts)) {
    $body = array(
      '#theme' => 'uc_coupon_automatic_discounts',
      '#prefix' => '<div id="uc-cart-pane-coupon-automatic">',
      '#title' => t('Special discounts'),
      '#suffix' => '</div>',
      'discounts' => array(
        '#theme' => 'item_list',
        '#items' => _uc_coupon_options_list(uc_coupon_session_validate(), FALSE),
        '#title' => t('Special discounts'),
      ),
    );
  }
  $panes[] = array(
    'id' => 'coupon_auto',
    'body' => $body,
    'title' => t('Special Discounts'),
    'desc' => t('Displays a list of automatic discounts.'),
    'weight' => 1,
    'enabled' => TRUE,
  );
  return $panes;
}