Index: administrator/components/com_virtuemart/plugins/vmpsplugin.php =================================================================== --- administrator/components/com_virtuemart/plugins/vmpsplugin.php (revision 7068) +++ administrator/components/com_virtuemart/plugins/vmpsplugin.php (working copy) @@ -959,12 +959,22 @@ $db->setQuery ($q); $taxrules = $db->loadAssocList (); } else { + //This construction makes trouble, if there are products with different vats in the cart //on the other side, it is very unlikely to have different vats in the cart and simultan it is not possible to use a fixed tax rule for the shipment + if (empty($cart_prices[$this->_psType . 'Value'])) + { + $cart_prices['salesPrice' . $_psType] = 0; + $cart_prices[$this->_psType . 'Tax'] = 0; + $cart_prices[$this->_psType . '_calc_id'] = 0; + return; + } if(!empty($calculator->_cartData['VatTax']) and count ($calculator->_cartData['VatTax']) == 1){ $taxrules = $calculator->_cartData['VatTax']; + //var_dump($taxrules); die(); foreach($taxrules as &$rule){ - $rule['subTotal'] = $cart_prices[$this->_psType . 'Value']; + $rule['subTotal'] += $cart_prices[$this->_psType . 'Value']; + break; } } else { @@ -975,6 +985,7 @@ } } + if (count ($taxrules) > 0) { $cart_prices['salesPrice' . $_psType] = $calculator->roundInternal ($calculator->executeCalculation ($taxrules, $cart_prices[$this->_psType . 'Value'],false,false), 'salesPrice');