Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes
Item Class Reference
Inheritance diagram for Item:
AbstractModel OrderItemInterface AbstractExtensibleModel ExtensibleDataInterface AbstractModel CustomAttributesDataInterface DataObject ExtensibleDataInterface

Public Member Functions

 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], \Magento\Framework\Serialize\Serializer\Json $serializer=null)
 
 setParentItem ($item)
 
 getParentItem ()
 
 canInvoice ()
 
 canShip ()
 
 canRefund ()
 
 getQtyToShip ()
 
 getSimpleQtyToShip ()
 
 getQtyToInvoice ()
 
 getQtyToRefund ()
 
 getQtyToCancel ()
 
 setOrder (\Magento\Sales\Model\Order $order)
 
 getOrder ()
 
 getStatusId ()
 
 getStatus ()
 
 cancel ()
 
 getOriginalPrice ()
 
 setProductOptions (array $options=null)
 
 getProductOptions ()
 
 getProductOptionByCode ($code=null)
 
 getRealProductType ()
 
 addChildItem ($item)
 
 getChildrenItems ()
 
 isChildrenCalculated ()
 
 getForceApplyDiscountToParentItem ()
 
 isShipSeparately ()
 
 isDummy ($shipment=false)
 
 getBuyRequest ()
 
 getProduct ()
 
 getStore ()
 
 getAdditionalData ()
 
 getAmountRefunded ()
 
 getAppliedRuleIds ()
 
 getBaseAmountRefunded ()
 
 getBaseCost ()
 
 getBaseDiscountAmount ()
 
 getBaseDiscountInvoiced ()
 
 getBaseDiscountRefunded ()
 
 getBaseDiscountTaxCompensationAmount ()
 
 getBaseDiscountTaxCompensationInvoiced ()
 
 getBaseDiscountTaxCompensationRefunded ()
 
 getBaseOriginalPrice ()
 
 getBasePrice ()
 
 getBasePriceInclTax ()
 
 getBaseRowInvoiced ()
 
 getBaseRowTotal ()
 
 getBaseRowTotalInclTax ()
 
 getBaseTaxAmount ()
 
 getBaseTaxBeforeDiscount ()
 
 getBaseTaxInvoiced ()
 
 getBaseTaxRefunded ()
 
 getBaseWeeeTaxAppliedAmount ()
 
 getBaseWeeeTaxAppliedRowAmnt ()
 
 getBaseWeeeTaxDisposition ()
 
 getBaseWeeeTaxRowDisposition ()
 
 getCreatedAt ()
 
 setCreatedAt ($createdAt)
 
 getDescription ()
 
 getDiscountAmount ()
 
 getDiscountInvoiced ()
 
 getDiscountPercent ()
 
 getDiscountRefunded ()
 
 getEventId ()
 
 getExtOrderItemId ()
 
 getFreeShipping ()
 
 getGwBasePrice ()
 
 getGwBasePriceInvoiced ()
 
 getGwBasePriceRefunded ()
 
 getGwBaseTaxAmount ()
 
 getGwBaseTaxAmountInvoiced ()
 
 getGwBaseTaxAmountRefunded ()
 
 getGwId ()
 
 getGwPrice ()
 
 getGwPriceInvoiced ()
 
 getGwPriceRefunded ()
 
 getGwTaxAmount ()
 
 getGwTaxAmountInvoiced ()
 
 getGwTaxAmountRefunded ()
 
 getDiscountTaxCompensationAmount ()
 
 getDiscountTaxCompensationCanceled ()
 
 getDiscountTaxCompensationInvoiced ()
 
 getDiscountTaxCompensationRefunded ()
 
 getIsQtyDecimal ()
 
 getIsVirtual ()
 
 getItemId ()
 
 getLockedDoInvoice ()
 
 getLockedDoShip ()
 
 getName ()
 
 getNoDiscount ()
 
 getOrderId ()
 
 getParentItemId ()
 
 getPrice ()
 
 getPriceInclTax ()
 
 getProductId ()
 
 getProductType ()
 
 getQtyBackordered ()
 
 getQtyCanceled ()
 
 getQtyInvoiced ()
 
 getQtyOrdered ()
 
 getQtyRefunded ()
 
 getQtyReturned ()
 
 getQtyShipped ()
 
 getQuoteItemId ()
 
 getRowInvoiced ()
 
 getRowTotal ()
 
 getRowTotalInclTax ()
 
 getRowWeight ()
 
 getSku ()
 
 getStoreId ()
 
 getTaxAmount ()
 
 getTaxBeforeDiscount ()
 
 getTaxCanceled ()
 
 getTaxInvoiced ()
 
 getTaxPercent ()
 
 getTaxRefunded ()
 
 getUpdatedAt ()
 
 getWeeeTaxApplied ()
 
 getWeeeTaxAppliedAmount ()
 
 getWeeeTaxAppliedRowAmount ()
 
 getWeeeTaxDisposition ()
 
 getWeeeTaxRowDisposition ()
 
 getWeight ()
 
 setUpdatedAt ($timestamp)
 
 setItemId ($id)
 
 setOrderId ($id)
 
 setParentItemId ($id)
 
 setQuoteItemId ($id)
 
 setStoreId ($id)
 
 setProductId ($id)
 
 setProductType ($productType)
 
 setWeight ($weight)
 
 setIsVirtual ($isVirtual)
 
 setSku ($sku)
 
 setName ($name)
 
 setDescription ($description)
 
 setAppliedRuleIds ($appliedRuleIds)
 
 setAdditionalData ($additionalData)
 
 setIsQtyDecimal ($isQtyDecimal)
 
 setNoDiscount ($noDiscount)
 
 setQtyBackordered ($qtyBackordered)
 
 setQtyCanceled ($qtyCanceled)
 
 setQtyInvoiced ($qtyInvoiced)
 
 setQtyOrdered ($qtyOrdered)
 
 setQtyRefunded ($qtyRefunded)
 
 setQtyShipped ($qtyShipped)
 
 setBaseCost ($baseCost)
 
 setPrice ($price)
 
 setBasePrice ($price)
 
 setOriginalPrice ($price)
 
 setBaseOriginalPrice ($price)
 
 setTaxPercent ($taxPercent)
 
 setTaxAmount ($amount)
 
 setBaseTaxAmount ($amount)
 
 setTaxInvoiced ($taxInvoiced)
 
 setBaseTaxInvoiced ($baseTaxInvoiced)
 
 setDiscountPercent ($discountPercent)
 
 setDiscountAmount ($amount)
 
 setBaseDiscountAmount ($amount)
 
 setDiscountInvoiced ($discountInvoiced)
 
 setBaseDiscountInvoiced ($baseDiscountInvoiced)
 
 setAmountRefunded ($amountRefunded)
 
 setBaseAmountRefunded ($baseAmountRefunded)
 
 setRowTotal ($amount)
 
 setBaseRowTotal ($amount)
 
 setRowInvoiced ($rowInvoiced)
 
 setBaseRowInvoiced ($baseRowInvoiced)
 
 setRowWeight ($rowWeight)
 
 setBaseTaxBeforeDiscount ($baseTaxBeforeDiscount)
 
 setTaxBeforeDiscount ($taxBeforeDiscount)
 
 setExtOrderItemId ($id)
 
 setLockedDoInvoice ($flag)
 
 setLockedDoShip ($flag)
 
 setPriceInclTax ($amount)
 
 setBasePriceInclTax ($amount)
 
 setRowTotalInclTax ($amount)
 
 setBaseRowTotalInclTax ($amount)
 
 setDiscountTaxCompensationAmount ($amount)
 
 setBaseDiscountTaxCompensationAmount ($amount)
 
 setDiscountTaxCompensationInvoiced ($discountTaxCompensationInvoiced)
 
 setBaseDiscountTaxCompensationInvoiced ($baseDiscountTaxCompensationInvoiced)
 
 setDiscountTaxCompensationRefunded ($discountTaxCompensationRefunded)
 
 setBaseDiscountTaxCompensationRefunded ($baseDiscountTaxCompensationRefunded)
 
 setTaxCanceled ($taxCanceled)
 
 setDiscountTaxCompensationCanceled ($discountTaxCompensationCanceled)
 
 setTaxRefunded ($taxRefunded)
 
 setBaseTaxRefunded ($baseTaxRefunded)
 
 setDiscountRefunded ($discountRefunded)
 
 setBaseDiscountRefunded ($baseDiscountRefunded)
 
 setGwId ($id)
 
 setGwBasePrice ($price)
 
 setGwPrice ($price)
 
 setGwBaseTaxAmount ($amount)
 
 setGwTaxAmount ($amount)
 
 setGwBasePriceInvoiced ($gwBasePriceInvoiced)
 
 setGwPriceInvoiced ($gwPriceInvoiced)
 
 setGwBaseTaxAmountInvoiced ($gwBaseTaxAmountInvoiced)
 
 setGwTaxAmountInvoiced ($gwTaxAmountInvoiced)
 
 setGwBasePriceRefunded ($gwBasePriceRefunded)
 
 setGwPriceRefunded ($gwPriceRefunded)
 
 setGwBaseTaxAmountRefunded ($gwBaseTaxAmountRefunded)
 
 setGwTaxAmountRefunded ($gwTaxAmountRefunded)
 
 setFreeShipping ($freeShipping)
 
 setQtyReturned ($qtyReturned)
 
 setEventId ($id)
 
 setBaseWeeeTaxAppliedAmount ($amount)
 
 setBaseWeeeTaxAppliedRowAmnt ($amnt)
 
 setWeeeTaxAppliedAmount ($amount)
 
 setWeeeTaxAppliedRowAmount ($amount)
 
 setWeeeTaxApplied ($weeeTaxApplied)
 
 setWeeeTaxDisposition ($weeeTaxDisposition)
 
 setWeeeTaxRowDisposition ($weeeTaxRowDisposition)
 
 setBaseWeeeTaxDisposition ($baseWeeeTaxDisposition)
 
 setBaseWeeeTaxRowDisposition ($baseWeeeTaxRowDisposition)
 
 getProductOption ()
 
 setProductOption (\Magento\Catalog\Api\Data\ProductOptionInterface $productOption)
 
 getExtensionAttributes ()
 
 setExtensionAttributes (\Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes)
 
 isProcessingAvailable ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getEventObject ()
 
