Refactoring cart rule actions

This commit is contained in:
Prashant Singh 2019-09-06 12:39:25 +05:30
parent 5e47c5b2af
commit 2ac298cb68
2 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ class FixedAmount extends Action
if ($apply()) {
if ($rule->action_type == 'whole_cart_to_fixed')
{
$eligibleItems = \Cart::getItems();
\Cart::getCart()->items
}
foreach ($eligibleItems as $item) {
@ -51,8 +51,6 @@ class FixedAmount extends Action
$discQuantity = $itemQuantity <= $discQuantity ? $itemQuantity : $discQuantity;
$totalDiscount = $totalDiscount + $discount;
$report = array();
$report['item_id'] = $item->id;
@ -68,6 +66,8 @@ class FixedAmount extends Action
$impact->push($report);
$totalDiscount = $totalDiscount + $discount;
unset($report);
}
}

View File

@ -46,7 +46,7 @@ class PercentOfProduct extends Action
if ($apply()) {
if ($rule->action_type == 'whole_cart_to_percent')
{
$eligibleItems = \Cart::getItems();
$eligibleItems = \Cart::getCart()->items;
}
foreach ($eligibleItems as $item) {