function op_products_customer_table in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.order_pane.inc \op_products_customer_table()
2 string references to 'op_products_customer_table'
- uc_order_pane_products in uc_order/
uc_order_order_pane.inc - Handle the "Products" order pane.
- uc_order_table_settings in uc_order/
uc_order.module - Implementation of hook_table_settings().
File
- uc_order/
uc_order_order_pane.inc, line 713 - This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.
Code
function op_products_customer_table($op, $products) {
switch ($op) {
case 'fields':
$fields[] = array(
'name' => 'qty',
'title' => t('Qty'),
'weight' => 0,
'enabled' => TRUE,
'attributes' => array(
'class' => 'text-right',
),
);
$fields[] = array(
'name' => 'product',
'title' => t('Product'),
'weight' => 1,
'enabled' => TRUE,
'attributes' => array(
'width' => '80%',
),
);
$fields[] = array(
'name' => 'model',
'title' => t('Model'),
'weight' => 2,
'enabled' => TRUE,
'attributes' => array(
'class' => 'text-center',
'nowrap' => 'nowrap',
),
);
$fields[] = array(
'name' => 'cost',
'title' => t('Cost'),
'weight' => 3,
'enabled' => FALSE,
'attributes' => array(
'class' => 'text-right',
),
);
$fields[] = array(
'name' => 'price',
'title' => t('Price'),
'weight' => 4,
'enabled' => TRUE,
'attributes' => array(
'class' => 'text-right',
),
);
$fields[] = array(
'name' => 'total',
'title' => t('Total'),
'weight' => 5,
'enabled' => TRUE,
'attributes' => array(
'class' => 'text-right',
),
);
return $fields;
case 'data':
if (is_array($products)) {
foreach ($products as $product) {
$data['qty'][] = array(
'data' => $product->qty . 'x',
'align' => 'right',
);
$options = $product->data['attributes'];
$option_rows = array();
if (is_array($options)) {
foreach ($options as $attribute => $option) {
$option_rows[] = t('@attribute: @option', array(
'@attribute' => $attribute,
'@option' => $option,
));
}
}
$data['product'][] = check_plain($product->title) . theme('item_list', $option_rows, NULL, 'ul', array(
'class' => 'product-options',
));
$data['model'][] = array(
'data' => check_plain($product->model),
'align' => 'center',
'nowrap' => 'nowrap',
);
$data['cost'][] = array(
'data' => uc_currency_format($product->cost),
'align' => 'right',
'nowrap' => 'nowrap',
);
$data['price'][] = array(
'data' => uc_currency_format($product->price),
'align' => 'right',
'nowrap' => 'nowrap',
);
$data['total'][] = array(
'data' => uc_currency_format($product->qty * $product->price),
'align' => 'right',
'nowrap' => 'nowrap',
);
$data['#attributes'][] = array(
'valign' => 'top',
);
}
}
else {
$data['product'][] = array(
'data' => t('This order contains no products.'),
'colspan' => 10,
);
}
return $data;
case 'attributes':
$attributes = array(
'class' => 'order-pane-table',
);
return $attributes;
}
}