function uc_cart_view_table in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_cart/uc_cart.module \uc_cart_view_table()
- 7.3 uc_cart/uc_cart.module \uc_cart_view_table()
2 string references to 'uc_cart_view_table'
- theme_uc_cart_view_form in uc_cart/
uc_cart.module - uc_cart_table_settings in uc_cart/
uc_cart.module - Implementation of hook_table_settings().
File
- uc_cart/
uc_cart.module, line 1260
Code
function uc_cart_view_table($op, &$form) {
switch ($op) {
case 'fields':
$fields[] = array(
'name' => 'remove',
'title' => t('Remove'),
'weight' => 0,
'enabled' => TRUE,
'locked' => TRUE,
);
$fields[] = array(
'name' => 'image',
'title' => t('Products'),
'weight' => 1,
'enabled' => TRUE,
);
$fields[] = array(
'name' => 'desc',
'title' => '',
'weight' => 2,
'enabled' => TRUE,
);
$fields[] = array(
'name' => 'qty',
'title' => t('Qty.'),
'weight' => 3,
'enabled' => TRUE,
);
$fields[] = array(
'name' => 'total',
'title' => t('Total'),
'weight' => 4,
'enabled' => TRUE,
);
return $fields;
case 'data':
foreach (element_children($form['items']) as $i) {
$nid = $form['items'][$i]['nid']['#value'];
$subtotal += $form['items'][$i]['#total'];
$desc = drupal_render($form['items'][$i]['title']) . '<br />';
$desc .= drupal_render($form['items'][$i]['options']);
$data['remove'][] = array(
'data' => drupal_render($form['items'][$i]['remove']),
'align' => 'center',
'class' => 'remove',
);
$data['image'][] = array(
'data' => drupal_render($form['items'][$i]['image']),
'class' => 'image',
);
$data['desc'][] = array(
'data' => $desc,
'width' => '100%',
'class' => 'desc',
);
$data['qty'][] = array(
'data' => $form['items'][$i]['qty'] ? drupal_render($form['items'][$i]['qty']) : '',
'class' => 'qty',
);
$data['total'][] = array(
'data' => uc_currency_format($form['items'][$i]['#total']),
'nowrap' => 'nowrap',
'class' => 'price',
);
$data['#attributes'][] = array(
'valign' => 'top',
);
}
$data['#footer'] = array(
array(
'data' => '<strong>' . t('Subtotal:') . '</strong> ' . uc_currency_format($subtotal),
'colspan' => 5,
'align' => 'right',
'nowrap' => 'nowrap',
'class' => 'subtotal',
),
);
return $data;
case 'attributes':
$attributes = array(
'width' => '100%',
);
return $attributes;
}
}