Esempio n. 1
0
 /**
  * Removes position from the cart
  * @param CartPositionInterface $position
  */
 public function remove($position)
 {
     $this->trigger(self::EVENT_BEFORE_POSITION_REMOVE, new Event(['data' => $this->_positions[$position->getId()]]));
     $this->trigger(self::EVENT_CART_CHANGE, new Event(['data' => ['action' => 'remove', 'position' => $this->_positions[$position->getId()]]]));
     unset($this->_positions[$position->getId()]);
     if ($this->storeInSession) {
         $this->saveToSession();
     }
 }
 /**
  * Removes position from the cart
  * @param CartPositionInterface $position
  */
 public function remove($position)
 {
     $id = $position->getId();
     if (array_key_exists($id, $this->_positions)) {
         $this->trigger(self::EVENT_BEFORE_POSITION_REMOVE, new Event(['data' => $this->_positions[$id]]));
         $this->trigger(self::EVENT_CART_CHANGE, new Event(['data' => ['action' => 'remove', 'position' => $this->_positions[$id]]]));
         unset($this->_positions[$id]);
         $this->saveToSession();
     }
     $this->saveToDb($position, 0, 0);
 }
 /**
  * Removes position from the cart
  * @param CartPositionInterface $position
  */
 public function remove($position)
 {
     $this->removeById($position->getId());
 }