/** * Add a new product to wish list (save items for buying later) */ public function addToWishList() { // avoid search engines adding items to cart... if ($this->request->get('csid') && $this->request->get('csid') != session_id()) { return new RawResponse(); } $product = Product::getInstanceByID($this->request->get('id'), Product::LOAD_DATA); $this->order->addToWishList($product); $this->order->mergeItems(); SessionOrder::save($this->order); $this->setMessage($this->makeText('_added_to_wishlist', array($product->getName($this->getRequestLanguage())))); if (!$this->isAjax()) { return new ActionRedirectResponse('order', 'index', array('query' => 'return=' . $this->request->get('return'))); } else { $response = new CompositeJSONResponse(); return $this->ajaxResponse($response); } }