News:

Looking for documentation? Take a look on our wiki

Main Menu

Price with tax is wrong calculated in cart and cart module

Started by siristru, January 28, 2016, 15:21:40 PM

Previous topic - Next topic

siristru

I decided to use VM tax calculation.
So I've set two products with price:

66,67 PLN + 5% tax = circa 70 PLN



Now I added a discount coupon for 10% and added two products of equal price to cart.
Now... price display are different in module and in cart... also in cart price is wrong:



1. Sum of two products with the same price and tax value is wrong

70 PLN + 70 PLN = 140 PN

But VM calculate it like this:

66,67 PLN + 66,67 PLN = 134,34 PLN Net
134,34 PLN + 6,67 PLN which is tax from those two products = 140,01 PLN

Tax should be 3,33 PLN x 2 = 6,66 PLN

subtotal_tax_amount is fine but billTotal_tax_amount is wrong.

2. The same thing is done in cart module:



As you can see total tax amount is wrong.

3. Total cart module price is final cart price - after coupon discount and shipping cost. Why is that? Cart module should display PLAIN product cost calculation without additional discounts like coupon or shipping cost.

HOW this could be fixed?
Or I did something wrong?

I use VM 3.0.12
Joomla! 3.4.8

Yes, I use template override but result is the same for basic template as well - for both cart and cart module.
Само слога Славjанa спашава - Свуда пођи, својој кући дођи.

siristru

We have here two separated issues:

1. Price with tax calculation
2. And cart module total

As for 2 I found that in ROOT/administrator/components/com_virtuemart/helpers/calculationh.php line 899 we have:

$this->_cart->cartPrices['billTotal'] = $this->_cart->cartPrices['salesPriceShipment'] + $this->_cart->cartPrices['salesPricePayment'] + $this->_cart->cartPrices['withTax'] + $this->_cart->cartPrices['salesPriceCoupon'];

This is fine for CART PAGE that should sum all things up... but not for cart module where customer should see only simple calculation of ALL products prices with tax (with product discount if any) in CART MODULE.
CART MODULE is not associated with shipping and discount coupons (they are NOT displayed in cart module) so why calculating it in cart module total price result???

As for 1 I still haven't found solution... partial tax is shown correctly... but it seems that total tax amount is calculated in different way than just summing up partial tax.

It's calculated by:

[doce]$data->billTotal_tax_amount = $currencyDisplay->priceDisplay( $this->cartPrices['taxAmount'] );[/code]

And:

$this->_cart->products[$cprdkey]->allPrices[$selectedPrice]['subtotal_tax_amount'] = self::roundInternal($this->_cart->products[$cprdkey]->allPrices[$selectedPrice]['taxAmount'],'taxAmount') * $this->_cart->products[$cprdkey]->quantity;
$this->_cart->cartPrices['taxAmount'] += $this->_cart->products[$cprdkey]->allPrices[$selectedPrice]['subtotal_tax_amount'];


in ROOT/administrator/components/com_virtuemart/helpers/calculationh.php

Could anyone put me on right track with this?
Само слога Славjанa спашава - Свуда пођи, својој кући дођи.