function uc_discounts_checkout_pane_content in Ubercart Discounts (Alternative) 6.2
1 string reference to 'uc_discounts_checkout_pane_content'
- uc_discounts_checkout_pane_alter in uc_discounts/
uc_discounts.module - Implementation of hook_checkout_pane_alter() Get discounted price to show up on checkout, & review
File
- uc_discounts/
uc_discounts.module, line 732
Code
function uc_discounts_checkout_pane_content($op) {
switch ($op) {
case 'view':
$contents['cart_review_table'] = array(
'#value' => theme('uc_discounts_cart_checkout_table'),
'#weight' => variable_get('uc_pane_cart_field_cart_weight', 2),
);
return array(
'contents' => $contents,
'next-button' => FALSE,
);
case 'review':
$discount_amount = uc_discounts_get_discount_amount_for_order($op);
$items = uc_cart_get_contents();
$output = '<table>';
$context = array(
'revision' => 'themed',
'type' => 'cart_item',
'subject' => array(),
);
$total = 0;
foreach ($items as $item) {
$total += $item->price * $item->qty;
$desc = check_plain($item->title) . uc_product_get_description($item);
$price_info = array(
'price' => $item->price,
'qty' => $item->qty,
);
$context['subject'] = array(
'cart' => $items,
'cart_item' => $item,
'node' => node_load($item->nid),
);
$output .= '<tr valign="top"><td>' . $item->qty . '×</td><td width="100%">' . $desc . '</td><td nowrap="nowrap">' . uc_price($price_info, $context) . '</td></tr>';
}
if ($discount_amount > 0) {
$final_price = $total - $discount_amount;
$output .= '<tr valign="top"><td colspan="2"><strong>' . t('Discount') . ': </strong></td><td nowrap="nowrap">' . uc_price($discount_amount, $context) . '</td></tr>';
$output .= '<tr valign="top"><td colspan="2"><strong>' . t('Total') . ': </strong></td><td nowrap="nowrap"><b>' . uc_price($final_price, $context) . '</b></td></tr>';
}
$output .= '</table>';
$review[] = $output;
return $review;
}
}