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