- Public Member Functions inherited from AbstractExtensibleModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getCustomAttributes ()
 
 getCustomAttribute ($attributeCode)
 
 setCustomAttributes (array $attributes)
 
 setCustomAttribute ($attributeCode, $attributeValue)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 setId ($value)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from OrderItemInterface
 setProductOption (\Magento\Catalog\Api\Data\ProductOptionInterface $productOption)
 
 setExtensionAttributes (\Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes)
 

Static Public Member Functions

static getStatusName ($statusId)
 
static getStatuses ()
 

Data Fields

const STATUS_PENDING = 1
 
const STATUS_SHIPPED = 2
 
const STATUS_INVOICED = 9
 
const STATUS_BACKORDERED = 3
 
const STATUS_CANCELED = 5
 
const STATUS_PARTIAL = 6
 
const STATUS_MIXED = 7
 
const STATUS_REFUNDED = 8
 
const STATUS_RETURNED = 4
 
- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Data Fields inherited from OrderItemInterface
const ITEM_ID = 'item_id'
 
const ORDER_ID = 'order_id'
 
const PARENT_ITEM_ID = 'parent_item_id'
 
const QUOTE_ITEM_ID = 'quote_item_id'
 
const STORE_ID = 'store_id'
 
const CREATED_AT = 'created_at'
 
const UPDATED_AT = 'updated_at'
 
const PRODUCT_ID = 'product_id'
 
const PRODUCT_TYPE = 'product_type'
 
const WEIGHT = 'weight'
 
const IS_VIRTUAL = 'is_virtual'
 
const SKU = 'sku'
 
const NAME = 'name'
 
const DESCRIPTION = 'description'
 
const APPLIED_RULE_IDS = 'applied_rule_ids'
 
const ADDITIONAL_DATA = 'additional_data'
 
const IS_QTY_DECIMAL = 'is_qty_decimal'
 
const NO_DISCOUNT = 'no_discount'
 
const QTY_BACKORDERED = 'qty_backordered'
 
const QTY_CANCELED = 'qty_canceled'
 
const QTY_INVOICED = 'qty_invoiced'
 
const QTY_ORDERED = 'qty_ordered'
 
const QTY_REFUNDED = 'qty_refunded'
 
const QTY_SHIPPED = 'qty_shipped'
 
const BASE_COST = 'base_cost'
 
const PRICE = 'price'
 
const BASE_PRICE = 'base_price'
 
const ORIGINAL_PRICE = 'original_price'
 
const BASE_ORIGINAL_PRICE = 'base_original_price'
 
const TAX_PERCENT = 'tax_percent'
 
const TAX_AMOUNT = 'tax_amount'
 
const BASE_TAX_AMOUNT = 'base_tax_amount'
 
const TAX_INVOICED = 'tax_invoiced'
 
const BASE_TAX_INVOICED = 'base_tax_invoiced'
 
const DISCOUNT_PERCENT = 'discount_percent'
 
const DISCOUNT_AMOUNT = 'discount_amount'
 
const BASE_DISCOUNT_AMOUNT = 'base_discount_amount'
 
const DISCOUNT_INVOICED = 'discount_invoiced'
 
const BASE_DISCOUNT_INVOICED = 'base_discount_invoiced'
 
const AMOUNT_REFUNDED = 'amount_refunded'
 
const BASE_AMOUNT_REFUNDED = 'base_amount_refunded'
 
const ROW_TOTAL = 'row_total'
 
const BASE_ROW_TOTAL = 'base_row_total'
 
const ROW_INVOICED = 'row_invoiced'
 
const BASE_ROW_INVOICED = 'base_row_invoiced'
 
const ROW_WEIGHT = 'row_weight'
 
const BASE_TAX_BEFORE_DISCOUNT = 'base_tax_before_discount'
 
const TAX_BEFORE_DISCOUNT = 'tax_before_discount'
 
const EXT_ORDER_ITEM_ID = 'ext_order_item_id'
 
const LOCKED_DO_INVOICE = 'locked_do_invoice'
 
const LOCKED_DO_SHIP = 'locked_do_ship'
 
const PRICE_INCL_TAX = 'price_incl_tax'
 
const BASE_PRICE_INCL_TAX = 'base_price_incl_tax'
 
const ROW_TOTAL_INCL_TAX = 'row_total_incl_tax'
 
const BASE_ROW_TOTAL_INCL_TAX = 'base_row_total_incl_tax'
 
const DISCOUNT_TAX_COMPENSATION_AMOUNT = 'discount_tax_compensation_amount'
 
const BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT = 'base_discount_tax_compensation_amount'
 
const DISCOUNT_TAX_COMPENSATION_INVOICED = 'discount_tax_compensation_invoiced'
 
const BASE_DISCOUNT_TAX_COMPENSATION_INVOICED = 'base_discount_tax_compensation_invoiced'
 
const DISCOUNT_TAX_COMPENSATION_REFUNDED = 'discount_tax_compensation_refunded'
 
const BASE_DISCOUNT_TAX_COMPENSATION_REFUNDED = 'base_discount_tax_compensation_refunded'
 
const TAX_CANCELED = 'tax_canceled'
 
const DISCOUNT_TAX_COMPENSATION_CANCELED = 'discount_tax_compensation_canceled'
 
const TAX_REFUNDED = 'tax_refunded'
 
const BASE_TAX_REFUNDED = 'base_tax_refunded'
 
const DISCOUNT_REFUNDED = 'discount_refunded'
 
const BASE_DISCOUNT_REFUNDED = 'base_discount_refunded'
 
const GW_ID = 'gw_id'
 
const GW_BASE_PRICE = 'gw_base_price'
 
const GW_PRICE = 'gw_price'
 
const GW_BASE_TAX_AMOUNT = 'gw_base_tax_amount'
 
const GW_TAX_AMOUNT = 'gw_tax_amount'
 
const GW_BASE_PRICE_INVOICED = 'gw_base_price_invoiced'
 
const GW_PRICE_INVOICED = 'gw_price_invoiced'
 
const GW_BASE_TAX_AMOUNT_INVOICED = 'gw_base_tax_amount_invoiced'
 
const GW_TAX_AMOUNT_INVOICED = 'gw_tax_amount_invoiced'
 
const GW_BASE_PRICE_REFUNDED = 'gw_base_price_refunded'
 
const GW_PRICE_REFUNDED = 'gw_price_refunded'
 
const GW_BASE_TAX_AMOUNT_REFUNDED = 'gw_base_tax_amount_refunded'
 
const GW_TAX_AMOUNT_REFUNDED = 'gw_tax_amount_refunded'
 
const FREE_SHIPPING = 'free_shipping'
 
const QTY_RETURNED = 'qty_returned'
 
const EVENT_ID = 'event_id'
 
const BASE_WEEE_TAX_APPLIED_AMOUNT = 'base_weee_tax_applied_amount'
 
const BASE_WEEE_TAX_APPLIED_ROW_AMNT = 'base_weee_tax_applied_row_amnt'
 
const WEEE_TAX_APPLIED_AMOUNT = 'weee_tax_applied_amount'
 
const WEEE_TAX_APPLIED_ROW_AMOUNT = 'weee_tax_applied_row_amount'
 
const WEEE_TAX_APPLIED = 'weee_tax_applied'
 
const WEEE_TAX_DISPOSITION = 'weee_tax_disposition'
 
const WEEE_TAX_ROW_DISPOSITION = 'weee_tax_row_disposition'
 
const BASE_WEEE_TAX_DISPOSITION = 'base_weee_tax_disposition'
 
const BASE_WEEE_TAX_ROW_DISPOSITION = 'base_weee_tax_row_disposition'
 
const PARENT_ITEM = 'parent_item'
 
const KEY_PRODUCT_OPTION = 'product_option'
 

Protected Member Functions

 _construct ()
 
 _getQtyChildrenBackordered ()
 
- Protected Member Functions inherited from AbstractExtensibleModel
 filterCustomAttributes ($data)
 
 initializeCustomAttributes ()
 
 convertCustomAttributeValues (array &$customAttributes)
 
 getCustomAttributesCodes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
 _getExtensionAttributes ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_eventPrefix = 'sales_order_item'
 
 $_eventObject = 'item'
 
 $_order = null
 
 $_children = []
 
 $_orderFactory
 
 $productRepository
 
 $_storeManager
 
