Stop other products from being discounted


Joined
Jun 10, 2022
Messages
1
Reaction score
0
I have below code which calculate the discount of all products but now i want to stop other product to get discounted , please help. thank you.

public function calculateItemDiscount(
$item,
$total,
$totalDiscount,
&$base


----------


Discount,
&$discount,
$isCalculateTax,
&$lastItem
) {
$itemBaseDiscount = ($this->getItemTotalForDiscount($item, $isCalculateTax, false) / $total) * $totalDiscount;
$itemBaseDiscount = $this->round($itemBaseDiscount, 'base');
$itemDiscount = $this->convertPrice($itemBaseDiscount, false, false, $item->getStoreId());
$itemDiscount = $this->round($itemDiscount);
$item->setBaseAffiliateDiscountAmount($item->getBaseAffiliateDiscountAmount() + $itemBaseDiscount)
->setAffiliateDiscountAmount($item->getAffiliateDiscountAmount() + $itemDiscount);
$baseDiscount += $itemBaseDiscount;
$discount += $itemDiscount;
$lastItem = $item;
}
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top