You are here

function uc_cart_view_table in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_cart/uc_cart.module \uc_cart_view_table()
  2. 6.2 uc_cart/uc_cart.module \uc_cart_view_table()

Lists the products in the cart in a TAPIr table.

1 string reference to 'uc_cart_view_table'
uc_cart_view_form in uc_cart/uc_cart.module
Displays the contents of the customer's cart.

File

uc_cart/uc_cart.module, line 763

Code

function uc_cart_view_table($table) {
  $table['#columns'] = array(
    'remove' => array(
      'cell' => t('Remove'),
      'weight' => 0,
    ),
    'image' => array(
      'cell' => t('Products'),
      'weight' => 1,
    ),
    'desc' => array(
      'cell' => '',
      'weight' => 2,
    ),
    'qty' => array(
      'cell' => theme('uc_qty_label'),
      'weight' => 3,
    ),
    'total' => array(
      'cell' => t('Total'),
      'weight' => 4,
    ),
  );
  $subtotal = 0;
  foreach (element_children($table) as $i) {
    $subtotal += $table[$i]['#total'];
    $table[$i]['remove']['#cell_attributes'] = array(
      'class' => array(
        'remove',
      ),
    );
    $table[$i]['image']['#cell_attributes'] = array(
      'class' => array(
        'image',
      ),
    );
    $table[$i]['desc']['#cell_attributes'] = array(
      'class' => array(
        'desc',
      ),
    );
    $table[$i]['qty']['#cell_attributes'] = array(
      'class' => array(
        'qty',
      ),
    );
    $table[$i]['total']['#cell_attributes'] = array(
      'class' => array(
        'price',
      ),
    );
  }
  $table[] = array(
    'total' => array(
      '#theme' => 'uc_price',
      '#prefix' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
      '#price' => $subtotal,
      '#cell_attributes' => array(
        'colspan' => 'full',
        'class' => array(
          'subtotal',
        ),
      ),
    ),
  );
  return $table;
}