- Protected Attributes inherited from AbstractExtensibleModel
 $extensionAttributesFactory
 
 $extensionAttributes
 
 $customAttributeFactory
 
 $customAttributesCodes = null
 
 $customAttributesChanged = false
 
- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Static Protected Attributes

static $_statuses = null
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Order Item Model

@api @method int getGiftMessageId() @method \Magento\Sales\Model\Order\Item setGiftMessageId(int $value) @method int getGiftMessageAvailable() @method \Magento\Sales\Model\Order\Item setGiftMessageAvailable(int $value) @SuppressWarnings(PHPMD.ExcessivePublicCount) @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @SuppressWarnings(PHPMD.CouplingBetweenObjects)

Since
100.0.2

Definition at line 25 of file Item.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\Model\Context  $context,
\Magento\Framework\Registry  $registry,
\Magento\Framework\Api\ExtensionAttributesFactory  $extensionFactory,
AttributeValueFactory  $customAttributeFactory,
\Magento\Sales\Model\OrderFactory  $orderFactory,
\Magento\Store\Model\StoreManagerInterface  $storeManager,
\Magento\Catalog\Api\ProductRepositoryInterface  $productRepository,
\Magento\Framework\Model\ResourceModel\AbstractResource  $resource = null,
\Magento\Framework\Data\Collection\AbstractDb  $resourceCollection = null,
array  $data = [],
\Magento\Framework\Serialize\Serializer\Json  $serializer = null 
)

Initialize dependencies.

Parameters
\Magento\Framework\Model\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\Api\ExtensionAttributesFactory$extensionFactory
AttributeValueFactory$customAttributeFactory
\Magento\Sales\Model\OrderFactory$orderFactory
\Magento\Store\Model\StoreManagerInterface$storeManager
\Magento\Catalog\Api\ProductRepositoryInterface$productRepository
\Magento\Framework\Model\ResourceModel\AbstractResource$resource
\Magento\Framework\Data\Collection\AbstractDb$resourceCollection
array$data
\Magento\Framework\Serialize\Serializer\Json | null$serializer@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 119 of file Item.php.

131  {
132  parent::__construct(
133  $context,
134  $registry,
135  $extensionFactory,
137  $resource,
138  $resourceCollection,
139  $data
140  );
142  ->get(\Magento\Framework\Serialize\Serializer\Json::class);
143  $this->_orderFactory = $orderFactory;
144  $this->_storeManager = $storeManager;
145  $this->productRepository = $productRepository;
146  }
$storeManager
$resource
Definition: bulk.php:12

Member Function Documentation

◆ _construct()

_construct ( )
protected

Init resource model

Returns
void

Definition at line 153 of file Item.php.

154  {
155  $this->_init(\Magento\Sales\Model\ResourceModel\Order\Item::class);
156  }

◆ _getQtyChildrenBackordered()

_getQtyChildrenBackordered ( )
protected

Retrieve backordered qty of children items

Returns
float|null

Definition at line 363 of file Item.php.

364  {
365  $backordered = null;
366  foreach ($this->_children as $childItem) {
367  $backordered += (double)$childItem->getQtyBackordered();
368  }
369 
370  return $backordered;
371  }

◆ addChildItem()

addChildItem (   $item)

Adds child item to this item

Parameters
Item$item
Returns
void

Definition at line 524 of file Item.php.

525  {
526  if ($item instanceof \Magento\Sales\Model\Order\Item) {
527  $this->_children[] = $item;
528  } elseif (is_array($item)) {
529  $this->_children = array_merge($this->_children, $item);
530  }
531  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ cancel()

cancel ( )

Cancel order item

Returns
$this

Definition at line 405 of file Item.php.

406  {
407  if ($this->getStatusId() !== self::STATUS_CANCELED) {
408  $this->_eventManager->dispatch('sales_order_item_cancel', ['item' => $this]);
409  $this->setQtyCanceled($this->getQtyToCancel());
410  $this->setTaxCanceled(
411  $this->getTaxCanceled() + $this->getBaseTaxAmount() * $this->getQtyCanceled() / $this->getQtyOrdered()
412  );
415  $this->getDiscountTaxCompensationAmount() * $this->getQtyCanceled() / $this->getQtyOrdered()
416  );
417  }
418  return $this;
419  }
setDiscountTaxCompensationCanceled($discountTaxCompensationCanceled)
Definition: Item.php:2120
setQtyCanceled($qtyCanceled)
Definition: Item.php:1770
setTaxCanceled($taxCanceled)
Definition: Item.php:2112

◆ canInvoice()

canInvoice ( )

Check item invoice availability

Returns
bool

Definition at line 189 of file Item.php.

190  {
191  return $this->getQtyToInvoice() > 0;
192  }

◆ canRefund()

canRefund ( )

Check item refund availability

Returns
bool

Definition at line 209 of file Item.php.

210  {
211  return $this->getQtyToRefund() > 0;
212  }

◆ canShip()

canShip ( )

Check item ship availability

Returns
bool

Definition at line 199 of file Item.php.

200  {
201  return $this->getQtyToShip() > 0;
202  }

◆ getAdditionalData()

getAdditionalData ( )

Return additional_data

Returns
string|null

Implements OrderItemInterface.

Definition at line 710 of file Item.php.

◆ getAmountRefunded()

getAmountRefunded ( )

Return amount_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 720 of file Item.php.

◆ getAppliedRuleIds()

getAppliedRuleIds ( )

Return applied_rule_ids

Returns
string|null

Implements OrderItemInterface.

Definition at line 730 of file Item.php.

◆ getBaseAmountRefunded()

getBaseAmountRefunded ( )

Return base_amount_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 740 of file Item.php.

◆ getBaseCost()

getBaseCost ( )

Return base_cost

Returns
float|null

Implements OrderItemInterface.

Definition at line 750 of file Item.php.

◆ getBaseDiscountAmount()

getBaseDiscountAmount ( )

Return base_discount_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 760 of file Item.php.

◆ getBaseDiscountInvoiced()

getBaseDiscountInvoiced ( )

Return base_discount_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 770 of file Item.php.

◆ getBaseDiscountRefunded()

getBaseDiscountRefunded ( )

Return base_discount_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 780 of file Item.php.

◆ getBaseDiscountTaxCompensationAmount()

getBaseDiscountTaxCompensationAmount ( )

Return base_discount_tax_compensation_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 790 of file Item.php.

◆ getBaseDiscountTaxCompensationInvoiced()

getBaseDiscountTaxCompensationInvoiced ( )

Return base_discount_tax_compensation_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 800 of file Item.php.

◆ getBaseDiscountTaxCompensationRefunded()

getBaseDiscountTaxCompensationRefunded ( )

Return base_discount_tax_compensation_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 810 of file Item.php.

◆ getBaseOriginalPrice()

getBaseOriginalPrice ( )

Return base_original_price

Returns
float|null

Implements OrderItemInterface.

Definition at line 820 of file Item.php.

◆ getBasePrice()

getBasePrice ( )

Return base_price

Returns
float|null

Implements OrderItemInterface.

Definition at line 830 of file Item.php.

◆ getBasePriceInclTax()

getBasePriceInclTax ( )

Return base_price_incl_tax

Returns
float|null

Implements OrderItemInterface.

Definition at line 840 of file Item.php.

◆ getBaseRowInvoiced()

getBaseRowInvoiced ( )

Return base_row_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 850 of file Item.php.

◆ getBaseRowTotal()

getBaseRowTotal ( )

Return base_row_total

Returns
float|null

Implements OrderItemInterface.

Definition at line 860 of file Item.php.

◆ getBaseRowTotalInclTax()

getBaseRowTotalInclTax ( )

Return base_row_total_incl_tax

Returns
float|null

Implements OrderItemInterface.

Definition at line 870 of file Item.php.

◆ getBaseTaxAmount()

getBaseTaxAmount ( )

Return base_tax_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 880 of file Item.php.

◆ getBaseTaxBeforeDiscount()

getBaseTaxBeforeDiscount ( )

Return base_tax_before_discount

Returns
float|null

Implements OrderItemInterface.

Definition at line 890 of file Item.php.

◆ getBaseTaxInvoiced()

getBaseTaxInvoiced ( )

Return base_tax_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 900 of file Item.php.

◆ getBaseTaxRefunded()

getBaseTaxRefunded ( )

Return base_tax_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 910 of file Item.php.

◆ getBaseWeeeTaxAppliedAmount()

getBaseWeeeTaxAppliedAmount ( )

Return base_weee_tax_applied_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 920 of file Item.php.

◆ getBaseWeeeTaxAppliedRowAmnt()

getBaseWeeeTaxAppliedRowAmnt ( )

Return base_weee_tax_applied_row_amnt

Returns
float|null

Implements OrderItemInterface.

Definition at line 930 of file Item.php.

◆ getBaseWeeeTaxDisposition()

getBaseWeeeTaxDisposition ( )

Return base_weee_tax_disposition

Returns
float|null

Implements OrderItemInterface.

Definition at line 940 of file Item.php.

◆ getBaseWeeeTaxRowDisposition()

getBaseWeeeTaxRowDisposition ( )

Return base_weee_tax_row_disposition

Returns
float|null

Implements OrderItemInterface.

Definition at line 950 of file Item.php.

◆ getBuyRequest()

