-- HikaShop version -- : 2.2.2
-- Joomla version -- : 2.5.14
Hello I modified the invoice.php in order to display the tax rate. It is working fine when a product is added by the customer, but when I modify an order (add aproduct via backend, selecting one of the existing products/variants) the invoice and shipping invoice show following error message
Error message:
Notice: Undefined property: stdClass::$tax_rate in /homez.428/monpetit/www/administrator/templates/bluestork/html/com_hikashop/order/invoice.php on line 146
A screenshot with the error.
I observed a difference in the database in hikashop_order_product table in order_product_tax_info column when a product / varian is added in frontend or in backen.
When added in Frontend:
a:1:{i:0;O:8:"stdClass":12:{s:11:"taxation_id";s:1...
When added in Backend
a:1:{i:0;O:8:"stdClass":2:{s:11:"tax_namekey";s:7:...
Why the difference? Can I avoid the the difference in the code or Is this normal?
The code I added to the invoice.php
// tax calculation start -
$tax = " ";
if (is_array($product->order_product_tax_info)) {
$tax_rate = $product->order_product_tax_info[0]->tax_rate * 100;
$tax_amount = $product->order_product_tax_info[0]->tax_amount * $product->order_product_quantity;
$product_amount = $product->order_product_price * $product->order_product_quantity;
$tax_total += $tax_amount;
if ($tax_rate>0) {
if ($tax_rate == (int)$tax_rate) $tax = sprintf("%d",$tax_rate);
else $tax = sprintf("%0.2f",$tax_rate);
$taxes_array[$tax] = @$taxes_array[$tax] + $tax_amount;
$products_array[$tax] = @$products_array[$tax] + $product_amount + $tax_amount;
$tax.=" %";
}
} // tax
Line 146:
$tax_rate = $product->order_product_tax_info[0]->tax_rate * 100;
Please coul you help me fixing this problem?