[-] Core: Fix #PSCFV-5966 the tax rate applied to shipping cost for the visitors was the product tax rate
This commit is contained in:
1 parent
6cad7c2bf4
commit
0071850981
2 files changed
+13
-9
No files matched your search
+8
-6
@@ -337,12 +337,6 @@ class AddressCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function initialize($id_address = null)
|
public static function initialize($id_address = null)
|
||||||
{
|
{
|
||||||
// set the default address
|
|
||||||
$address = new Address();
|
|
||||||
$address->id_country = (int)Context::getContext()->country->id;
|
|
||||||
$address->id_state = 0;
|
|
||||||
$address->postcode = 0;
|
|
||||||
|
|
||||||
// if an id_address has been specified retrieve the address
|
// if an id_address has been specified retrieve the address
|
||||||
if ($id_address)
|
if ($id_address)
|
||||||
{
|
{
|
||||||
@@ -351,6 +345,14 @@ class AddressCore extends ObjectModel
|
|||||||
if (!Validate::isLoadedObject($address))
|
if (!Validate::isLoadedObject($address))
|
||||||
throw new PrestaShopException('Invalid address');
|
throw new PrestaShopException('Invalid address');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set the default address
|
||||||
|
$address = new Address();
|
||||||
|
$address->id_country = (int)Context::getContext()->country->id;
|
||||||
|
$address->id_state = 0;
|
||||||
|
$address->postcode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return $address;
|
return $address;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -1509,9 +1509,8 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
|
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
|
||||||
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0)
|
||||||
{
|
|
||||||
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), 2);
|
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), 2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), $wrapping_fees + $order_total_products + $shipping_fees);
|
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), $wrapping_fees + $order_total_products + $shipping_fees);
|
||||||
@@ -2600,7 +2599,10 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
// Select carrier tax
|
// Select carrier tax
|
||||||
if ($use_tax && !Tax::excludeTaxeOption())
|
if ($use_tax && !Tax::excludeTaxeOption())
|
||||||
$carrier_tax = $carrier->getTaxesRate(new Address((int)$address_id));
|
{
|
||||||
|
$address = Address::initialize((int)$address_id);
|
||||||
|
$carrier_tax = $carrier->getTaxesRate($address);
|
||||||
|
}
|
||||||
|
|
||||||
$configuration = Configuration::getMultiple(array(
|
$configuration = Configuration::getMultiple(array(
|
||||||
'PS_SHIPPING_FREE_PRICE',
|
'PS_SHIPPING_FREE_PRICE',
|
||||||
|
|||||||
Reference in new issue
Block a user