getBuyRequest ( )

Return formatted buy request.

This object is holding request received from product view page with keys and options for configured product.

Returns
\Magento\Framework\DataObject

Definition at line 660 of file Item.php.

661  {
662  $option = $this->getProductOptionByCode('info_buyRequest');
663  if (!$option) {
664  $option = [];
665  }
666  $buyRequest = new \Magento\Framework\DataObject($option);
667  $buyRequest->setQty($this->getQtyOrdered() * 1);
668  return $buyRequest;
669  }
getProductOptionByCode($code=null)
Definition: Item.php:492
foreach($product->getExtensionAttributes() ->getBundleProductOptions() as $option) $buyRequest

◆ getChildrenItems()

getChildrenItems ( )

Return children items of this item

Returns
array

Definition at line 538 of file Item.php.

539  {
540  return $this->_children;
541  }

◆ getCreatedAt()

getCreatedAt ( )

Return created_at

Returns
string|null

Implements OrderItemInterface.

Definition at line 960 of file Item.php.

◆ getDescription()

getDescription ( )

Return description

Returns
string|null

Implements OrderItemInterface.

Definition at line 978 of file Item.php.

◆ getDiscountAmount()

getDiscountAmount ( )

Return discount_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 988 of file Item.php.

◆ getDiscountInvoiced()

getDiscountInvoiced ( )

Return discount_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 998 of file Item.php.

◆ getDiscountPercent()

getDiscountPercent ( )

Return discount_percent

Returns
float|null

Implements OrderItemInterface.

Definition at line 1008 of file Item.php.

◆ getDiscountRefunded()

getDiscountRefunded ( )

Return discount_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1018 of file Item.php.

◆ getDiscountTaxCompensationAmount()

getDiscountTaxCompensationAmount ( )

Return discount_tax_compensation_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1188 of file Item.php.

◆ getDiscountTaxCompensationCanceled()

getDiscountTaxCompensationCanceled ( )

Return discount_tax_compensation_canceled

Returns
float|null

Implements OrderItemInterface.

Definition at line 1198 of file Item.php.

◆ getDiscountTaxCompensationInvoiced()

getDiscountTaxCompensationInvoiced ( )

Return discount_tax_compensation_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1208 of file Item.php.

◆ getDiscountTaxCompensationRefunded()

getDiscountTaxCompensationRefunded ( )

Return discount_tax_compensation_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1218 of file Item.php.

◆ getEventId()

getEventId ( )

Return event_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1028 of file Item.php.

◆ getExtensionAttributes()

getExtensionAttributes ( )

Retrieve existing extension attributes object or create a new one.

Returns
\Magento\Sales\Api\Data\OrderItemExtensionInterface|null

Returns
\Magento\Sales\Api\Data\OrderItemExtensionInterface|null

Implements OrderItemInterface.

Definition at line 2378 of file Item.php.

◆ getExtOrderItemId()

getExtOrderItemId ( )

Return ext_order_item_id

Returns
string|null

Implements OrderItemInterface.

Definition at line 1038 of file Item.php.

◆ getForceApplyDiscountToParentItem()

getForceApplyDiscountToParentItem ( )

Check if discount has to be applied to parent item

Returns
bool @SuppressWarnings(PHPMD.BooleanGetMethodName)

Definition at line 572 of file Item.php.

573  {
574  if ($this->getParentItem()) {
575  $product = $this->getParentItem()->getProduct();
576  } else {
577  $product = $this->getProduct();
578  }
579 
580  return $product->getTypeInstance()->getForceApplyDiscountToParentItem();
581  }

◆ getFreeShipping()

getFreeShipping ( )

Return free_shipping

Returns
int|null

Implements OrderItemInterface.

Definition at line 1048 of file Item.php.

◆ getGwBasePrice()

getGwBasePrice ( )

Return gw_base_price

Returns
float|null

Implements OrderItemInterface.

Definition at line 1058 of file Item.php.

◆ getGwBasePriceInvoiced()

getGwBasePriceInvoiced ( )

Return gw_base_price_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1068 of file Item.php.

◆ getGwBasePriceRefunded()

getGwBasePriceRefunded ( )

Return gw_base_price_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1078 of file Item.php.

◆ getGwBaseTaxAmount()

getGwBaseTaxAmount ( )

Return gw_base_tax_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1088 of file Item.php.

◆ getGwBaseTaxAmountInvoiced()

getGwBaseTaxAmountInvoiced ( )

Return gw_base_tax_amount_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1098 of file Item.php.

◆ getGwBaseTaxAmountRefunded()

getGwBaseTaxAmountRefunded ( )

Return gw_base_tax_amount_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1108 of file Item.php.

◆ getGwId()

getGwId ( )

Return gw_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1118 of file Item.php.

◆ getGwPrice()

getGwPrice ( )

Return gw_price

Returns
float|null

Implements OrderItemInterface.

Definition at line 1128 of file Item.php.

◆ getGwPriceInvoiced()

getGwPriceInvoiced ( )

Return gw_price_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1138 of file Item.php.

◆ getGwPriceRefunded()

getGwPriceRefunded ( )

Return gw_price_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1148 of file Item.php.

◆ getGwTaxAmount()

getGwTaxAmount ( )

Return gw_tax_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1158 of file Item.php.

◆ getGwTaxAmountInvoiced()

getGwTaxAmountInvoiced ( )

Return gw_tax_amount_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1168 of file Item.php.

◆ getGwTaxAmountRefunded()

getGwTaxAmountRefunded ( )

Return gw_tax_amount_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1178 of file Item.php.

◆ getIsQtyDecimal()

getIsQtyDecimal ( )

Return is_qty_decimal

Returns
int|null

Implements OrderItemInterface.

Definition at line 1228 of file Item.php.

◆ getIsVirtual()

getIsVirtual ( )

Return is_virtual

Returns
int|null

Implements OrderItemInterface.

Definition at line 1238 of file Item.php.

◆ getItemId()

getItemId ( )

Return item_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1248 of file Item.php.

◆ getLockedDoInvoice()

getLockedDoInvoice ( )

Return locked_do_invoice

Returns
int|null

Implements OrderItemInterface.

Definition at line 1258 of file Item.php.

◆ getLockedDoShip()

getLockedDoShip ( )

Return locked_do_ship

Returns
int|null

Implements OrderItemInterface.

Definition at line 1268 of file Item.php.

◆ getName()

getName ( )

Return name

Returns
string|null

Implements OrderItemInterface.

Definition at line 1278 of file Item.php.

◆ getNoDiscount()

getNoDiscount ( )

Return no_discount

Returns
int|null

Implements OrderItemInterface.

Definition at line 1288 of file Item.php.

◆ getOrder()

getOrder ( )

Retrieve order model object

Returns
\Magento\Sales\Model\Order

Definition at line 297 of file Item.php.

298  {
299  if ($this->_order === null && ($orderId = $this->getOrderId())) {
300  $order = $this->_orderFactory->create();
301  $order->load($orderId);
302  $this->setOrder($order);
303  }
304  return $this->_order;
305  }
$order
Definition: order.php:55
setOrder(\Magento\Sales\Model\Order $order)
Definition: Item.php:285

◆ getOrderId()

getOrderId ( )

Return order_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1298 of file Item.php.

◆ getOriginalPrice()

getOriginalPrice ( )

Redeclare getter for back compatibility

Returns
float|null

Implements OrderItemInterface.

Definition at line 449 of file Item.php.

450  {
452  if ($price === null) {
453  return $this->getPrice();
454  }
455  return $price;
456  }
$price

◆ getParentItem()

getParentItem ( )

Get parent item

Returns
OrderItemInterface|null

Implements OrderItemInterface.

Definition at line 179 of file Item.php.

◆ getParentItemId()

getParentItemId ( )

Return parent_item_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1308 of file Item.php.

◆ getPrice()

getPrice ( )

Return price

Returns
float|null

Implements OrderItemInterface.

Definition at line 1318 of file Item.php.

◆ getPriceInclTax()

getPriceInclTax ( )

Return price_incl_tax

Returns
float|null

Implements OrderItemInterface.

Definition at line 1328 of file Item.php.

◆ getProduct()

getProduct ( )

Retrieve product

Returns
\Magento\Catalog\Model\Product|null

Definition at line 676 of file Item.php.

677  {
678  if (!$this->hasData('product')) {
679  try {
680  $product = $this->productRepository->getById($this->getProductId());
681  } catch (\Magento\Framework\Exception\NoSuchEntityException $noEntityException) {
682  $product = null;
683  }
684  $this->setProduct($product);
685  }
686  return $this->getData('product');
687  }

◆ getProductId()

getProductId ( )

Return product_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1338 of file Item.php.

◆ getProductOption()

getProductOption ( )

Returns product option

Returns
\Magento\Catalog\Api\Data\ProductOptionInterface|null

Implements OrderItemInterface.

Definition at line 2360 of file Item.php.

2361  {
2362  return $this->getData(self::KEY_PRODUCT_OPTION);
2363  }

◆ getProductOptionByCode()

getProductOptionByCode (   $code = null)

Get product options array by code.

If code is null return all options

Parameters
string$code
Returns
array

Definition at line 492 of file Item.php.

493  {
494  $options = $this->getProductOptions();
495  if ($code === null) {
496  return $options;
497  }
498  if (isset($options[$code])) {
499  return $options[$code];
500  }
501  return null;
502  }
$code
Definition: info.phtml:12

