Skip to content

Commit cb4cad1

Browse files
committed
fixed bug for conditions became empty
1 parent 07c00bb commit cb4cad1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/Darryldecode/Cart/Cart.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99

1010
class Cart {
1111

12-
/**
13-
* the cart conditions
14-
*
15-
* @var CartConditionCollection
16-
*/
17-
protected $conditions;
18-
1912
/**
2013
* the item storage
2114
*
@@ -66,7 +59,6 @@ public function __construct($session, $events, $instanceName, $session_key)
6659
$this->instanceName = $instanceName;
6760
$this->sessionKeyCartItems = $session_key.'_cart_items';
6861
$this->sessionKeyCartConditions = $session_key.'_cart_conditions';
69-
$this->conditions = new CartConditionCollection();
7062
$this->events->fire($this->getInstanceName().'.created', array($this));
7163
}
7264

@@ -255,9 +247,11 @@ public function condition($condition)
255247

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

258-
$this->conditions->put($condition->getName(), $condition);
250+
$conditions = $this->getConditions();
251+
252+
$conditions->put($condition->getName(), $condition);
259253

260-
$this->saveConditions($this->conditions);
254+
$this->saveConditions($conditions);
261255

262256
return $this;
263257
}

0 commit comments

Comments
 (0)