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


PHP Item::getId方法代码示例

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


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

示例1: assertOrderItem

 /**
  * @param \Magento\Sales\Model\Order\Item $orderItem
  * @param array $response
  * @return void
  */
 protected function assertOrderItem(\Magento\Sales\Model\Order\Item $orderItem, array $response)
 {
     $this->assertEquals($orderItem->getId(), $response['item_id']);
     $this->assertEquals($orderItem->getOrderId(), $response['order_id']);
     $this->assertEquals($orderItem->getProductId(), $response['product_id']);
     $this->assertEquals($orderItem->getProductType(), $response['product_type']);
     $this->assertEquals($orderItem->getBasePrice(), $response['base_price']);
     $this->assertEquals($orderItem->getRowTotal(), $response['row_total']);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:14,代码来源:OrderItemGetListTest.php

示例2: getOrderItemVariables

 /**
  * Retrieve tracking variables for an order item
  *
  * @param \Magento\Sales\Model\Order\Item $item The order item
  *
  * @return array
  */
 private function getOrderItemVariables($item)
 {
     $variables = [];
     if (!$item->isDummy()) {
         $itemId = $item->getId();
         $prefix = "order.items.{$itemId}";
         $variables[$prefix . '.sku'] = $item->getSku();
         $variables[$prefix . '.product_id'] = $item->getProductId();
         $variables[$prefix . '.qty'] = $item->getQtyOrdered();
         $variables[$prefix . '.price'] = $item->getBasePrice();
         $variables[$prefix . '.row_total'] = $item->getRowTotal();
         $variables[$prefix . '.label'] = $item->getName();
         $variables[$prefix . '.salesrules'] = $item->getAppliedRuleIds();
         if ($product = $item->getProduct()) {
             $categoriesId = $product->getCategoryIds();
             if (count($categoriesId)) {
                 $variables[$prefix . '.category_ids'] = implode(",", $categoriesId);
             }
         }
     }
     return $variables;
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:29,代码来源:Order.php

示例3: addItem

 /**
  * @param \Magento\Sales\Model\Order\Item $item
  * @return $this
  */
 public function addItem(\Magento\Sales\Model\Order\Item $item)
 {
     $item->setOrder($this);
     if (!$item->getId()) {
         $this->setItems(array_merge($this->getItems(), [$item]));
     }
     return $this;
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:12,代码来源:Order.php

示例4: initFromOrderItem

 /**
  * Initialize creation data from existing order Item
  *
  * @param \Magento\Sales\Model\Order\Item $orderItem
  * @param int $qty
  * @return \Magento\Quote\Model\Quote\Item|string|$this
  */
 public function initFromOrderItem(\Magento\Sales\Model\Order\Item $orderItem, $qty = null)
 {
     if (!$orderItem->getId()) {
         return $this;
     }
     $product = $this->_objectManager->create('Magento\\Catalog\\Model\\Product')->setStoreId($this->getSession()->getStoreId())->load($orderItem->getProductId());
     if ($product->getId()) {
         $product->setSkipCheckRequiredOption(true);
         $buyRequest = $orderItem->getBuyRequest();
         if (is_numeric($qty)) {
             $buyRequest->setQty($qty);
         }
         $item = $this->getQuote()->addProduct($product, $buyRequest);
         if (is_string($item)) {
             return $item;
         }
         if ($additionalOptions = $orderItem->getProductOptionByCode('additional_options')) {
             $item->addOption(new \Magento\Framework\DataObject(['product' => $item->getProduct(), 'code' => 'additional_options', 'value' => serialize($additionalOptions)]));
         }
         $this->_eventManager->dispatch('sales_convert_order_item_to_quote_item', ['order_item' => $orderItem, 'quote_item' => $item]);
         return $item;
     }
     return $this;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:31,代码来源:Create.php

示例5: addItem

 /**
  * @param \Magento\Sales\Model\Order\Item $item
  * @return $this
  */
 public function addItem(\Magento\Sales\Model\Order\Item $item)
 {
     $item->setOrder($this);
     if (!$item->getId()) {
         $this->getItemsCollection()->addItem($item);
     }
     return $this;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:12,代码来源:Order.php

示例6: setOrderItem

 /**
  * Declare order item instance
  *
  * @param \Magento\Sales\Model\Order\Item $item
  * @return $this
  */
 public function setOrderItem(\Magento\Sales\Model\Order\Item $item)
 {
     $this->_orderItem = $item;
     $this->setOrderItemId($item->getId());
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Item.php

示例7: _canRefundNoDummyItem

 /**
  * Check if no dummy order item can be refunded
  *
  * @param \Magento\Sales\Model\Order\Item $item
  * @param array $invoiceQtysRefundLimits
  * @return bool
  */
 protected function _canRefundNoDummyItem($item, $invoiceQtysRefundLimits = [])
 {
     if ($item->getQtyToRefund() < 0) {
         return false;
     }
     if (isset($invoiceQtysRefundLimits[$item->getId()])) {
         return $invoiceQtysRefundLimits[$item->getId()] > 0;
     }
     return true;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:Order.php

示例8: getCreditmemoData

 /**
  * @param \Magento\Sales\Model\Order\Item $orderItem
  * @return array
  */
 public function getCreditmemoData(\Magento\Sales\Model\Order\Item $orderItem)
 {
     $data = [$orderItem->getId() => $orderItem->getQtyToRefund()];
     foreach ($this->observerManager->getObservers() as $observer) {
         if (is_callable([$observer, 'getCreditmemoData'])) {
             $params = new DataObject(['order_item' => $orderItem, 'credit_memo' => $data]);
             $data = $observer->getCreditmemoData($params);
         }
     }
     return $data;
 }
开发者ID:vinai-drive-by-commits,项目名称:magento2-sample-data,代码行数:15,代码来源:Processor.php

示例9: getCreditmemoData

 /**
  * @param \Magento\Sales\Model\Order\Item $orderItem
  * @return array
  */
 public function getCreditmemoData(\Magento\Sales\Model\Order\Item $orderItem)
 {
     $data = [$orderItem->getId() => $orderItem->getQtyToRefund()];
     return $data;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:Processor.php

示例10: itemToQuoteItem

 /**
  * Retrieve
  *
  * @param \Magento\Sales\Model\Order\Item $item
  * @return \Magento\Sales\Model\Quote\Item
  */
 public function itemToQuoteItem(\Magento\Sales\Model\Order\Item $item)
 {
     $quoteItem = $this->_quoteItemFactory->create()->setStoreId($item->getOrder()->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setParentProductId($item->getParentProductId());
     $this->_objectCopyService->copyFieldsetToTarget('sales_convert_order_item', 'to_quote_item', $item, $quoteItem);
     return $quoteItem;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:Order.php


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