◆ getProductOptions()

getProductOptions ( )

Get product options array

Returns
array

Definition at line 475 of file Item.php.

476  {
477  $data = $this->_getData('product_options');
478  if (is_string($data)) {
479  $data = $this->serializer->unserialize($data);
480  }
481  return $data;
482  }

◆ getProductType()

getProductType ( )

Return product_type

Returns
string|null

Implements OrderItemInterface.

Definition at line 1348 of file Item.php.

◆ getQtyBackordered()

getQtyBackordered ( )

Return qty_backordered

Returns
float|null

Implements OrderItemInterface.

Definition at line 1358 of file Item.php.

◆ getQtyCanceled()

getQtyCanceled ( )

Return qty_canceled

Returns
float|null

Implements OrderItemInterface.

Definition at line 1368 of file Item.php.

◆ getQtyInvoiced()

getQtyInvoiced ( )

Return qty_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1378 of file Item.php.

◆ getQtyOrdered()

getQtyOrdered ( )

Return qty_ordered

Returns
float|null

Implements OrderItemInterface.

Definition at line 1388 of file Item.php.

◆ getQtyRefunded()

getQtyRefunded ( )

Return qty_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1398 of file Item.php.

◆ getQtyReturned()

getQtyReturned ( )

Return qty_returned

Returns
float|null

Implements OrderItemInterface.

Definition at line 1408 of file Item.php.

◆ getQtyShipped()

getQtyShipped ( )

Return qty_shipped

Returns
float|null

Implements OrderItemInterface.

Definition at line 1418 of file Item.php.

◆ getQtyToCancel()

getQtyToCancel ( )

Retrieve item qty available for cancel

Returns
float|integer

Definition at line 273 of file Item.php.

274  {
275  $qtyToCancel = min($this->getQtyToInvoice(), $this->getQtyToShip());
276  return max($qtyToCancel, 0);
277  }

◆ getQtyToInvoice()

getQtyToInvoice ( )

Retrieve item qty available for invoice

Returns
float|integer

Definition at line 244 of file Item.php.

245  {
246  if ($this->isDummy()) {
247  return 0;
248  }
249 
250  $qty = $this->getQtyOrdered() - $this->getQtyInvoiced() - $this->getQtyCanceled();
251  return max(round($qty, 8), 0);
252  }
isDummy($shipment=false)
Definition: Item.php:615

◆ getQtyToRefund()

getQtyToRefund ( )

Retrieve item qty available for refund

Returns
float|integer

Definition at line 259 of file Item.php.

260  {
261  if ($this->isDummy()) {
262  return 0;
263  }
264 
265  return max($this->getQtyInvoiced() - $this->getQtyRefunded(), 0);
266  }
isDummy($shipment=false)
Definition: Item.php:615

◆ getQtyToShip()

getQtyToShip ( )

Retrieve item qty available for ship

Returns
float|integer

Definition at line 219 of file Item.php.

220  {
221  if ($this->isDummy(true)) {
222  return 0;
223  }
224 
225  return $this->getSimpleQtyToShip();
226  }
isDummy($shipment=false)
Definition: Item.php:615

◆ getQuoteItemId()

getQuoteItemId ( )

Return quote_item_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1428 of file Item.php.

◆ getRealProductType()

getRealProductType ( )

Return real product type of item or NULL if item is not composite

Returns
string | null

Definition at line 509 of file Item.php.

510  {
511  $productType = $this->getProductOptionByCode('real_product_type');
512  if ($productType) {
513  return $productType;
514  }
515  return null;
516  }
getProductOptionByCode($code=null)
Definition: Item.php:492

◆ getRowInvoiced()

getRowInvoiced ( )

Return row_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1438 of file Item.php.

◆ getRowTotal()

getRowTotal ( )

Return row_total

Returns
float|null

Implements OrderItemInterface.

Definition at line 1448 of file Item.php.

◆ getRowTotalInclTax()

getRowTotalInclTax ( )

Return row_total_incl_tax

Returns
float|null

Implements OrderItemInterface.

Definition at line 1458 of file Item.php.

◆ getRowWeight()

getRowWeight ( )

Return row_weight

Returns
float|null

Implements OrderItemInterface.

Definition at line 1468 of file Item.php.

◆ getSimpleQtyToShip()

getSimpleQtyToShip ( )

Retrieve item qty available for ship

Returns
float|integer

Definition at line 233 of file Item.php.

234  {
235  $qty = $this->getQtyOrdered() - $this->getQtyShipped() - $this->getQtyRefunded() - $this->getQtyCanceled();
236  return max(round($qty, 8), 0);
237  }

◆ getSku()

getSku ( )

Return sku

Returns
string

Implements OrderItemInterface.

Definition at line 1478 of file Item.php.

◆ getStatus()

getStatus ( )

Retrieve status

Returns
string

Definition at line 378 of file Item.php.

379  {
380  return $this->getStatusName($this->getStatusId());
381  }
static getStatusName($statusId)
Definition: Item.php:389

◆ getStatuses()

static getStatuses ( )
static

Retrieve order item statuses array

Returns
array

Definition at line 426 of file Item.php.

427  {
428  if (self::$_statuses === null) {
429  self::$_statuses = [
430  self::STATUS_PENDING => __('Ordered'),
431  self::STATUS_SHIPPED => __('Shipped'),
432  self::STATUS_INVOICED => __('Invoiced'),
433  self::STATUS_BACKORDERED => __('Backordered'),
434  self::STATUS_RETURNED => __('Returned'),
435  self::STATUS_REFUNDED => __('Refunded'),
436  self::STATUS_CANCELED => __('Canceled'),
437  self::STATUS_PARTIAL => __('Partial'),
438  self::STATUS_MIXED => __('Mixed'),
439  ];
440  }
441  return self::$_statuses;
442  }
__()
Definition: __.php:13

◆ getStatusId()

getStatusId ( )

Retrieve item status identifier

Returns
int @SuppressWarnings(PHPMD.CyclomaticComplexity) @SuppressWarnings(PHPMD.NPathComplexity)

Definition at line 314 of file Item.php.

315  {
316  $backordered = (double)$this->getQtyBackordered();
317  if (!$backordered && $this->getHasChildren()) {
318  $backordered = (double)$this->_getQtyChildrenBackordered();
319  }
320  $canceled = (double)$this->getQtyCanceled();
321  $invoiced = (double)$this->getQtyInvoiced();
322  $ordered = (double)$this->getQtyOrdered();
323  $refunded = (double)$this->getQtyRefunded();
324  $shipped = (double)$this->getQtyShipped();
325 
326  $actuallyOrdered = $ordered - $canceled - $refunded;
327 
328  if (!$invoiced && !$shipped && !$refunded && !$canceled && !$backordered) {
329  return self::STATUS_PENDING;
330  }
331  if ($shipped && $invoiced && $actuallyOrdered == $shipped) {
332  return self::STATUS_SHIPPED;
333  }
334 
335  if ($invoiced && !$shipped && $actuallyOrdered == $invoiced) {
336  return self::STATUS_INVOICED;
337  }
338 
339  if ($backordered && $actuallyOrdered == $backordered) {
341  }
342 
343  if ($refunded && $ordered == $refunded) {
344  return self::STATUS_REFUNDED;
345  }
346 
347  if ($canceled && $ordered == $canceled) {
348  return self::STATUS_CANCELED;
349  }
350 
351  if (max($shipped, $invoiced) < $actuallyOrdered) {
352  return self::STATUS_PARTIAL;
353  }
354 
355  return self::STATUS_MIXED;
356  }

◆ getStatusName()

static getStatusName (   $statusId)
static

Retrieve status name

Parameters
string$statusId
Returns
\Magento\Framework\Phrase

Definition at line 389 of file Item.php.

390  {
391  if (self::$_statuses === null) {
393  }
394  if (isset(self::$_statuses[$statusId])) {
395  return self::$_statuses[$statusId];
396  }
397  return __('Unknown Status');
398  }
__()
Definition: __.php:13

◆ getStore()

getStore ( )

Retrieve store model instance

Returns
\Magento\Store\Model\Store

Definition at line 694 of file Item.php.

695  {
696  $storeId = $this->getStoreId();
697  if ($storeId) {
698  return $this->_storeManager->getStore($storeId);
699  }
700  return $this->_storeManager->getStore();
701  }

◆ getStoreId()

getStoreId ( )

Return store_id

Returns
int|null

Implements OrderItemInterface.

Definition at line 1488 of file Item.php.

◆ getTaxAmount()

getTaxAmount ( )

Return tax_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1498 of file Item.php.

◆ getTaxBeforeDiscount()

getTaxBeforeDiscount ( )

Return tax_before_discount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1508 of file Item.php.

◆ getTaxCanceled()

getTaxCanceled ( )

Return tax_canceled

Returns
float|null

Implements OrderItemInterface.

Definition at line 1518 of file Item.php.

◆ getTaxInvoiced()

getTaxInvoiced ( )

Return tax_invoiced

Returns
float|null

Implements OrderItemInterface.

Definition at line 1528 of file Item.php.

◆ getTaxPercent()

getTaxPercent ( )

Return tax_percent

Returns
float|null

Implements OrderItemInterface.

