omnilight/yii2-shopping-cart — pull request #1 by OmgDef (2014-09-12 14:38:00+00:00)
Title: Added discounts support

Configuration example
```php
'cart' => [
'class' => 'yz\shoppingcart\ShoppingCart',
'discounts' => [
'frontend\modules\store\discounts\CardDiscount'
],
],
```

Discount example

```php
namespace frontend\modules\store\discounts;

use Yii;
use yz\shoppingcart\Discount;

class CardDiscount extends Discount
{
public function apply()
{
if (Yii::$app->session->has('card')) {
foreach($this->shoppingCart->getPositions() as $position) {
$position->setDiscountPrice($position->getCost(false) * (Yii::$app->session->get('card') / 100));
}
}
}
}
```