コード例 #1
0
 public function testGetIdentities()
 {
     $productTags = ['catalog_product_1'];
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false);
     $category = $this->getMock('Magento\\Catalog\\Model\\Category', [], [], '', false);
     $product->expects($this->once())->method('getIdentities')->will($this->returnValue($productTags));
     $category->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->registryMock->expects($this->any())->method('registry')->will($this->returnValueMap([['product', $product], ['current_category', $category]]));
     $this->assertEquals(['catalog_product_1', 'catalog_category_product_1'], $this->view->getIdentities());
 }
コード例 #2
0
 /**
  * @param \Magento\Catalog\Block\Product\View $block
  * @param array $validators
  * @return array
  */
 public function afterGetQuantityValidators(\Magento\Catalog\Block\Product\View $block, array $validators)
 {
     $stockItem = $this->stockRegistry->getStockItem($block->getProduct()->getId(), $block->getProduct()->getStore()->getWebsiteId());
     $params = [];
     $params['minAllowed'] = max((double) $stockItem->getQtyMinAllowed(), 1);
     if ($stockItem->getQtyMaxAllowed()) {
         $params['maxAllowed'] = $stockItem->getQtyMaxAllowed();
     }
     if ($stockItem->getQtyIncrements() > 0) {
         $params['qtyIncrements'] = (double) $stockItem->getQtyIncrements();
     }
     $validators['validate-item-quantity'] = $params;
     return $validators;
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function getImage($product, $imageId, $attributes = array())
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getImage');
     if (!$pluginInfo) {
         return parent::getImage($product, $imageId, $attributes);
     } else {
         return $this->___callPlugins('getImage', func_get_args(), $pluginInfo);
     }
 }
コード例 #4
0
ファイル: ViewTest.php プロジェクト: andrewhowdencom/m2onk8s
 public function testStartBundleCustomization()
 {
     $this->markTestSkipped("Functionality not implemented in Magento 1.x. Implemented in Magento 2");
     $this->assertFalse($this->_block->startBundleCustomization());
 }
コード例 #5
0
ファイル: View.php プロジェクト: kidaa30/magento2-platformsh
 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $this->getProduct()->setShortDescription(null);
     return parent::_toHtml();
 }
コード例 #6
0
ファイル: Product.php プロジェクト: Nosto/nosto-magento2
 /**
  * Constructor.
  *
  * @param Context $context the context.
  * @param UrlEncoder $urlEncoder the  url encoder.
  * @param JsonEncoder $jsonEncoder the json encoder.
  * @param StringUtils $string the string lib.
  * @param \Magento\Catalog\Helper\Product $productHelper the product helper.
  * @param ConfigInterface $productTypeConfig the product type config.
  * @param FormatInterface $localeFormat the locale format.
  * @param Session $customerSession the user session.
  * @param ProductRepositoryInterface $productRepository th product repository.
  * @param PriceCurrencyInterface $priceCurrency the price currency.
  * @param ProductBuilder $productBuilder the product meta model builder.
  * @param CategoryBuilder $categoryBuilder the category meta model builder.
  * @param Data $dataHelper the data helper.
  * @param Format $formatHelper the format helper.
  * @param array $data optional data.
  */
 public function __construct(Context $context, UrlEncoder $urlEncoder, JsonEncoder $jsonEncoder, StringUtils $string, \Magento\Catalog\Helper\Product $productHelper, ConfigInterface $productTypeConfig, FormatInterface $localeFormat, Session $customerSession, ProductRepositoryInterface $productRepository, PriceCurrencyInterface $priceCurrency, ProductBuilder $productBuilder, CategoryBuilder $categoryBuilder, Data $dataHelper, Format $formatHelper, array $data = [])
 {
     parent::__construct($context, $urlEncoder, $jsonEncoder, $string, $productHelper, $productTypeConfig, $localeFormat, $customerSession, $productRepository, $priceCurrency, $data);
     $this->_productBuilder = $productBuilder;
     $this->_categoryBuilder = $categoryBuilder;
     $this->_dataHelper = $dataHelper;
     $this->_formatHelper = $formatHelper;
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function offsetGet($offset)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet');
     if (!$pluginInfo) {
         return parent::offsetGet($offset);
     } else {
         return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo);
     }
 }