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


PHP DataObject::getOrderItem方法代码示例

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


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

示例1: afterSave

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

示例2: getChildren

 /**
  * Getting all available children for Invoice, Shipment or CreditMemo item
  *
  * @param \Magento\Framework\DataObject $item
  * @return array|null
  */
 public function getChildren($item)
 {
     $itemsArray = [];
     $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:kidaa30,项目名称:magento2-platformsh,代码行数:33,代码来源:Renderer.php

示例3: _getItemType

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

示例4: getCreditmemoData

 /**
  * @param \Magento\Framework\DataObject $params
  * @return mixed
  */
 public function getCreditmemoData(\Magento\Framework\DataObject $params)
 {
     /** @var \Magento\Sales\Model\Order\Item $orderItem */
     $orderItem = $params->getOrderItem();
     $data = $params->getCreditMemo();
     if ($orderItem->getOrder()->getBaseGrandTotal()) {
         $data['refund_customerbalance_return_enable'] = '1';
         $data['refund_customerbalance_return'] = $orderItem->getOrder()->getBaseGrandTotal();
     }
     return $data;
 }
开发者ID:vinai-drive-by-commits,项目名称:magento2-sample-data,代码行数:15,代码来源:Observer.php

示例5: getColumnHtml

 /**
  * Retrieve rendered column html content
  *
  * @param \Magento\Framework\DataObject $item
  * @param string $column the column key
  * @param string $field the custom item field
  * @return string
  */
 public function getColumnHtml(\Magento\Framework\DataObject $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 ($field !== null) {
             $block->setField($field);
         }
         return $block->toHtml();
     }
     return ' ';
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:24,代码来源:AbstractItems.php

示例6: _drawItem

 /**
  * Draw Item process
  *
  * @param  \Magento\Framework\DataObject $item
  * @param  \Zend_Pdf_Page $page
  * @param  \Magento\Sales\Model\Order $order
  * @return \Zend_Pdf_Page
  */
 protected function _drawItem(\Magento\Framework\DataObject $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:pradeep-wagento,项目名称:magento2,代码行数:20,代码来源:AbstractPdf.php

示例7: getSelectionAttributes

 /**
  * Retrieve Selection attributes
  *
  * @param \Magento\Framework\DataObject $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:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:AbstractItems.php


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