Skip to content

Commit

Permalink
fixed bug for conditions became empty
Browse files Browse the repository at this point in the history
  • Loading branch information
darryldecode committed Feb 25, 2015
1 parent 07c00bb commit cb4cad1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/Darryldecode/Cart/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@

class Cart {

/**
* the cart conditions
*
* @var CartConditionCollection
*/
protected $conditions;

/**
* the item storage
*
Expand Down Expand Up @@ -66,7 +59,6 @@ public function __construct($session, $events, $instanceName, $session_key)
$this->instanceName = $instanceName;
$this->sessionKeyCartItems = $session_key.'_cart_items';
$this->sessionKeyCartConditions = $session_key.'_cart_conditions';
$this->conditions = new CartConditionCollection();
$this->events->fire($this->getInstanceName().'.created', array($this));
}

Expand Down Expand Up @@ -255,9 +247,11 @@ public function condition($condition)

if( ! $condition instanceof CartCondition ) throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\'');

$this->conditions->put($condition->getName(), $condition);
$conditions = $this->getConditions();

$conditions->put($condition->getName(), $condition);

$this->saveConditions($this->conditions);
$this->saveConditions($conditions);

return $this;
}
Expand Down

0 comments on commit cb4cad1

Please sign in to comment.