Update loyalty.php
Price should apply tax as in configuration.
This commit is contained in:
1 parent
f78a093a1c
commit
d63288affd
1 file changed
+11
@@ -493,9 +493,16 @@ class Loyalty extends Module
|
|||||||
include_once(dirname(__FILE__).'/LoyaltyModule.php');
|
include_once(dirname(__FILE__).'/LoyaltyModule.php');
|
||||||
|
|
||||||
$total_price = 0;
|
$total_price = 0;
|
||||||
|
$taxesEnabled = Product::getTaxCalculationMethod();
|
||||||
$details = OrderReturn::getOrdersReturnDetail((int)$params['orderReturn']->id);
|
$details = OrderReturn::getOrdersReturnDetail((int)$params['orderReturn']->id);
|
||||||
foreach ($details as $detail)
|
foreach ($details as $detail)
|
||||||
{
|
{
|
||||||
|
if ($taxesEnabled == PS_TAX_EXC)
|
||||||
|
$total_price += Db::getInstance()->getValue('
|
||||||
|
SELECT ROUND(total_price_tax_excl, 2)
|
||||||
|
FROM '._DB_PREFIX_.'order_detail od
|
||||||
|
WHERE id_order_detail = '.(int)$detail['id_order_detail']);
|
||||||
|
else
|
||||||
$total_price += Db::getInstance()->getValue('
|
$total_price += Db::getInstance()->getValue('
|
||||||
SELECT ROUND(total_price_tax_incl, 2)
|
SELECT ROUND(total_price_tax_incl, 2)
|
||||||
FROM '._DB_PREFIX_.'order_detail od
|
FROM '._DB_PREFIX_.'order_detail od
|
||||||
@@ -650,7 +657,11 @@ class Loyalty extends Module
|
|||||||
|| !Validate::isLoadedObject($loyalty = new LoyaltyModule((int)LoyaltyModule::getByOrderId((int)$params['order']->id))))
|
|| !Validate::isLoadedObject($loyalty = new LoyaltyModule((int)LoyaltyModule::getByOrderId((int)$params['order']->id))))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
$taxesEnabled = Product::getTaxCalculationMethod();
|
||||||
$loyalty_new = new LoyaltyModule();
|
$loyalty_new = new LoyaltyModule();
|
||||||
|
if ($taxesEnabled == PS_TAX_EXC)
|
||||||
|
$loyalty_new->points = -1 * LoyaltyModule::getNbPointsByPrice(number_format($order_detail->total_price_tax_excl, 2, '.', ''));
|
||||||
|
else
|
||||||
$loyalty_new->points = -1 * LoyaltyModule::getNbPointsByPrice(number_format($order_detail->total_price_tax_incl, 2, '.', ''));
|
$loyalty_new->points = -1 * LoyaltyModule::getNbPointsByPrice(number_format($order_detail->total_price_tax_incl, 2, '.', ''));
|
||||||
$loyalty_new->id_loyalty_state = (int)LoyaltyStateModule::getCancelId();
|
$loyalty_new->id_loyalty_state = (int)LoyaltyStateModule::getCancelId();
|
||||||
$loyalty_new->id_order = (int)$params['order']->id;
|
$loyalty_new->id_order = (int)$params['order']->id;
|
||||||
|
|||||||
Reference in new issue
Block a user