Refactoring cart rule actions
This commit is contained in:
parent
5e47c5b2af
commit
2ac298cb68
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue