Fix: Incorrect tax calculation after room reallocation
This commit is contained in:
@@ -71,6 +71,8 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
{
|
||||
$cache_key = 'RoomTypeServiceProductPrice::getProductRoomTypePriceAndTax'.$idProduct.'_'.$idElement.'_'.$elementType;
|
||||
if (!Cache::isStored($cache_key)) {
|
||||
$objServiceProductCartDetail = new ServiceProductCartDetail();
|
||||
$objServiceProduct = new Product((int)$idProduct);
|
||||
if ($result = Db::getInstance()->getRow('
|
||||
SELECT spp.`price`, spp.`id_tax_rules_group`, p.`auto_add_to_cart`, p.`price_addition_type`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
@@ -88,6 +90,15 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
$result['id_tax_rules_group'] = Product::getIdTaxRulesGroupByIdProduct((int)$idElement);
|
||||
}
|
||||
}
|
||||
} elseif ($objServiceProduct->auto_add_to_cart
|
||||
&& $elementType == RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE
|
||||
&& $objServiceProduct->price_addition_type == Product::PRICE_ADDITION_TYPE_WITH_ROOM
|
||||
&& $objServiceProductCartDetail->alreadyExists(Context::getContext()->cart->id, $idProduct)
|
||||
) {
|
||||
$result = array();
|
||||
$result['auto_add_to_cart'] = 1;
|
||||
$result['price_addition_type'] = Product::PRICE_ADDITION_TYPE_WITH_ROOM;
|
||||
$result['id_tax_rules_group'] = Product::getIdTaxRulesGroupByIdProduct((int)$idElement);
|
||||
}
|
||||
|
||||
Cache::store($cache_key, $result);
|
||||
|
||||
@@ -304,6 +304,8 @@ class ServiceProductOrderDetail extends ObjectModel
|
||||
'name' => $product['name'],
|
||||
'quantity' => $product['quantity'],
|
||||
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
|
||||
'tax_computation_method' => $product['tax_computation_method'],
|
||||
'id_tax_rules_group' => $product['id_tax_rules_group'],
|
||||
'price_calculation_method' => $product['product_price_calculation_method'],
|
||||
'product_tax' => $product_tax,
|
||||
'product_tax_label' => $product_tax_label,
|
||||
|
||||
Reference in New Issue
Block a user