本文整理汇总了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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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 ' ';
}
示例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();
}
示例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;
}