upated shipping fee and using voucher code

This commit is contained in:
franknstayn
2022-03-26 19:43:32 +08:00
parent b418b43469
commit 80bf7e6c67
7 changed files with 125 additions and 100 deletions

View File

@@ -315,6 +315,7 @@ class PaypalController extends Controller
$voucher = $m->selectVoucherWhereIn($voucherIds);
$item_id = $item->Id;
$totalValue = $voucher[0]->VoucherValue;
if ($voucher[0]->VoucherType == "Percentage") {
$getPercentageValue = $totalValue / 100;
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
@@ -323,7 +324,7 @@ class PaypalController extends Controller
);
$m->updateVoucherValueInCart($data, $item_id);
} else if ($voucher[0]->VoucherType == "Percentage") {
} else if ($voucher[0]->VoucherType == "Flat") {
$data = array(
'Price' => round($totalValue * -1, 2)
);
@@ -336,6 +337,9 @@ class PaypalController extends Controller
} else if ($voucher[0]->VoucherType == "Shipping") {
return $shippingFee = 0;
}
} else {
$getSmallItemQty += $item->Quantity;
$CAShippingfee += $item->Quantity; // for canada
}
// var_dump($item->ShippingCostId);
// if ($item->ShippingCostId == 1) {
@@ -347,8 +351,7 @@ class PaypalController extends Controller
// } else if ($item->ShippingCostId == 4) {
// $getDGSItemQty += $item->Quantity;
// }
$getSmallItemQty += $item->Quantity;
$CAShippingfee += $item->Quantity; // for canada
}
$array_address_book = $UserModel->selectAddresBook('UserId', $userId);