You are here

function uc_product_cart_display in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_product/uc_product.module \uc_product_cart_display()

Implementation of Übercart hook_cart_display().

1 call to uc_product_cart_display()
uc_product_kit_cart_display in uc_product_kit/uc_product_kit.module
Implementation of Ubercart's hook_cart_display().

File

uc_product/uc_product.module, line 1461
The product module for Ubercart.

Code

function uc_product_cart_display($item) {
  $node = node_load($item->nid);
  $element = array();
  $element['nid'] = array(
    '#type' => 'value',
    '#value' => $node->nid,
  );
  $element['module'] = array(
    '#type' => 'value',
    '#value' => 'uc_product',
  );
  $element['remove'] = array(
    '#type' => 'checkbox',
  );
  $element['options'] = '';
  if (module_exists('uc_attribute') && is_array($item->options)) {
    foreach ($item->options as $option) {
      $op_names[] = t('@attribute: @option', array(
        '@attribute' => $option['attribute'],
        '@option' => $option['name'],
      ));
    }
    $element['options'] = array(
      '#value' => theme('item_list', $op_names, NULL, 'ul', array(
        'class' => 'cart-options',
      )),
    );
  }
  $element['title'] = array(
    '#value' => node_access('view', $node) ? l($item->title, 'node/' . $node->nid) : check_plain($item->title),
  );
  $element['#total'] = $item->price * $item->qty;
  $element['data'] = array(
    '#type' => 'hidden',
    '#value' => serialize($item->data),
  );
  $element['qty'] = array(
    '#type' => 'textfield',
    '#default_value' => $item->qty,
    '#size' => 5,
    '#maxlength' => 6,
  );
  return $element;
}