Definition at line 1538 of file Item.php.

◆ getTaxRefunded()

getTaxRefunded ( )

Return tax_refunded

Returns
float|null

Implements OrderItemInterface.

Definition at line 1548 of file Item.php.

◆ getUpdatedAt()

getUpdatedAt ( )

Return updated_at

Returns
string|null

Implements OrderItemInterface.

Definition at line 1558 of file Item.php.

◆ getWeeeTaxApplied()

getWeeeTaxApplied ( )

Return weee_tax_applied

Returns
string|null

Implements OrderItemInterface.

Definition at line 1568 of file Item.php.

◆ getWeeeTaxAppliedAmount()

getWeeeTaxAppliedAmount ( )

Return weee_tax_applied_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1578 of file Item.php.

◆ getWeeeTaxAppliedRowAmount()

getWeeeTaxAppliedRowAmount ( )

Return weee_tax_applied_row_amount

Returns
float|null

Implements OrderItemInterface.

Definition at line 1588 of file Item.php.

◆ getWeeeTaxDisposition()

getWeeeTaxDisposition ( )

Return weee_tax_disposition

Returns
float|null

Implements OrderItemInterface.

Definition at line 1598 of file Item.php.

◆ getWeeeTaxRowDisposition()

getWeeeTaxRowDisposition ( )

Return weee_tax_row_disposition

Returns
float|null

Implements OrderItemInterface.

Definition at line 1608 of file Item.php.

◆ getWeight()

getWeight ( )

Return weight

Returns
float|null

Implements OrderItemInterface.

Definition at line 1618 of file Item.php.

◆ isChildrenCalculated()

isChildrenCalculated ( )

Return checking of what calculation type was for this product

Returns
bool

Definition at line 548 of file Item.php.

549  {
550  $parentItem = $this->getParentItem();
551  if ($parentItem) {
552  $options = $parentItem->getProductOptions();
553  } else {
554  $options = $this->getProductOptions();
555  }
556 
557  if (isset(
558  $options['product_calculations']
559  ) && $options['product_calculations'] == \Magento\Catalog\Model\Product\Type\AbstractType::CALCULATE_CHILD
560  ) {
561  return true;
562  }
563  return false;
564  }

◆ isDummy()

isDummy (   $shipment = false)

This is Dummy item or not.

If $shipment is true then we checking this for shipping situation if not, we checking this for calculation.

Parameters
bool$shipment
Returns
bool @SuppressWarnings(PHPMD.CyclomaticComplexity)

Definition at line 615 of file Item.php.

616  {
617  if ($shipment) {
618  if ($this->getHasChildren() && $this->isShipSeparately()) {
619  return true;
620  }
621 
622  if ($this->getHasChildren() && !$this->isShipSeparately()) {
623  return false;
624  }
625 
626  if ($this->getParentItem() && $this->isShipSeparately()) {
627  return false;
628  }
629 
630  if ($this->getParentItem() && !$this->isShipSeparately()) {
631  return true;
632  }
633  } else {
634  if ($this->getHasChildren() && $this->isChildrenCalculated()) {
635  return true;
636  }
637 
638  if ($this->getHasChildren() && !$this->isChildrenCalculated()) {
639  return false;
640  }
641 
642  if ($this->getParentItem() && $this->isChildrenCalculated()) {
643  return false;
644  }
645 
646  if ($this->getParentItem() && !$this->isChildrenCalculated()) {
647  return true;
648  }
649  }
650  return false;
651  }
foreach($order->getItems() as $orderItem) $shipment

◆ isProcessingAvailable()

isProcessingAvailable ( )

Check if it is possible to process item after cancellation

Returns
bool
Since
101.0.0

Definition at line 2402 of file Item.php.

2403  {
2404  return $this->getQtyToShip() > $this->getQtyToCancel();
2405  }

◆ isShipSeparately()

isShipSeparately ( )

Return checking of what shipment type was for this product

Returns
bool

Definition at line 588 of file Item.php.

589  {
590  $parentItem = $this->getParentItem();
591  if ($parentItem) {
592  $options = $parentItem->getProductOptions();
593  } else {
594  $options = $this->getProductOptions();
595  }
596 
597  if (isset(
598  $options['shipment_type']
599  ) && $options['shipment_type'] == \Magento\Catalog\Model\Product\Type\AbstractType::SHIPMENT_SEPARATELY
600  ) {
601  return true;
602  }
603  return false;
604  }

◆ setAdditionalData()

setAdditionalData (   $additionalData)

Sets the additional data for the order item.

Parameters
string$additionalData
Returns
$this

Implements OrderItemInterface.

Definition at line 1738 of file Item.php.

◆ setAmountRefunded()

setAmountRefunded (   $amountRefunded)

Sets the amount refunded for the order item.

Parameters
float$amountRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 1930 of file Item.php.

◆ setAppliedRuleIds()

setAppliedRuleIds (   $appliedRuleIds)

Sets the applied rule IDs for the order item.

Parameters
string$appliedRuleIds
Returns
$this

Implements OrderItemInterface.

Definition at line 1730 of file Item.php.

◆ setBaseAmountRefunded()

setBaseAmountRefunded (   $baseAmountRefunded)

Sets the base amount refunded for the order item.

Parameters
float$baseAmountRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 1938 of file Item.php.

◆ setBaseCost()

setBaseCost (   $baseCost)

Sets the base cost for the order item.

Parameters
float$baseCost
Returns
$this

Implements OrderItemInterface.

Definition at line 1810 of file Item.php.

◆ setBaseDiscountAmount()

setBaseDiscountAmount (   $amount)

Sets the base discount amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 1906 of file Item.php.

◆ setBaseDiscountInvoiced()

setBaseDiscountInvoiced (   $baseDiscountInvoiced)

Sets the base discount invoiced for the order item.

Parameters
float$baseDiscountInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1922 of file Item.php.

◆ setBaseDiscountRefunded()

setBaseDiscountRefunded (   $baseDiscountRefunded)

Sets the base discount refunded for the order item.

Parameters
float$baseDiscountRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2152 of file Item.php.

◆ setBaseDiscountTaxCompensationAmount()

setBaseDiscountTaxCompensationAmount (   $amount)

Sets the base discount tax compensation amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2066 of file Item.php.

◆ setBaseDiscountTaxCompensationInvoiced()

setBaseDiscountTaxCompensationInvoiced (   $baseDiscountTaxCompensationInvoiced)

Sets the base discount tax compensation invoiced for the order item.

Parameters
float$baseDiscountTaxCompensationInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 2082 of file Item.php.

2083  {
2084  return $this->setData(
2086  $baseDiscountTaxCompensationInvoiced
2087  );
2088  }

◆ setBaseDiscountTaxCompensationRefunded()

setBaseDiscountTaxCompensationRefunded (   $baseDiscountTaxCompensationRefunded)

Sets the base discount tax compensation refunded for the order item.

Parameters
float$baseDiscountTaxCompensationRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2101 of file Item.php.

2102  {
2103  return $this->setData(
2105  $baseDiscountTaxCompensationRefunded
2106  );
2107  }

◆ setBaseOriginalPrice()

setBaseOriginalPrice (   $price)

Sets the base original price for the order item.

Parameters
float$price
Returns
$this

Implements OrderItemInterface.

Definition at line 1842 of file Item.php.

◆ setBasePrice()

setBasePrice (   $price)

Sets the base price for the order item.

Parameters
float$price
Returns
$this

Implements OrderItemInterface.

Definition at line 1826 of file Item.php.

◆ setBasePriceInclTax()

setBasePriceInclTax (   $amount)

Sets the base price including tax for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2034 of file Item.php.

◆ setBaseRowInvoiced()

setBaseRowInvoiced (   $baseRowInvoiced)

Sets the base row invoiced for the order item.

Parameters
float$baseRowInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1970 of file Item.php.

◆ setBaseRowTotal()

setBaseRowTotal (   $amount)

Sets the base row total for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 1954 of file Item.php.

◆ setBaseRowTotalInclTax()

setBaseRowTotalInclTax (   $amount)

Sets the base row total including tax for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2050 of file Item.php.

◆ setBaseTaxAmount()

setBaseTaxAmount (   $amount)

Sets the base tax amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 1866 of file Item.php.

◆ setBaseTaxBeforeDiscount()

setBaseTaxBeforeDiscount (   $baseTaxBeforeDiscount)

Sets the base tax before discount for the order item.

Parameters
float$baseTaxBeforeDiscount
Returns
$this

Implements OrderItemInterface.

Definition at line 1986 of file Item.php.

◆ setBaseTaxInvoiced()

setBaseTaxInvoiced (   $baseTaxInvoiced)

Sets the base tax invoiced for the order item.

Parameters
float$baseTaxInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1882 of file Item.php.

◆ setBaseTaxRefunded()

setBaseTaxRefunded (   $baseTaxRefunded)

Sets the base tax refunded for the order item.

Parameters
float$baseTaxRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2136 of file Item.php.

◆ setBaseWeeeTaxAppliedAmount()

setBaseWeeeTaxAppliedAmount (   $amount)

Sets the base WEEE tax applied amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2288 of file Item.php.

◆ setBaseWeeeTaxAppliedRowAmnt()

setBaseWeeeTaxAppliedRowAmnt (   $amnt)

Sets the base WEEE tax applied row amount for the order item.

