Merge pull request #1767 from prashant-webkul/bugs_patch_1
Fixed issues related to discount calculations
This commit is contained in:
commit
27214ed088
|
|
@ -32,7 +32,15 @@ class PercentOfProduct extends Action
|
|||
if ($applicability) {
|
||||
$eligibleItems = $this->getEligibleItems();
|
||||
|
||||
$applicableDiscount = \Cart::getCart()->base_sub_total * ($rule->disc_amount / 100);
|
||||
$applicableDiscount = function () use ($eligibleItems) {
|
||||
$total = 0;
|
||||
|
||||
foreach ($eligibleItems as $item) {
|
||||
$total = $total + $item->base_total;
|
||||
}
|
||||
|
||||
return $total;
|
||||
};
|
||||
|
||||
foreach ($eligibleItems as $item) {
|
||||
$report = array();
|
||||
|
|
@ -40,7 +48,7 @@ class PercentOfProduct extends Action
|
|||
$report['item_id'] = $item->id;
|
||||
$report['child_items'] = collect();
|
||||
|
||||
$perItemDiscount = $applicableDiscount / $eligibleItems->count();
|
||||
$perItemDiscount = $applicableDiscount() * ($rule->disc_amount / 100) / $eligibleItems->count();
|
||||
|
||||
$itemPrice = $item->base_price;
|
||||
|
||||
|
|
|
|||
|
|
@ -433,8 +433,12 @@ abstract class Discount
|
|||
|
||||
foreach ($productIDs as $productID) {
|
||||
foreach ($cart->items as $item) {
|
||||
if ($item->product_id == $productID)
|
||||
$partialMatch = 1;
|
||||
$childrens = $item->children;
|
||||
|
||||
foreach ($childrens as $children) {
|
||||
if ($children->product_id == $productID)
|
||||
$partialMatch = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue