QuoteError vmError: KlarnaCheckout getTaxShipment: expecting math operation to be +% but is
...but is - what do the cart think it is, it doesn't tell?
Anyhow, surely it is set to be +% so this seems to be a double bug?
The file and function: http://dev.virtuemart.net/projects/virtuemart/repository/entry/trunk/virtuemart/plugins/vmpayment/klarnacheckout/klarnacheckout.php#L247
function getTaxShipment($shipment_calc_id) {
// TO DO add shipmentTaxRate in the cart
// assuming there is only one rule +%
$db = JFactory::getDBO();
$q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $shipment_calc_id . '" ';
$db->setQuery($q);
$taxrule = $db->loadObject();
if ($taxrule->calc_value_mathop != "+%") {
VmError('KlarnaCheckout getTaxShipment: expecting math operation to be +% but is ' . $taxrule->calc_value_mathop);
}
return $taxrule->calc_value * 100;
}
Btw! Have seen this on several sites during the last year or so, as a customer/visitor, and now also at a clients site. So it seems quite common...
I have never used klarna but it appears the query SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $shipment_calc_id . '"
is returning nothing - is a shipping tax rule set?
have you checked in the db table #__virtuemart_calcs or echo'd out what the $shipment_calc_id is?
Sure
Quote from: rued on March 16, 2015, 13:41:31 PM
...surely it is set to be +% so...
Seems like $shipment_calc_id isn't defined anywhere in the system, wonder if it should be $cart->cartPrices['shipment_calc_id'] instead...
it is called by
$items[$i]['tax_rate'] = $this->getTaxShipment($cart->cartPrices['shipment_calc_id']);
$this->debugLog($cart->cartPrices['salesPriceShipment'], 'getCartItems Shipment', 'debug');
it is also written to the debug log - switch on debugging and see if it is set
but I guess if no tax rate is chosen for the shipment it will be empty.. or 0
OK, but please don't guess... It's set to a +% rule, as stated twice before. ;)
Anyhow it shouldn't throw an error even when shipping modules are set to 'Apply default rules' or 'Apply no rule', some needs to use those too.
'echo $shipment_calc_id;' outputs 'Array' when a +% rule is chosen, '0' if 'Apply default rules' is chosen - both is surely wrong.
Some sleep needed now... good night.
I can only guess because you don't supply any feedback that I asked you for......
Quotehave you checked in the db table #__virtuemart_calcs or echo'd out what the $shipment_calc_id is?
Quoteit is also written to the debug log - switch on debugging and see if it is set
Well ... from the first posting and the later repeat it gives the answer by itself. And since you have stated in your first post already that you have no clue about this module, I didn't feel for writing a lot extra about this for you. You where guessing about something stated several times, thus I mentioned it, it's sett to a +% rule... but that doesn't matter. The error output is wrong and bad for the stores anyway. :)
The problem is that 'shipment_calc_id' isn't defined.
Filling in the correct tax id directly in the query works as a workaround.
T.ex.:
Quote$q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`=5 ';
QuoteAnd since you have stated in your first post already that you have no clue about this module, I didn't feel for writing a lot extra about this for you.
Nice attitude... will remember when you next ask for help :) - and you didn't answer..
I asked what was the value of $cart->cartPrices['salesPriceShipment'] in the plugin at that point of the code actually echo'd out - not what you had set it in the admin - std troubleshooting