Index: uc_vat.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/uc_vat/uc_vat.module,v retrieving revision 1.53 diff -u -p -r1.53 uc_vat.module --- uc_vat.module 23 Oct 2010 23:31:07 -0000 1.53 +++ uc_vat.module 25 Oct 2010 13:21:23 -0000 @@ -644,6 +644,9 @@ function uc_vat_line_item_data_alter(&$i if (variable_get('uc_vat_hide_subtotal', FALSE)) { $item['callback'] = NULL; } + else { + $item['callback'] = 'uc_vat_line_item_subtotal'; + } break; case 'tax': @@ -670,6 +673,30 @@ function uc_vat_line_item_data_alter(&$i } /** + * Callback for "subtotal" line item. + */ +function uc_vat_line_item_subtotal($op, $arg1) { + switch ($op) { + case 'load': + $lines[] = array( + 'id' => 'subtotal', + 'title' => t('Subtotal'), + 'amount' => uc_order_get_total($arg1, TRUE), + ); + return $lines; + case 'cart-preview': + if (module_exists('uc_payment') && variable_get('uc_pane_payment_enabled', TRUE)) { + $subtotal = 0; + foreach ($arg1 as $item) { + $subtotal += $item->price * ($item->qty ? $item->qty : 1); + } + drupal_add_js("if (Drupal.jsEnabled) { \$(document).ready( function() { set_line_item('subtotal', '". t('Subtotal') ."', ". $subtotal .", ". -10 ."); } )};", 'inline'); + } + break; + } +} + +/** * Callback for "subtotal excluding VAT" line item. */ function uc_vat_line_item_tax_subtotal($op, $order) {