/** * Restore cart from session or creates a new one * * @param array $cartSettings * @param array $pluginSettings * * @return \Extcode\Cart\Domain\Model\Cart\Cart */ public function getCartFromSession(array $cartSettings, array $pluginSettings) { $cart = $this->sessionHandler->restoreFromSession($cartSettings['pid']); if (!$cart) { $cart = $this->getNewCart($cartSettings, $pluginSettings); } return $cart; }
/** * Action removeProduct * * @return void */ public function removeProductAction() { if ($this->request->hasArgument('product')) { $this->cart = $this->sessionHandler->restoreFromSession($this->settings['cart']['pid']); $this->cart->removeProductById($this->request->getArgument('product')); $this->updateService(); $this->sessionHandler->writeToSession($this->cart, $this->settings['cart']['pid']); } $this->redirect('showCart'); }