-- HikaShop version -- : 2.3.0
-- Joomla version -- : Joomla! 3.3.0 Stable
-- PHP version -- : 5.4.13
I tried to create orders with tax. Tax and all calculations are correct during checkout and once order is created tax does not save for negative values.
If I add a product where it has two options product.
a)Main product price is zero
b)first options product has 70 price and tax does not apply to this
c)second option product has 50 price and tax does apply to this.
additionally there is a discount on main product of $50. In hikashop config Apply discounts is set to Before taxes.
On checkout page total shows 70$ for one quantity.But when order is confirmed in product order table it shows as below-
a)main product -> price = - 50$ , Tax = 0(It should be -2$ which is tax)
b)first option product -> price = -70$ , Tax = 0(correct)
b)second option product -> price = 50$ , Tax = 2$(correct)
When I tried to debug the code I found something wrong in below code(after_confirm)-
if(!empty($product->prices[0]->unit_price->price_value_with_tax) && bccomp($product->prices[0]->unit_price->price_value_with_tax,0,5)){
$tax = $product->prices[0]->unit_price->price_value_with_tax-$product->prices[0]->unit_price->price_value;
}
below should be true for -2$ but it is treated as false.
bccomp($product->prices[0]->unit_price->price_value_with_tax,0,5))
It would be great if you can help me to fix this.
I would like to add that in my localhost where BC Math extension is installed, it is working fine but on server, extension is not installed so it's using helper class custom bccomp function.
Thanks,