Exemplo n.º 1
0
 public function testGetTargetStorePostData()
 {
     $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $store->expects($this->any())->method('getCode')->will($this->returnValue('new-store'));
     $storeSwitchUrl = 'stores/store/switch';
     $this->urlBuilder->expects($this->any())->method('getUrl')->with($storeSwitchUrl)->willReturnArgument(0);
     $this->corePostDataHelper->expects($this->any())->method('getPostData')->with($storeSwitchUrl, ['___store' => 'new-store']);
     $this->switcher->getTargetStorePostData($store);
 }
Exemplo n.º 2
0
 public function testGetTargetStorePostData()
 {
     $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $store->expects($this->any())->method('getCode')->will($this->returnValue('new-store'));
     $currentStore = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $currentStore->expects($this->any())->method('getCode')->will($this->returnValue('current-store'));
     $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($currentStore));
     $this->corePostDataHelper->expects($this->any())->method('getPostData')->with(null, ['___store' => 'new-store', '___from_store' => 'current-store']);
     $this->switcher->getTargetStorePostData($store);
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * Retrieve post action config
  *
  * @return string
  */
 public function getPostAction()
 {
     return $this->coreHelper->getPostData($this->getSignupUrl());
 }
Exemplo n.º 5
0
 /**
  * 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]));
 }
Exemplo n.º 6
0
 /**
  * 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()]);
 }
Exemplo n.º 7
0
 /**
  * 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()]);
 }
Exemplo n.º 8
0
 /**
  * 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);
 }
Exemplo n.º 9
0
 /**
  * Return POST data for currency to switch
  *
  * @param string $code
  * @return string
  */
 public function getSwitchCurrencyPostData($code)
 {
     return $this->_postDataHelper->getPostData($this->getSwitchUrl(), ['currency' => $code]);
 }
Exemplo n.º 10
0
 /**
  * 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());
 }
Exemplo n.º 12
0
 /**
  * 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);
 }