當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Data::getRemoveParams方法代碼示例

本文整理匯總了PHP中Magento\Wishlist\Helper\Data::getRemoveParams方法的典型用法代碼示例。如果您正苦於以下問題:PHP Data::getRemoveParams方法的具體用法?PHP Data::getRemoveParams怎麽用?PHP Data::getRemoveParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Wishlist\Helper\Data的用法示例。


在下文中一共展示了Data::getRemoveParams方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetRemoveParamsWithReferer

 public function testGetRemoveParamsWithReferer()
 {
     $url = 'result url';
     $wishlistItemId = 1;
     $referer = 'referer';
     $refererEncoded = 'referer_encoded';
     $this->wishlistItem->expects($this->once())->method('getWishlistItemId')->willReturn($wishlistItemId);
     $this->requestMock->expects($this->once())->method('getServer')->with('HTTP_REFERER')->willReturn($referer);
     $this->urlEncoderMock->expects($this->once())->method('encode')->with($referer)->willReturn($refererEncoded);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('wishlist/index/remove', [])->willReturn($url);
     $this->postDataHelper->expects($this->once())->method('getPostData')->with($url, ['item' => $wishlistItemId, ActionInterface::PARAM_NAME_URL_ENCODED => $refererEncoded])->willReturn($url);
     $this->assertEquals($url, $this->model->getRemoveParams($this->wishlistItem, true));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:DataTest.php

示例2: getItems

 /**
  * Get wishlist items
  *
  * @return array
  */
 protected function getItems()
 {
     $this->view->loadLayout();
     $collection = $this->wishlistHelper->getWishlistItemCollection();
     $collection->clear()->setPageSize(self::SIDEBAR_ITEMS_NUMBER)->setInStockFilter(true)->setOrder('added_at');
     $items = [];
     foreach ($collection as $wishlistItem) {
         /** @var \Magento\Catalog\Model\Product $product */
         $product = $wishlistItem->getProduct();
         $this->productImageView->init($product, 'wishlist_sidebar_block', 'Magento_Catalog');
         $items[] = ['image' => ['src' => $this->productImageView->getUrl(), 'alt' => $this->productImageView->getLabel(), 'width' => $this->productImageView->getWidth(), 'height' => $this->productImageView->getHeight()], 'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem), 'product_name' => $product->getName(), 'product_price' => $this->block->getProductPriceHtml($product, \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, ['item' => $wishlistItem]), 'product_is_saleable_and_visible' => $product->isSaleable() && $product->isVisibleInSiteVisibility(), 'product_has_required_options' => $product->getTypeInstance()->hasRequiredOptions($product), 'add_to_cart_params' => $this->wishlistHelper->getAddToCartParams($wishlistItem), 'delete_item_params' => $this->wishlistHelper->getRemoveParams($wishlistItem)];
     }
     return $items;
 }
開發者ID:vasiljok,項目名稱:magento2,代碼行數:19,代碼來源:Wishlist.php

示例3: getItemData

 /**
  * Retrieve wishlist item data
  *
  * @param \Magento\Wishlist\Model\Item $wishlistItem
  * @return array
  */
 protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
 {
     $product = $wishlistItem->getProduct();
     return ['image' => $this->getImageData($product), 'product_url' => $this->wishlistHelper->getProductUrl($wishlistItem), 'product_name' => $product->getName(), 'product_price' => $this->block->getProductPriceHtml($product, \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, ['item' => $wishlistItem]), 'product_is_saleable_and_visible' => $product->isSaleable() && $product->isVisibleInSiteVisibility(), 'product_has_required_options' => $product->getTypeInstance()->hasRequiredOptions($product), 'add_to_cart_params' => $this->wishlistHelper->getAddToCartParams($wishlistItem, true), 'delete_item_params' => $this->wishlistHelper->getRemoveParams($wishlistItem, true)];
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:11,代碼來源:Wishlist.php


注:本文中的Magento\Wishlist\Helper\Data::getRemoveParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。