/** * Updates the position in the shopping cart * If the position was previously added, then it will be updated in shopping cart, * if the position was not previously in the cart, it will be added there. * If the count of less than 1, the position will be deleted. * * @param IECartPosition $position * @param int $quantity */ public function updateStored(IECartPosition $position, $quantity) { if ($this->objSectorCiudad !== null) { $key = $position->getId(); $position->generate(array('objSectorCiudad' => $this->objSectorCiudad, 'codigoPerfil' => $this->codigoPerfil)); $position->setQuantityStored($quantity); if ($position->getQuantity(true) + $position->getQuantity(false) < 1) { $this->remove($key); } else { parent::add($key, $position); } $this->applyDiscounts(); $this->onUpdatePoistion(new CEvent($this)); $this->saveState(); return true; } return false; }