当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::getName方法代码示例

本文整理汇总了PHP中Magento\Quote\Model\Quote\Item::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getName方法的具体用法?PHP Item::getName怎么用?PHP Item::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Quote\Model\Quote\Item的用法示例。


在下文中一共展示了Item::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetProductWithQuoteAndStockItem

 public function testSetProductWithQuoteAndStockItem()
 {
     $productMock = $this->generateProductMock(self::PRODUCT_ID, self::PRODUCT_TYPE, self::PRODUCT_SKU, self::PRODUCT_NAME, self::PRODUCT_WEIGHT, self::PRODUCT_TAX_CLASS_ID, self::PRODUCT_COST);
     $this->eventDispatcher->expects($this->once())->method('dispatch')->with('sales_quote_item_set_product', ['product' => $productMock, 'quote_item' => $this->model]);
     $isQtyDecimal = true;
     $this->stockItemMock->expects($this->any())->method('getStockId')->will($this->returnValue(99));
     $this->stockItemMock->expects($this->once())->method('getIsQtyDecimal')->will($this->returnValue($isQtyDecimal));
     $storeId = 15;
     $customerGroupId = 11;
     $quoteMock = $this->getMockBuilder('Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods(['getStoreId', 'getCustomerGroupId', '__wakeup'])->getMock();
     $quoteMock->expects($this->any())->method('getStoreId')->will($this->returnValue($storeId));
     $quoteMock->expects($this->once())->method('getCustomerGroupId')->will($this->returnValue($customerGroupId));
     $this->model->setQuote($quoteMock);
     $productMock->expects($this->once())->method('setStoreId')->with($storeId);
     $productMock->expects($this->once())->method('setCustomerGroupId')->with($customerGroupId);
     $this->model->setProduct($productMock);
     $this->assertEquals($productMock, $this->model->getProduct());
     $this->assertEquals(self::PRODUCT_ID, $this->model->getProductId());
     $this->assertEquals(self::PRODUCT_TYPE, $this->model->getRealProductType());
     $this->assertEquals(self::PRODUCT_SKU, $this->model->getSku());
     $this->assertEquals(self::PRODUCT_NAME, $this->model->getName());
     $this->assertEquals(self::PRODUCT_WEIGHT, $this->model->getWeight());
     $this->assertEquals(self::PRODUCT_TAX_CLASS_ID, $this->model->getTaxClassId());
     $this->assertEquals(self::PRODUCT_COST, $this->model->getBaseCost());
     $this->assertEquals($isQtyDecimal, $this->model->getIsQtyDecimal());
 }
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: buildItemName

 /**
  * @param Item $item
  * @return string
  */
 protected function buildItemName(Item $item)
 {
     // todo: the name must include the variant properties just like in Magento 1
     return $item->getName();
 }
开发者ID:Nosto,项目名称:nosto-magento2,代码行数:9,代码来源:Builder.php

示例3: addQuoteItem

 /**
  * Push `addEcommerceItem' with quote item data to given tracker
  *
  * @param \Magento\Quote\Model\Quote\Item $item
  * @param \Henhed\Piwik\Model\Tracker $tracker
  * @return \Henhed\Piwik\Helper\Tracker
  */
 public function addQuoteItem(Quote\Item $item, TrackerModel $tracker)
 {
     $tracker->addEcommerceItem($item->getSku(), $item->getName(), false, $item->hasCustomPrice() ? (double) $item->getCustomPrice() : (double) $item->getPriceInclTax(), (double) $item->getQty());
     return $this;
 }
开发者ID:henkelund,项目名称:magento2-henhed-piwik,代码行数:12,代码来源:Tracker.php


注:本文中的Magento\Quote\Model\Quote\Item::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。