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


PHP Object::getOrderItem方法代码示例

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


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

示例1: getChilds

 /**
  * Getting all available children for Invoice, Shipment or CreditMemo item
  *
  * @param \Magento\Framework\Object $item
  * @return array|null
  */
 public function getChilds($item)
 {
     $itemsArray = array();
     $items = null;
     if ($item instanceof \Magento\Sales\Model\Order\Invoice\Item) {
         $items = $item->getInvoice()->getAllItems();
     } elseif ($item instanceof \Magento\Sales\Model\Order\Shipment\Item) {
         $items = $item->getShipment()->getAllItems();
     } elseif ($item instanceof \Magento\Sales\Model\Order\Creditmemo\Item) {
         $items = $item->getCreditmemo()->getAllItems();
     }
     if ($items) {
         foreach ($items as $value) {
             $parentItem = $value->getOrderItem()->getParentItem();
             if ($parentItem) {
                 $itemsArray[$parentItem->getId()][$value->getOrderItemId()] = $value;
             } else {
                 $itemsArray[$value->getOrderItem()->getId()][$value->getOrderItemId()] = $value;
             }
         }
     }
     if (isset($itemsArray[$item->getOrderItem()->getId()])) {
         return $itemsArray[$item->getOrderItem()->getId()];
     } else {
         return null;
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:33,代码来源:Renderer.php

示例2: afterSave

 /**
  * Method is invoked after save
  *
  * @param \Magento\Framework\Object $object
  * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
  */
 public function afterSave($object)
 {
     if ($object->getOrderItem()) {
         $object->getOrderItem()->save();
     }
     return parent::beforeSave($object);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Item.php

示例3: _getItemType

 /**
  * Return product type for quote/order item
  *
  * @param \Magento\Framework\Object $item
  * @return string
  */
 protected function _getItemType(\Magento\Framework\Object $item)
 {
     if ($item->getOrderItem()) {
         $type = $item->getOrderItem()->getProductType();
     } elseif ($item instanceof \Magento\Sales\Model\Quote\Address\Item) {
         $type = $item->getQuoteItem()->getProductType();
     } else {
         $type = $item->getProductType();
     }
     return $type;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AbstractItems.php

示例4: getColumnHtml

 /**
  * Retrieve rendered column html content
  *
  * @param \Magento\Framework\Object $item
  * @param string $column the column key
  * @param string $field the custom item field
  * @return string
  */
 public function getColumnHtml(\Magento\Framework\Object $item, $column, $field = null)
 {
     if ($item->getOrderItem()) {
         $block = $this->getColumnRenderer($column, $item->getOrderItem()->getProductType());
     } else {
         $block = $this->getColumnRenderer($column, $item->getProductType());
     }
     if ($block) {
         $block->setItem($item);
         if (!is_null($field)) {
             $block->setField($field);
         }
         return $block->toHtml();
     }
     return ' ';
 }
开发者ID:aiesh,项目名称:magento2,代码行数:24,代码来源:AbstractItems.php

示例5: _drawItem

 /**
  * Draw Item process
  *
  * @param  \Magento\Framework\Object $item
  * @param  \Zend_Pdf_Page $page
  * @param  \Magento\Sales\Model\Order $order
  * @return \Zend_Pdf_Page
  */
 protected function _drawItem(\Magento\Framework\Object $item, \Zend_Pdf_Page $page, \Magento\Sales\Model\Order $order)
 {
     $type = $item->getOrderItem()->getProductType();
     $renderer = $this->_getRenderer($type);
     $renderer->setOrder($order);
     $renderer->setItem($item);
     $renderer->setPdf($this);
     $renderer->setPage($page);
     $renderer->setRenderedModel($this);
     $renderer->draw();
     return $renderer->getPage();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:AbstractPdf.php

示例6: getSelectionAttributes

 /**
  * Retrieve Selection attributes
  *
  * @param \Magento\Framework\Object $item
  * @return mixed
  */
 public function getSelectionAttributes($item)
 {
     if ($item instanceof \Magento\Sales\Model\Order\Item) {
         $options = $item->getProductOptions();
     } else {
         $options = $item->getOrderItem()->getProductOptions();
     }
     if (isset($options['bundle_selection_attributes'])) {
         return unserialize($options['bundle_selection_attributes']);
     }
     return null;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:AbstractItems.php


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