Parameters
float$amnt
Returns
$this

Implements OrderItemInterface.

Definition at line 2296 of file Item.php.

◆ setBaseWeeeTaxDisposition()

setBaseWeeeTaxDisposition (   $baseWeeeTaxDisposition)

Sets the base WEEE tax disposition for the order item.

Parameters
float$baseWeeeTaxDisposition
Returns
$this

Implements OrderItemInterface.

Definition at line 2344 of file Item.php.

◆ setBaseWeeeTaxRowDisposition()

setBaseWeeeTaxRowDisposition (   $baseWeeeTaxRowDisposition)

Sets the base WEEE tax row disposition for the order item.

Parameters
float$baseWeeeTaxRowDisposition
Returns
$this

Implements OrderItemInterface.

Definition at line 2352 of file Item.php.

◆ setCreatedAt()

setCreatedAt (   $createdAt)

Sets the created-at timestamp for the order item.

Parameters
string$createdAttimestamp
Returns
$this

Implements OrderItemInterface.

Definition at line 968 of file Item.php.

◆ setDescription()

setDescription (   $description)

Sets the description for the order item.

Parameters
string$description
Returns
$this

Implements OrderItemInterface.

Definition at line 1722 of file Item.php.

◆ setDiscountAmount()

setDiscountAmount (   $amount)

Sets the discount amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 1898 of file Item.php.

◆ setDiscountInvoiced()

setDiscountInvoiced (   $discountInvoiced)

Sets the discount invoiced for the order item.

Parameters
float$discountInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1914 of file Item.php.

◆ setDiscountPercent()

setDiscountPercent (   $discountPercent)

Sets the discount percent for the order item.

Parameters
float$discountPercent
Returns
$this

Implements OrderItemInterface.

Definition at line 1890 of file Item.php.

◆ setDiscountRefunded()

setDiscountRefunded (   $discountRefunded)

Sets the discount refunded for the order item.

Parameters
float$discountRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2144 of file Item.php.

◆ setDiscountTaxCompensationAmount()

setDiscountTaxCompensationAmount (   $amount)

Sets the discount tax compensation amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2058 of file Item.php.

◆ setDiscountTaxCompensationCanceled()

setDiscountTaxCompensationCanceled (   $discountTaxCompensationCanceled)

Sets the discount tax compensation canceled for the order item.

Parameters
float$discountTaxCompensationCanceled
Returns
$this

Implements OrderItemInterface.

Definition at line 2120 of file Item.php.

2121  {
2122  return $this->setData(OrderItemInterface::DISCOUNT_TAX_COMPENSATION_CANCELED, $discountTaxCompensationCanceled);
2123  }

◆ setDiscountTaxCompensationInvoiced()

setDiscountTaxCompensationInvoiced (   $discountTaxCompensationInvoiced)

Sets the discount tax compensation invoiced for the order item.

Parameters
float$discountTaxCompensationInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 2074 of file Item.php.

2075  {
2076  return $this->setData(OrderItemInterface::DISCOUNT_TAX_COMPENSATION_INVOICED, $discountTaxCompensationInvoiced);
2077  }

◆ setDiscountTaxCompensationRefunded()

setDiscountTaxCompensationRefunded (   $discountTaxCompensationRefunded)

Sets the discount tax compensation refunded for the order item.

Parameters
float$discountTaxCompensationRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2093 of file Item.php.

2094  {
2095  return $this->setData(OrderItemInterface::DISCOUNT_TAX_COMPENSATION_REFUNDED, $discountTaxCompensationRefunded);
2096  }

◆ setEventId()

setEventId (   $id)

Sets the event ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 2280 of file Item.php.

◆ setExtensionAttributes()

setExtensionAttributes ( \Magento\Sales\Api\Data\OrderItemExtensionInterface  $extensionAttributes)
Parameters
\Magento\Sales\Api\Data\OrderItemExtensionInterface$extensionAttributes
Returns
$this

Definition at line 2389 of file Item.php.

2390  {
2392  }
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)

◆ setExtOrderItemId()

setExtOrderItemId (   $id)

Sets the external order item ID for the order item.

Parameters
string$id
Returns
$this

Implements OrderItemInterface.

Definition at line 2002 of file Item.php.

◆ setFreeShipping()

setFreeShipping (   $freeShipping)

Sets the free-shipping flag value for the order item.

Parameters
int$freeShipping
Returns
$this

Implements OrderItemInterface.

Definition at line 2264 of file Item.php.

◆ setGwBasePrice()

setGwBasePrice (   $price)

Sets the GW base price for the order item.

Parameters
float$price
Returns
$this

Implements OrderItemInterface.

Definition at line 2168 of file Item.php.

◆ setGwBasePriceInvoiced()

setGwBasePriceInvoiced (   $gwBasePriceInvoiced)

Sets the GW base price invoiced for the order item.

Parameters
float$gwBasePriceInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 2200 of file Item.php.

◆ setGwBasePriceRefunded()

setGwBasePriceRefunded (   $gwBasePriceRefunded)

Sets the GW base price refunded for the order item.

Parameters
float$gwBasePriceRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2232 of file Item.php.

◆ setGwBaseTaxAmount()

setGwBaseTaxAmount (   $amount)

Sets the GW base tax amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2184 of file Item.php.

◆ setGwBaseTaxAmountInvoiced()

setGwBaseTaxAmountInvoiced (   $gwBaseTaxAmountInvoiced)

Sets the GW base tax amount invoiced for the order item.

Parameters
float$gwBaseTaxAmountInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 2216 of file Item.php.

◆ setGwBaseTaxAmountRefunded()

setGwBaseTaxAmountRefunded (   $gwBaseTaxAmountRefunded)

Sets the GW base tax amount refunded for the order item.

Parameters
float$gwBaseTaxAmountRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2248 of file Item.php.

◆ setGwId()

setGwId (   $id)

Sets the GW ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 2160 of file Item.php.

◆ setGwPrice()

setGwPrice (   $price)

Sets the GW price for the order item.

Parameters
float$price
Returns
$this

Implements OrderItemInterface.

Definition at line 2176 of file Item.php.

◆ setGwPriceInvoiced()

setGwPriceInvoiced (   $gwPriceInvoiced)

Sets the GW price invoiced for the order item.

Parameters
float$gwPriceInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 2208 of file Item.php.

◆ setGwPriceRefunded()

setGwPriceRefunded (   $gwPriceRefunded)

Sets the GW price refunded for the order item.

Parameters
float$gwPriceRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2240 of file Item.php.

◆ setGwTaxAmount()

setGwTaxAmount (   $amount)

Sets the GW tax amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2192 of file Item.php.

◆ setGwTaxAmountInvoiced()

setGwTaxAmountInvoiced (   $gwTaxAmountInvoiced)

Sets the GW tax amount invoiced for the order item.

Parameters
float$gwTaxAmountInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 2224 of file Item.php.

◆ setGwTaxAmountRefunded()

setGwTaxAmountRefunded (   $gwTaxAmountRefunded)

Sets the GW tax amount refunded for the order item.

Parameters
float$gwTaxAmountRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2256 of file Item.php.

◆ setIsQtyDecimal()

setIsQtyDecimal (   $isQtyDecimal)

Sets the is-quantity-decimal flag value for the order item.

Parameters
int$isQtyDecimal
Returns
$this

Implements OrderItemInterface.

Definition at line 1746 of file Item.php.

◆ setIsVirtual()

setIsVirtual (   $isVirtual)

Sets the is-virtual flag value for the order item.

Parameters
int$isVirtual
Returns
$this

Implements OrderItemInterface.

Definition at line 1698 of file Item.php.

◆ setItemId()

setItemId (   $id)

Sets the item ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 1634 of file Item.php.

◆ setLockedDoInvoice()

setLockedDoInvoice (   $flag)

Sets the locked DO invoice flag value for the order item.

Parameters
int$flag
Returns
$this

Implements OrderItemInterface.

Definition at line 2010 of file Item.php.

◆ setLockedDoShip()

setLockedDoShip (   $flag)

Sets the locked DO ship flag value for the order item.

Parameters
int$flag
Returns
$this

Implements OrderItemInterface.

Definition at line 2018 of file Item.php.

◆ setName()

setName (   $name)

Sets the name for the order item.

Parameters
string$name
Returns
$this

Implements OrderItemInterface.

Definition at line 1714 of file Item.php.

