/** * Retrieve params for updating product in wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * * @return string|false */ public function getUpdateParams($item) { $itemId = null; if ($item instanceof \Magento\Catalog\Model\Product) { $itemId = $item->getWishlistItemId(); $productId = $item->getId(); } if ($item instanceof \Magento\Wishlist\Model\Item) { $itemId = $item->getId(); $productId = $item->getProduct()->getId(); } $url = $this->_getUrl('wishlist/index/updateItemOptions'); if ($itemId) { $params = ['id' => $itemId, 'product' => $productId, 'qty' => $item->getQty()]; return $this->_postDataHelper->getPostData($url, $params); } return false; }
/** * Retrieve post action config * * @return string */ public function getPostAction() { return $this->coreHelper->getPostData($this->getSignupUrl()); }
/** * Retrieve URL for adding All items to shopping cart from shared wishlist * * @return string */ public function getSharedAddAllToCartUrl() { return $this->_postDataHelper->getPostData($this->_storeManager->getStore()->getUrl('*/*/allcart', ['_current' => true])); }
/** * Returns target store post data * * @param \Magento\Store\Model\Store $store * @return string */ public function getTargetStorePostData(\Magento\Store\Model\Store $store) { return $this->_postDataHelper->getPostData($this->getHomeUrl(), ['___store' => $store->getCode(), '___from_store' => $this->getStoreCode()]); }
/** * Get add all to cart params for POST request * @return string */ public function getAddAllToCartParams() { return $this->postDataHelper->getPostData($this->getUrl('wishlist/index/allcart'), ['wishlist_id' => $this->getWishlistInstance()->getId()]); }
/** * Get parameters to clear compare list * * @return string */ public function getPostDataClearList() { $refererUrl = $this->_getRequest()->getServer('HTTP_REFERER'); $params = [\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->urlEncoder->encode($refererUrl)]; return $this->postHelper->getPostData($this->getClearListUrl(), $params); }
/** * Return POST data for currency to switch * * @param string $code * @return string */ public function getSwitchCurrencyPostData($code) { return $this->_postDataHelper->getPostData($this->getSwitchUrl(), ['currency' => $code]); }
/** * Retrieve widget options in json format * * @param array $customOptions Optional parameter for passing custom selectors from template * @return string */ public function getWidgetOptionsJson(array $customOptions = []) { $postData = $this->_postDataHelper->getPostData($this->getPagerUrl(), [\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getPagerEncodedUrl()]); $options = ['modeCookie' => ToolbarModel::MODE_COOKIE_NAME, 'directionCookie' => ToolbarModel::DIRECTION_COOKIE_NAME, 'orderCookie' => ToolbarModel::ORDER_COOKIE_NAME, 'limitCookie' => ToolbarModel::LIMIT_COOKIE_NAME, 'postData' => json_decode($postData)]; $options = array_replace_recursive($options, $customOptions); return json_encode(['productListToolbarForm' => $options]); }
/** * Retrieve params for post request * * @return string */ public function getPostParams() { return $this->_postDataHelper->getPostData($this->getHref()); }
/** * Returns target store post data * * @param \Magento\Store\Model\Store $store * @param array $data * @return string */ public function getTargetStorePostData(\Magento\Store\Model\Store $store, $data = []) { $data[\Magento\Store\Api\StoreResolverInterface::PARAM_NAME] = $store->getCode(); return $this->_postDataHelper->getPostData($this->getUrl('stores/store/switch'), $data); }