Source of file ItemPercentDiscount.php
Size: 0,733 Bytes - Last Modified: 2021-12-24T06:35:13+00:00
/var/www/docs.ssmods.com/process/src/src/Actions/ItemPercentDiscount.php
1234567891011121314151617181920212223242526 | <?php namespace SilverShop\Discounts\Actions; use SilverShop\Discounts\Adjustment; class ItemPercentDiscount extends ItemDiscountAction { public function perform() { foreach ($this->infoitems as $info) { if (!$this->itemQualifies($info)) { continue; } $amount = $this->discount->getDiscountValue($info->getOriginalPrice()); $amount *= $info->getQuantity(); $amount = $this->limit($amount); $info->adjustPrice(new Adjustment($amount, $this->discount)); //break the loop if there is no discountable amount left if (!$this->hasRemainingDiscount()) { break; } } } } |