Created
October 4, 2017 10:06
-
-
Save CB9TOIIIA/4df176ceffea46d285cae1de520d37e4 to your computer and use it in GitHub Desktop.
Изменение цены всего заказа в зависимости от количества заказанных товаров
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JBCartElementModifierOrderPriceColdiscount extends JBCartElementModifierOrderPrice | |
{ | |
public function getRate() | |
{ | |
$orderSum = $this->_order->getTotalForItems(); // сумма за все товары (без доставки и прочего) | |
$discount = 0; | |
if ($orderSum->compare('100rub', '=')) { // сравниваем c ценой 100 рублей | |
$discount = '2'; // скидка 2 руб, если сумма равна | |
} | |
if ($orderSum->compare('150rub', '=')) { // сравниваем c ценой 150 рублей | |
$discount = '8'; // скидка 8 руб | |
} | |
// и.т.д любые свое условия | |
return $this->_order->val($discount)->negative(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment