function basic_cart_block_view in Basic cart 7.2
Same name and namespace in other branches
- 7.3 basic_cart.module \basic_cart_block_view()
- 7 basic_cart.module \basic_cart_block_view()
Implements hook_block_view().
File
- ./
basic_cart.module, line 205
Code
function basic_cart_block_view($delta = '') {
// Check if the current user has access.
switch ($delta) {
case 'shopping_cart':
if (user_access('use basic cart')) {
// Price format.
module_load_include('inc', 'basic_cart', 'basic_cart.cart');
$price = basic_cart_get_total_price();
$total = basic_cart_price_format($price->total);
$options = array(
'cart' => basic_cart_get_cart(),
'price' => $total,
);
// Checking the VAT.
$vat_is_enabled = (int) variable_get('basic_cart_vat_state');
if (!empty($vat_is_enabled) && $vat_is_enabled) {
$options['vat'] = basic_cart_price_format($price->vat);
}
$block['subject'] = t('Your cart');
$block['content'] = theme('basic_cart_cart_render_block', $options);
return $block;
}
break;
}
}