1715  {
1716  return $this->setData(OrderItemInterface::NAME, $name);
1717  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ setNoDiscount()

setNoDiscount (   $noDiscount)

Sets the no discount flag value for the order item.

Parameters
int$noDiscount
Returns
$this

Implements OrderItemInterface.

Definition at line 1754 of file Item.php.

◆ setOrder()

setOrder ( \Magento\Sales\Model\Order  $order)

Declare order

Parameters
\Magento\Sales\Model\Order$order
Returns
$this

Definition at line 285 of file Item.php.

286  {
287  $this->_order = $order;
288  $this->setOrderId($order->getId());
289  return $this;
290  }
$order
Definition: order.php:55

◆ setOrderId()

setOrderId (   $id)

Sets the order ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 1642 of file Item.php.

◆ setOriginalPrice()

setOriginalPrice (   $price)

Sets the original price for the order item.

Parameters
float$price
Returns
$this

Implements OrderItemInterface.

Definition at line 1834 of file Item.php.

◆ setParentItem()

setParentItem (   $item)

Set parent item

Parameters
Item$item
Returns
$this

Implements OrderItemInterface.

Definition at line 164 of file Item.php.

165  {
166  if ($item) {
168  $item->setHasChildren(true);
169  $item->addChildItem($this);
170  }
171  return $this;
172  }

◆ setParentItemId()

setParentItemId (   $id)

Sets the parent item ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 1650 of file Item.php.

◆ setPrice()

setPrice (   $price)

Sets the price for the order item.

Parameters
float$price
Returns
$this

Implements OrderItemInterface.

Definition at line 1818 of file Item.php.

◆ setPriceInclTax()

setPriceInclTax (   $amount)

Sets the price including tax for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2026 of file Item.php.

◆ setProductId()

setProductId (   $id)

Sets the product ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 1674 of file Item.php.

◆ setProductOption()

setProductOption ( \Magento\Catalog\Api\Data\ProductOptionInterface  $productOption)

Definition at line 2368 of file Item.php.

2369  {
2370  return $this->setData(self::KEY_PRODUCT_OPTION, $productOption);
2371  }

◆ setProductOptions()

setProductOptions ( array  $options = null)

Set product options

Parameters
array$options
Returns
$this

Definition at line 464 of file Item.php.

465  {
466  $this->setData('product_options', $options);
467  return $this;
468  }

◆ setProductType()

setProductType (   $productType)

Sets the product type for the order item.

Parameters
string$productType
Returns
$this

Implements OrderItemInterface.

Definition at line 1682 of file Item.php.

◆ setQtyBackordered()

setQtyBackordered (   $qtyBackordered)

Sets the quantity backordered for the order item.

Parameters
float$qtyBackordered
Returns
$this

Implements OrderItemInterface.

Definition at line 1762 of file Item.php.

◆ setQtyCanceled()

setQtyCanceled (   $qtyCanceled)

Sets the quantity canceled for the order item.

Parameters
float$qtyCanceled
Returns
$this

Implements OrderItemInterface.

Definition at line 1770 of file Item.php.

◆ setQtyInvoiced()

setQtyInvoiced (   $qtyInvoiced)

Sets the quantity invoiced for the order item.

Parameters
float$qtyInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1778 of file Item.php.

◆ setQtyOrdered()

setQtyOrdered (   $qtyOrdered)

Sets the quantity ordered for the order item.

Parameters
float$qtyOrdered
Returns
$this

Implements OrderItemInterface.

Definition at line 1786 of file Item.php.

◆ setQtyRefunded()

setQtyRefunded (   $qtyRefunded)

Sets the quantity refunded for the order item.

Parameters
float$qtyRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 1794 of file Item.php.

◆ setQtyReturned()

setQtyReturned (   $qtyReturned)

Sets the quantity returned for the order item.

Parameters
float$qtyReturned
Returns
$this

Implements OrderItemInterface.

Definition at line 2272 of file Item.php.

◆ setQtyShipped()

setQtyShipped (   $qtyShipped)

Sets the quantity shipped for the order item.

Parameters
float$qtyShipped
Returns
$this

Implements OrderItemInterface.

Definition at line 1802 of file Item.php.

◆ setQuoteItemId()

setQuoteItemId (   $id)

Sets the quote item ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 1658 of file Item.php.

◆ setRowInvoiced()

setRowInvoiced (   $rowInvoiced)

Sets the row invoiced for the order item.

Parameters
float$rowInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1962 of file Item.php.

◆ setRowTotal()

setRowTotal (   $amount)

Sets the row total for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 1946 of file Item.php.

◆ setRowTotalInclTax()

setRowTotalInclTax (   $amount)

Sets the row total including tax for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2042 of file Item.php.

◆ setRowWeight()

setRowWeight (   $rowWeight)

Sets the row weight for the order item.

Parameters
float$rowWeight
Returns
$this

Implements OrderItemInterface.

Definition at line 1978 of file Item.php.

◆ setSku()

setSku (   $sku)

Sets the SKU for the order item.

Parameters
string$sku
Returns
$this

Implements OrderItemInterface.

Definition at line 1706 of file Item.php.

◆ setStoreId()

setStoreId (   $id)

Sets the store ID for the order item.

Parameters
int$id
Returns
$this

Implements OrderItemInterface.

Definition at line 1666 of file Item.php.

◆ setTaxAmount()

setTaxAmount (   $amount)

Sets the tax amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 1858 of file Item.php.

◆ setTaxBeforeDiscount()

setTaxBeforeDiscount (   $taxBeforeDiscount)

Sets the tax before discount for the order item.

Parameters
float$taxBeforeDiscount
Returns
$this

Implements OrderItemInterface.

Definition at line 1994 of file Item.php.

◆ setTaxCanceled()

setTaxCanceled (   $taxCanceled)

Sets the tax canceled for the order item.

Parameters
float$taxCanceled
Returns
$this

Implements OrderItemInterface.

Definition at line 2112 of file Item.php.

◆ setTaxInvoiced()

setTaxInvoiced (   $taxInvoiced)

Sets the tax invoiced for the order item.

Parameters
float$taxInvoiced
Returns
$this

Implements OrderItemInterface.

Definition at line 1874 of file Item.php.

◆ setTaxPercent()

setTaxPercent (   $taxPercent)

Sets the tax percent for the order item.

Parameters
float$taxPercent
Returns
$this

Implements OrderItemInterface.

Definition at line 1850 of file Item.php.

◆ setTaxRefunded()

setTaxRefunded (   $taxRefunded)

Sets the tax refunded for the order item.

Parameters
float$taxRefunded
Returns
$this

Implements OrderItemInterface.

Definition at line 2128 of file Item.php.

◆ setUpdatedAt()

setUpdatedAt (   $timestamp)

Sets the updated-at timestamp for the order item.

Parameters
string$timestamp
Returns
$this

Implements OrderItemInterface.

Definition at line 1626 of file Item.php.

◆ setWeeeTaxApplied()

setWeeeTaxApplied (   $weeeTaxApplied)

Sets the WEEE tax applied for the order item.

Parameters
string$weeeTaxApplied
Returns
$this

Implements OrderItemInterface.

Definition at line 2320 of file Item.php.

◆ setWeeeTaxAppliedAmount()

setWeeeTaxAppliedAmount (   $amount)

Sets the WEEE tax applied amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2304 of file Item.php.

◆ setWeeeTaxAppliedRowAmount()

setWeeeTaxAppliedRowAmount (   $amount)

Sets the WEEE tax applied row amount for the order item.

Parameters
float$amount
Returns
$this

Implements OrderItemInterface.

Definition at line 2312 of file Item.php.

◆ setWeeeTaxDisposition()

setWeeeTaxDisposition (   $weeeTaxDisposition)

Sets the WEEE tax disposition for the order item.

Parameters
float$weeeTaxDisposition
Returns
$this

Implements OrderItemInterface.

Definition at line 2328 of file Item.php.

◆ setWeeeTaxRowDisposition()

setWeeeTaxRowDisposition (   $weeeTaxRowDisposition)

Sets the WEEE tax row disposition for the order item.

Parameters
float$weeeTaxRowDisposition
Returns
$this

Implements OrderItemInterface.

Definition at line 2336 of file Item.php.

◆ setWeight()

setWeight (   $weight)

Sets the weight for the order item.

Parameters
float$weight
Returns
$this

Implements OrderItemInterface.

Definition at line 1690 of file Item.php.

Field Documentation

◆ $_children

$_children = []
protected

Definition at line 79 of file Item.php.

◆ $_eventObject

$_eventObject = 'item'
protected

Definition at line 62 of file Item.php.

◆ $_eventPrefix

$_eventPrefix = 'sales_order_item'
protected

Definition at line 57 of file Item.php.

◆ $_order

$_order = null
protected

Definition at line 74 of file Item.php.

◆ $_orderFactory

$_orderFactory
protected

Definition at line 84 of file Item.php.

◆ $_statuses

$_statuses = null
staticprotected

Definition at line 67 of file Item.php.

◆ $_storeManager

$_storeManager
protected

Definition at line 94 of file Item.php.

◆ $productRepository

$productRepository
protected

Definition at line 89 of file Item.php.

◆ STATUS_BACKORDERED

const STATUS_BACKORDERED = 3

Definition at line 36 of file Item.php.

◆ STATUS_CANCELED

const STATUS_CANCELED = 5

Definition at line 39 of file Item.php.

◆ STATUS_INVOICED

const STATUS_INVOICED = 9

Definition at line 33 of file Item.php.

◆ STATUS_MIXED

const STATUS_MIXED = 7

Definition at line 46 of file Item.php.

◆ STATUS_PARTIAL

const STATUS_PARTIAL = 6

Definition at line 42 of file Item.php.

◆ STATUS_PENDING

const STATUS_PENDING = 1

Definition at line 27 of file Item.php.

◆ STATUS_REFUNDED

const STATUS_REFUNDED = 8

Definition at line 49 of file Item.php.

◆ STATUS_RETURNED

const STATUS_RETURNED = 4

Definition at line 52 of file Item.php.

◆ STATUS_SHIPPED

const STATUS_SHIPPED = 2

Definition at line 30 of file Item.php.


The documentation for this class was generated from the following file: