Skip to content

Commit

Permalink
Module - added shoppingCartOptions property
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Dec 25, 2015
1 parent 8982a03 commit 904f2b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/CartPositionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace hiqdev\yii2\cart;

use Yii;
use yii\base\Model;

/**
* CartPositionTrait trait.
Expand Down
9 changes: 7 additions & 2 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
*/
class Module extends \yii\base\Module
{
/**
* @var array array of the options that will be passed to [[set]]
*/
public $shoppingCartOptions = [];

/**
* Cart component ID.
*/
Expand All @@ -43,9 +48,9 @@ public function init()
{
parent::init();
if (!$this->has(static::CART_COMPONENT_ID)) {
$this->set(static::CART_COMPONENT_ID, [
$this->set(static::CART_COMPONENT_ID, array_merge([
'class' => 'hiqdev\yii2\cart\ShoppingCart',
]);
], $this->shoppingCartOptions));
}
$this->get(static::CART_COMPONENT_ID)->module = $this;
$this->registerTranslations();
Expand Down

0 comments on commit 904f2b6

Please sign in to comment.