Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Item.php
Go to the documentation of this file.
1 <?php
7 
11 
25 class Item extends AbstractModel implements OrderItemInterface
26 {
27  const STATUS_PENDING = 1;
28 
29  // No items shipped, invoiced, canceled, refunded nor backordered
30  const STATUS_SHIPPED = 2;
31 
32  // When qty ordered - [qty canceled + qty returned] = qty shipped
33  const STATUS_INVOICED = 9;
34 
35  // When qty ordered - [qty canceled + qty returned] = qty invoiced
36  const STATUS_BACKORDERED = 3;
37 
38  // When qty ordered - [qty canceled + qty returned] = qty backordered
39  const STATUS_CANCELED = 5;
40 
41  // When qty ordered = qty canceled
42  const STATUS_PARTIAL = 6;
43 
44  // If [qty shipped or(max of two) qty invoiced + qty canceled + qty returned]
45  // < qty ordered
46  const STATUS_MIXED = 7;
47 
48  // All other combinations
49  const STATUS_REFUNDED = 8;
50 
51  // When qty ordered = qty refunded
52  const STATUS_RETURNED = 4;
53 
54  // When qty ordered = qty returned // not used at the moment
55 
56  // When qty ordered = qty returned // not used at the moment
57  protected $_eventPrefix = 'sales_order_item';
58 
62  protected $_eventObject = 'item';
63 
67  protected static $_statuses = null;
68 
74  protected $_order = null;
75 
79  protected $_children = [];
80 
84  protected $_orderFactory;
85 
89  protected $productRepository;
90 
94  protected $_storeManager;
95 
101  private $serializer;
102 
119  public function __construct(
120  \Magento\Framework\Model\Context $context,
121  \Magento\Framework\Registry $registry,
122  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
124  \Magento\Sales\Model\OrderFactory $orderFactory,
126  \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
127  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
128  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
129  array $data = [],
130  \Magento\Framework\Serialize\Serializer\Json $serializer = null
131  ) {
132  parent::__construct(
133  $context,
134  $registry,
135  $extensionFactory,
137  $resource,
138  $resourceCollection,
139  $data
140  );
141  $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
142  ->get(\Magento\Framework\Serialize\Serializer\Json::class);
143  $this->_orderFactory = $orderFactory;
144  $this->_storeManager = $storeManager;
145  $this->productRepository = $productRepository;
146  }
147 
153  protected function _construct()
154  {
155  $this->_init(\Magento\Sales\Model\ResourceModel\Order\Item::class);
156  }
157 
164  public function setParentItem($item)
165  {
166  if ($item) {
168  $item->setHasChildren(true);
169  $item->addChildItem($this);
170  }
171  return $this;
172  }
173 
179  public function getParentItem()
180  {
182  }
183 
189  public function canInvoice()
190  {
191  return $this->getQtyToInvoice() > 0;
192  }
193 
199  public function canShip()
200  {
201  return $this->getQtyToShip() > 0;
202  }
203 
209  public function canRefund()
210  {
211  return $this->getQtyToRefund() > 0;
212  }
213 
219  public function getQtyToShip()
220  {
221  if ($this->isDummy(true)) {
222  return 0;
223  }
224 
225  return $this->getSimpleQtyToShip();
226  }
227 
233  public function getSimpleQtyToShip()
234  {
235  $qty = $this->getQtyOrdered() - $this->getQtyShipped() - $this->getQtyRefunded() - $this->getQtyCanceled();
236  return max(round($qty, 8), 0);
237  }
238 
244  public function getQtyToInvoice()
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  }
253 
259  public function getQtyToRefund()
260  {
261  if ($this->isDummy()) {
262  return 0;
263  }
264 
265  return max($this->getQtyInvoiced() - $this->getQtyRefunded(), 0);
266  }
267 
273  public function getQtyToCancel()
274  {
275  $qtyToCancel = min($this->getQtyToInvoice(), $this->getQtyToShip());
276  return max($qtyToCancel, 0);
277  }
278 
285  public function setOrder(\Magento\Sales\Model\Order $order)
286  {
287  $this->_order = $order;
288  $this->setOrderId($order->getId());
289  return $this;
290  }
291 
297  public function getOrder()
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  }
306 
314  public function getStatusId()
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  }
357 
363  protected function _getQtyChildrenBackordered()
364  {
365  $backordered = null;
366  foreach ($this->_children as $childItem) {
367  $backordered += (double)$childItem->getQtyBackordered();
368  }
369 
370  return $backordered;
371  }
372 
378  public function getStatus()
379  {
380  return $this->getStatusName($this->getStatusId());
381  }
382 
389  public static function getStatusName($statusId)
390  {
391  if (self::$_statuses === null) {
393  }
394  if (isset(self::$_statuses[$statusId])) {
395  return self::$_statuses[$statusId];
396  }
397  return __('Unknown Status');
398  }
399 
405  public function cancel()
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  }
420 
426  public static function getStatuses()
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  }
443 
449  public function getOriginalPrice()
450  {
452  if ($price === null) {
453  return $this->getPrice();
454  }
455  return $price;
456  }
457 
464  public function setProductOptions(array $options = null)
465  {
466  $this->setData('product_options', $options);
467  return $this;
468  }
469 
475  public function getProductOptions()
476  {
477  $data = $this->_getData('product_options');
478  if (is_string($data)) {
479  $data = $this->serializer->unserialize($data);
480  }
481  return $data;
482  }
483 
492  public function getProductOptionByCode($code = null)
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  }
503 
509  public function getRealProductType()
510  {
511  $productType = $this->getProductOptionByCode('real_product_type');
512  if ($productType) {
513  return $productType;
514  }
515  return null;
516  }
517 
524  public function addChildItem($item)
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  }
532 
538  public function getChildrenItems()
539  {
540  return $this->_children;
541  }
542 
548  public function isChildrenCalculated()
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  }
565 
573  {
574  if ($this->getParentItem()) {
575  $product = $this->getParentItem()->getProduct();
576  } else {
577  $product = $this->getProduct();
578  }
579 
580  return $product->getTypeInstance()->getForceApplyDiscountToParentItem();
581  }
582 
588  public function isShipSeparately()
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  }
605 
615  public function isDummy($shipment = false)
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  }
652 
660  public function getBuyRequest()
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  }
670 
676  public function getProduct()
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  }
688 
694  public function getStore()
695  {
696  $storeId = $this->getStoreId();
697  if ($storeId) {
698  return $this->_storeManager->getStore($storeId);
699  }
700  return $this->_storeManager->getStore();
701  }
702 
703  //@codeCoverageIgnoreStart
704 
710  public function getAdditionalData()
711  {
713  }
714 
720  public function getAmountRefunded()
721  {
723  }
724 
730  public function getAppliedRuleIds()
731  {
733  }
734 
740  public function getBaseAmountRefunded()
741  {
743  }
744 
750  public function getBaseCost()
751  {
752  return $this->getData(OrderItemInterface::BASE_COST);
753  }
754 
760  public function getBaseDiscountAmount()
761  {
763  }
764 
770  public function getBaseDiscountInvoiced()
771  {
773  }
774 
780  public function getBaseDiscountRefunded()
781  {
783  }
784 
791  {
793  }
794 
801  {
803  }
804 
811  {
813  }
814 
820  public function getBaseOriginalPrice()
821  {
823  }
824 
830  public function getBasePrice()
831  {
833  }
834 
840  public function getBasePriceInclTax()
841  {
843  }
844 
850  public function getBaseRowInvoiced()
851  {
853  }
854 
860  public function getBaseRowTotal()
861  {
863  }
864 
870  public function getBaseRowTotalInclTax()
871  {
873  }
874 
880  public function getBaseTaxAmount()
881  {
883  }
884 
890  public function getBaseTaxBeforeDiscount()
891  {
893  }
894 
900  public function getBaseTaxInvoiced()
901  {
903  }
904 
910  public function getBaseTaxRefunded()
911  {
913  }
914 
920  public function getBaseWeeeTaxAppliedAmount()
921  {
923  }
924 
931  {
933  }
934 
940  public function getBaseWeeeTaxDisposition()
941  {
943  }
944 
951  {
953  }
954 
960  public function getCreatedAt()
961  {
963  }
964 
968  public function setCreatedAt($createdAt)
969  {
970  return $this->setData(OrderItemInterface::CREATED_AT, $createdAt);
971  }
972 
978  public function getDescription()
979  {
981  }
982 
988  public function getDiscountAmount()
989  {
991  }
992 
998  public function getDiscountInvoiced()
999  {
1001  }
1002 
1008  public function getDiscountPercent()
1009  {
1011  }
1012 
1018  public function getDiscountRefunded()
1019  {
1021  }
1022 
1028  public function getEventId()
1029  {
1030  return $this->getData(OrderItemInterface::EVENT_ID);
1031  }
1032 
1038  public function getExtOrderItemId()
1039  {
1041  }
1042 
1048  public function getFreeShipping()
1049  {
1051  }
1052 
1058  public function getGwBasePrice()
1059  {
1061  }
1062 
1068  public function getGwBasePriceInvoiced()
1069  {
1071  }
1072 
1078  public function getGwBasePriceRefunded()
1079  {
1081  }
1082 
1088  public function getGwBaseTaxAmount()
1089  {
1091  }
1092 
1098  public function getGwBaseTaxAmountInvoiced()
1099  {
1101  }
1102 
1108  public function getGwBaseTaxAmountRefunded()
1109  {
1111  }
1112 
1118  public function getGwId()
1119  {
1120  return $this->getData(OrderItemInterface::GW_ID);
1121  }
1122 
1128  public function getGwPrice()
1129  {
1130  return $this->getData(OrderItemInterface::GW_PRICE);
1131  }
1132 
1138  public function getGwPriceInvoiced()
1139  {
1141  }
1142 
1148  public function getGwPriceRefunded()
1149  {
1151  }
1152 
1158  public function getGwTaxAmount()
1159  {
1161  }
1162 
1168  public function getGwTaxAmountInvoiced()
1169  {
1171  }
1172 
1178  public function getGwTaxAmountRefunded()
1179  {
1181  }
1182 
1189  {
1191  }
1192 
1199  {
1201  }
1202 
1209  {
1211  }
1212 
1219  {
1221  }
1222 
1228  public function getIsQtyDecimal()
1229  {
1231  }
1232 
1238  public function getIsVirtual()
1239  {
1240  return $this->getData(OrderItemInterface::IS_VIRTUAL);
1241  }
1242 
1248  public function getItemId()
1249  {
1250  return $this->getData(OrderItemInterface::ITEM_ID);
1251  }
1252 
1258  public function getLockedDoInvoice()
1259  {
1261  }
1262 
1268  public function getLockedDoShip()
1269  {
1271  }
1272 
1278  public function getName()
1279  {
1280  return $this->getData(OrderItemInterface::NAME);
1281  }
1282 
1288  public function getNoDiscount()
1289  {
1291  }
1292 
1298  public function getOrderId()
1299  {
1300  return $this->getData(OrderItemInterface::ORDER_ID);
1301  }
1302 
1308  public function getParentItemId()
1309  {
1311  }
1312 
1318  public function getPrice()
1319  {
1320  return $this->getData(OrderItemInterface::PRICE);
1321  }
1322 
1328  public function getPriceInclTax()
1329  {
1331  }
1332 
1338  public function getProductId()
1339  {
1340  return $this->getData(OrderItemInterface::PRODUCT_ID);
1341  }
1342 
1348  public function getProductType()
1349  {
1351  }
1352 
1358  public function getQtyBackordered()
1359  {
1361  }
1362 
1368  public function getQtyCanceled()
1369  {
1371  }
1372 
1378  public function getQtyInvoiced()
1379  {
1381  }
1382 
1388  public function getQtyOrdered()
1389  {
1391  }
1392 
1398  public function getQtyRefunded()
1399  {
1401  }
1402 
1408  public function getQtyReturned()
1409  {
1411  }
1412 
1418  public function getQtyShipped()
1419  {
1421  }
1422 
1428  public function getQuoteItemId()
1429  {
1431  }
1432 
1438  public function getRowInvoiced()
1439  {
1441  }
1442 
1448  public function getRowTotal()
1449  {
1450  return $this->getData(OrderItemInterface::ROW_TOTAL);
1451  }
1452 
1458  public function getRowTotalInclTax()
1459  {
1461  }
1462 
1468  public function getRowWeight()
1469  {
1470  return $this->getData(OrderItemInterface::ROW_WEIGHT);
1471  }
1472 
1478  public function getSku()
1479  {
1480  return $this->getData(OrderItemInterface::SKU);
1481  }
1482 
1488  public function getStoreId()
1489  {
1490  return $this->getData(OrderItemInterface::STORE_ID);
1491  }
1492 
1498  public function getTaxAmount()
1499  {
1500  return $this->getData(OrderItemInterface::TAX_AMOUNT);
1501  }
1502 
1508  public function getTaxBeforeDiscount()
1509  {
1511  }
1512 
1518  public function getTaxCanceled()
1519  {
1521  }
1522 
1528  public function getTaxInvoiced()
1529  {
1531  }
1532 
1538  public function getTaxPercent()
1539  {
1541  }
1542 
1548  public function getTaxRefunded()
1549  {
1551  }
1552 
1558  public function getUpdatedAt()
1559  {
1560  return $this->getData(OrderItemInterface::UPDATED_AT);
1561  }
1562 
1568  public function getWeeeTaxApplied()
1569  {
1571  }
1572 
1578  public function getWeeeTaxAppliedAmount()
1579  {
1581  }
1582 
1588  public function getWeeeTaxAppliedRowAmount()
1589  {
1591  }
1592 
1598  public function getWeeeTaxDisposition()
1599  {
1601  }
1602 
1608  public function getWeeeTaxRowDisposition()
1609  {
1611  }
1612 
1618  public function getWeight()
1619  {
1620  return $this->getData(OrderItemInterface::WEIGHT);
1621  }
1622 
1626  public function setUpdatedAt($timestamp)
1627  {
1628  return $this->setData(OrderItemInterface::UPDATED_AT, $timestamp);
1629  }
1630 
1634  public function setItemId($id)
1635  {
1636  return $this->setData(OrderItemInterface::ITEM_ID, $id);
1637  }
1638 
1642  public function setOrderId($id)
1643  {
1644  return $this->setData(OrderItemInterface::ORDER_ID, $id);
1645  }
1646 
1650  public function setParentItemId($id)
1651  {
1653  }
1654 
1658  public function setQuoteItemId($id)
1659  {
1661  }
1662 
1666  public function setStoreId($id)
1667  {
1668  return $this->setData(OrderItemInterface::STORE_ID, $id);
1669  }
1670 
1674  public function setProductId($id)
1675  {
1676  return $this->setData(OrderItemInterface::PRODUCT_ID, $id);
1677  }
1678 
1682  public function setProductType($productType)
1683  {
1684  return $this->setData(OrderItemInterface::PRODUCT_TYPE, $productType);
1685  }
1686 
1690  public function setWeight($weight)
1691  {
1692  return $this->setData(OrderItemInterface::WEIGHT, $weight);
1693  }
1694 
1698  public function setIsVirtual($isVirtual)
1699  {
1700  return $this->setData(OrderItemInterface::IS_VIRTUAL, $isVirtual);
1701  }
1702 
1706  public function setSku($sku)
1707  {
1708  return $this->setData(OrderItemInterface::SKU, $sku);
1709  }
1710 
1714  public function setName($name)
1715  {
1716  return $this->setData(OrderItemInterface::NAME, $name);
1717  }
1718 
1722  public function setDescription($description)
1723  {
1725  }
1726 
1730  public function setAppliedRuleIds($appliedRuleIds)
1731  {
1732  return $this->setData(OrderItemInterface::APPLIED_RULE_IDS, $appliedRuleIds);
1733  }
1734 
1738  public function setAdditionalData($additionalData)
1739  {
1740  return $this->setData(OrderItemInterface::ADDITIONAL_DATA, $additionalData);
1741  }
1742 
1746  public function setIsQtyDecimal($isQtyDecimal)
1747  {
1748  return $this->setData(OrderItemInterface::IS_QTY_DECIMAL, $isQtyDecimal);
1749  }
1750 
1754  public function setNoDiscount($noDiscount)
1755  {
1756  return $this->setData(OrderItemInterface::NO_DISCOUNT, $noDiscount);
1757  }
1758 
1762  public function setQtyBackordered($qtyBackordered)
1763  {
1764  return $this->setData(OrderItemInterface::QTY_BACKORDERED, $qtyBackordered);
1765  }
1766 
1770  public function setQtyCanceled($qtyCanceled)
1771  {
1772  return $this->setData(OrderItemInterface::QTY_CANCELED, $qtyCanceled);
1773  }
1774 
1778  public function setQtyInvoiced($qtyInvoiced)
1779  {
1780  return $this->setData(OrderItemInterface::QTY_INVOICED, $qtyInvoiced);
1781  }
1782 
1786  public function setQtyOrdered($qtyOrdered)
1787  {
1789  }
1790 
1794  public function setQtyRefunded($qtyRefunded)
1795  {
1796  return $this->setData(OrderItemInterface::QTY_REFUNDED, $qtyRefunded);
1797  }
1798 
1802  public function setQtyShipped($qtyShipped)
1803  {
1804  return $this->setData(OrderItemInterface::QTY_SHIPPED, $qtyShipped);
1805  }
1806 
1810  public function setBaseCost($baseCost)
1811  {
1812  return $this->setData(OrderItemInterface::BASE_COST, $baseCost);
1813  }
1814 
1818  public function setPrice($price)
1819  {
1820  return $this->setData(OrderItemInterface::PRICE, $price);
1821  }
1822 
1826  public function setBasePrice($price)
1827  {
1829  }
1830 
1834  public function setOriginalPrice($price)
1835  {
1837  }
1838 
1842  public function setBaseOriginalPrice($price)
1843  {
1845  }
1846 
1850  public function setTaxPercent($taxPercent)
1851  {
1852  return $this->setData(OrderItemInterface::TAX_PERCENT, $taxPercent);
1853  }
1854 
1858  public function setTaxAmount($amount)
1859  {
1861  }
1862 
1866  public function setBaseTaxAmount($amount)
1867  {
1869  }
1870 
1874  public function setTaxInvoiced($taxInvoiced)
1875  {
1876  return $this->setData(OrderItemInterface::TAX_INVOICED, $taxInvoiced);
1877  }
1878 
1882  public function setBaseTaxInvoiced($baseTaxInvoiced)
1883  {
1884  return $this->setData(OrderItemInterface::BASE_TAX_INVOICED, $baseTaxInvoiced);
1885  }
1886 
1890  public function setDiscountPercent($discountPercent)
1891  {
1892  return $this->setData(OrderItemInterface::DISCOUNT_PERCENT, $discountPercent);
1893  }
1894 
1898  public function setDiscountAmount($amount)
1899  {
1901  }
1902 
1907  {
1909  }
1910 
1914  public function setDiscountInvoiced($discountInvoiced)
1915  {
1916  return $this->setData(OrderItemInterface::DISCOUNT_INVOICED, $discountInvoiced);
1917  }
1918 
1922  public function setBaseDiscountInvoiced($baseDiscountInvoiced)
1923  {
1924  return $this->setData(OrderItemInterface::BASE_DISCOUNT_INVOICED, $baseDiscountInvoiced);
1925  }
1926 
1930  public function setAmountRefunded($amountRefunded)
1931  {
1932  return $this->setData(OrderItemInterface::AMOUNT_REFUNDED, $amountRefunded);
1933  }
1934 
1938  public function setBaseAmountRefunded($baseAmountRefunded)
1939  {
1940  return $this->setData(OrderItemInterface::BASE_AMOUNT_REFUNDED, $baseAmountRefunded);
1941  }
1942 
1946  public function setRowTotal($amount)
1947  {
1949  }
1950 
1954  public function setBaseRowTotal($amount)
1955  {
1957  }
1958 
1962  public function setRowInvoiced($rowInvoiced)
1963  {
1964  return $this->setData(OrderItemInterface::ROW_INVOICED, $rowInvoiced);
1965  }
1966 
1970  public function setBaseRowInvoiced($baseRowInvoiced)
1971  {
1972  return $this->setData(OrderItemInterface::BASE_ROW_INVOICED, $baseRowInvoiced);
1973  }
1974 
1978  public function setRowWeight($rowWeight)
1979  {
1980  return $this->setData(OrderItemInterface::ROW_WEIGHT, $rowWeight);
1981  }
1982 
1986  public function setBaseTaxBeforeDiscount($baseTaxBeforeDiscount)
1987  {
1988  return $this->setData(OrderItemInterface::BASE_TAX_BEFORE_DISCOUNT, $baseTaxBeforeDiscount);
1989  }
1990 
1994  public function setTaxBeforeDiscount($taxBeforeDiscount)
1995  {
1996  return $this->setData(OrderItemInterface::TAX_BEFORE_DISCOUNT, $taxBeforeDiscount);
1997  }
1998 
2002  public function setExtOrderItemId($id)
2003  {
2005  }
2006 
2010  public function setLockedDoInvoice($flag)
2011  {
2012  return $this->setData(OrderItemInterface::LOCKED_DO_INVOICE, $flag);
2013  }
2014 
2018  public function setLockedDoShip($flag)
2019  {
2020  return $this->setData(OrderItemInterface::LOCKED_DO_SHIP, $flag);
2021  }
2022 
2026  public function setPriceInclTax($amount)
2027  {
2029  }
2030 
2034  public function setBasePriceInclTax($amount)
2035  {
2037  }
2038 
2042  public function setRowTotalInclTax($amount)
2043  {
2045  }
2046 
2051  {
2053  }
2054 
2059  {
2061  }
2062 
2067  {
2069  }
2070 
2074  public function setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced)
2075  {
2076  return $this->setData(OrderItemInterface::DISCOUNT_TAX_COMPENSATION_INVOICED, $discountTaxCompensationInvoiced);
2077  }
2078 
2082  public function setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced)
2083  {
2084  return $this->setData(
2086  $baseDiscountTaxCompensationInvoiced
2087  );
2088  }
2089 
2093  public function setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded)
2094  {
2095  return $this->setData(OrderItemInterface::DISCOUNT_TAX_COMPENSATION_REFUNDED, $discountTaxCompensationRefunded);
2096  }
2097 
2101  public function setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded)
2102  {
2103  return $this->setData(
2105  $baseDiscountTaxCompensationRefunded
2106  );
2107  }
2108 
2112  public function setTaxCanceled($taxCanceled)
2113  {
2114  return $this->setData(OrderItemInterface::TAX_CANCELED, $taxCanceled);
2115  }
2116 
2120  public function setDiscountTaxCompensationCanceled($discountTaxCompensationCanceled)
2121  {
2122  return $this->setData(OrderItemInterface::DISCOUNT_TAX_COMPENSATION_CANCELED, $discountTaxCompensationCanceled);
2123  }
2124 
2128  public function setTaxRefunded($taxRefunded)
2129  {
2130  return $this->setData(OrderItemInterface::TAX_REFUNDED, $taxRefunded);
2131  }
2132 
2136  public function setBaseTaxRefunded($baseTaxRefunded)
2137  {
2138  return $this->setData(OrderItemInterface::BASE_TAX_REFUNDED, $baseTaxRefunded);
2139  }
2140 
2144  public function setDiscountRefunded($discountRefunded)
2145  {
2146  return $this->setData(OrderItemInterface::DISCOUNT_REFUNDED, $discountRefunded);
2147  }
2148 
2152  public function setBaseDiscountRefunded($baseDiscountRefunded)
2153  {
2154  return $this->setData(OrderItemInterface::BASE_DISCOUNT_REFUNDED, $baseDiscountRefunded);
2155  }
2156 
2160  public function setGwId($id)
2161  {
2162  return $this->setData(OrderItemInterface::GW_ID, $id);
2163  }
2164 
2168  public function setGwBasePrice($price)
2169  {
2171  }
2172 
2176  public function setGwPrice($price)
2177  {
2179  }
2180 
2184  public function setGwBaseTaxAmount($amount)
2185  {
2187  }
2188 
2192  public function setGwTaxAmount($amount)
2193  {
2195  }
2196 
2200  public function setGwBasePriceInvoiced($gwBasePriceInvoiced)
2201  {
2202  return $this->setData(OrderItemInterface::GW_BASE_PRICE_INVOICED, $gwBasePriceInvoiced);
2203  }
2204 
2208  public function setGwPriceInvoiced($gwPriceInvoiced)
2209  {
2210  return $this->setData(OrderItemInterface::GW_PRICE_INVOICED, $gwPriceInvoiced);
2211  }
2212 
2216  public function setGwBaseTaxAmountInvoiced($gwBaseTaxAmountInvoiced)
2217  {
2218  return $this->setData(OrderItemInterface::GW_BASE_TAX_AMOUNT_INVOICED, $gwBaseTaxAmountInvoiced);
2219  }
2220 
2224  public function setGwTaxAmountInvoiced($gwTaxAmountInvoiced)
2225  {
2226  return $this->setData(OrderItemInterface::GW_TAX_AMOUNT_INVOICED, $gwTaxAmountInvoiced);
2227  }
2228 
2232  public function setGwBasePriceRefunded($gwBasePriceRefunded)
2233  {
2234  return $this->setData(OrderItemInterface::GW_BASE_PRICE_REFUNDED, $gwBasePriceRefunded);
2235  }
2236 
2240  public function setGwPriceRefunded($gwPriceRefunded)
2241  {
2242  return $this->setData(OrderItemInterface::GW_PRICE_REFUNDED, $gwPriceRefunded);
2243  }
2244 
2248  public function setGwBaseTaxAmountRefunded($gwBaseTaxAmountRefunded)
2249  {
2250  return $this->setData(OrderItemInterface::GW_BASE_TAX_AMOUNT_REFUNDED, $gwBaseTaxAmountRefunded);
2251  }
2252 
2256  public function setGwTaxAmountRefunded($gwTaxAmountRefunded)
2257  {
2258  return $this->setData(OrderItemInterface::GW_TAX_AMOUNT_REFUNDED, $gwTaxAmountRefunded);
2259  }
2260 
2264  public function setFreeShipping($freeShipping)
2265  {
2266  return $this->setData(OrderItemInterface::FREE_SHIPPING, $freeShipping);
2267  }
2268 
2272  public function setQtyReturned($qtyReturned)
2273  {
2274  return $this->setData(OrderItemInterface::QTY_RETURNED, $qtyReturned);
2275  }
2276 
2280  public function setEventId($id)
2281  {
2282  return $this->setData(OrderItemInterface::EVENT_ID, $id);
2283  }
2284 
2289  {
2291  }
2292 
2296  public function setBaseWeeeTaxAppliedRowAmnt($amnt)
2297  {
2299  }
2300 
2305  {
2307  }
2308 
2313  {
2315  }
2316 
2320  public function setWeeeTaxApplied($weeeTaxApplied)
2321  {
2322  return $this->setData(OrderItemInterface::WEEE_TAX_APPLIED, $weeeTaxApplied);
2323  }
2324 
2328  public function setWeeeTaxDisposition($weeeTaxDisposition)
2329  {
2330  return $this->setData(OrderItemInterface::WEEE_TAX_DISPOSITION, $weeeTaxDisposition);
2331  }
2332 
2336  public function setWeeeTaxRowDisposition($weeeTaxRowDisposition)
2337  {
2338  return $this->setData(OrderItemInterface::WEEE_TAX_ROW_DISPOSITION, $weeeTaxRowDisposition);
2339  }
2340 
2344  public function setBaseWeeeTaxDisposition($baseWeeeTaxDisposition)
2345  {
2346  return $this->setData(OrderItemInterface::BASE_WEEE_TAX_DISPOSITION, $baseWeeeTaxDisposition);
2347  }
2348 
2352  public function setBaseWeeeTaxRowDisposition($baseWeeeTaxRowDisposition)
2353  {
2354  return $this->setData(OrderItemInterface::BASE_WEEE_TAX_ROW_DISPOSITION, $baseWeeeTaxRowDisposition);
2355  }
2356 
2360  public function getProductOption()
2361  {
2362  return $this->getData(self::KEY_PRODUCT_OPTION);
2363  }
2364 
2368  public function setProductOption(\Magento\Catalog\Api\Data\ProductOptionInterface $productOption)
2369  {
2370  return $this->setData(self::KEY_PRODUCT_OPTION, $productOption);
2371  }
2372 
2378  public function getExtensionAttributes()
2379  {
2380  return $this->_getExtensionAttributes();
2381  }
2382 
2389  public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes)
2390  {
2391  return $this->_setExtensionAttributes($extensionAttributes);
2392  }
2393 
2394  //@codeCoverageIgnoreEnd
2395 
2402  public function isProcessingAvailable()
2403  {
2404  return $this->getQtyToShip() > $this->getQtyToCancel();
2405  }
2406 }
getProductOptionByCode($code=null)
Definition: Item.php:492
setDiscountInvoiced($discountInvoiced)
Definition: Item.php:1914
setGwBasePriceInvoiced($gwBasePriceInvoiced)
Definition: Item.php:2200
setQtyReturned($qtyReturned)
Definition: Item.php:2272
setWeeeTaxApplied($weeeTaxApplied)
Definition: Item.php:2320
setExtensionAttributes(\Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes)
Definition: Item.php:2389
isDummy($shipment=false)
Definition: Item.php:615
__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)
Definition: Item.php:119
setGwBaseTaxAmountRefunded($gwBaseTaxAmountRefunded)
Definition: Item.php:2248
setDiscountTaxCompensationCanceled($discountTaxCompensationCanceled)
Definition: Item.php:2120
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
setWeeeTaxAppliedRowAmount($amount)
Definition: Item.php:2312
setAmountRefunded($amountRefunded)
Definition: Item.php:1930
setBaseTaxRefunded($baseTaxRefunded)
Definition: Item.php:2136
setGwTaxAmountRefunded($gwTaxAmountRefunded)
Definition: Item.php:2256
setWeeeTaxDisposition($weeeTaxDisposition)
Definition: Item.php:2328
$id
Definition: fieldset.phtml:14
setQtyRefunded($qtyRefunded)
Definition: Item.php:1794
setDiscountTaxCompensationAmount($amount)
Definition: Item.php:2058
setDiscountRefunded($discountRefunded)
Definition: Item.php:2144
setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced)
Definition: Item.php:2082
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
setDescription($description)
Definition: Item.php:1722
$order
Definition: order.php:55
$storeManager
__()
Definition: __.php:13
$resource
Definition: bulk.php:12
$price
setIsQtyDecimal($isQtyDecimal)
Definition: Item.php:1746
setTaxBeforeDiscount($taxBeforeDiscount)
Definition: Item.php:1994
setProductOption(\Magento\Catalog\Api\Data\ProductOptionInterface $productOption)
Definition: Item.php:2368
setBaseWeeeTaxRowDisposition($baseWeeeTaxRowDisposition)
Definition: Item.php:2352
setBaseTaxBeforeDiscount($baseTaxBeforeDiscount)
Definition: Item.php:1986
setBaseWeeeTaxDisposition($baseWeeeTaxDisposition)
Definition: Item.php:2344
setDiscountPercent($discountPercent)
Definition: Item.php:1890
$amount
Definition: order.php:14
setGwTaxAmountInvoiced($gwTaxAmountInvoiced)
Definition: Item.php:2224
setAppliedRuleIds($appliedRuleIds)
Definition: Item.php:1730
static getStatusName($statusId)
Definition: Item.php:389
setQtyCanceled($qtyCanceled)
Definition: Item.php:1770
setRowInvoiced($rowInvoiced)
Definition: Item.php:1962
setAdditionalData($additionalData)
Definition: Item.php:1738
setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded)
Definition: Item.php:2101
setNoDiscount($noDiscount)
Definition: Item.php:1754
setBaseDiscountInvoiced($baseDiscountInvoiced)
Definition: Item.php:1922
setProductType($productType)
Definition: Item.php:1682
setGwPriceInvoiced($gwPriceInvoiced)
Definition: Item.php:2208
setBaseTaxInvoiced($baseTaxInvoiced)
Definition: Item.php:1882
setBaseRowInvoiced($baseRowInvoiced)
Definition: Item.php:1970
setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded)
Definition: Item.php:2093
setOrder(\Magento\Sales\Model\Order $order)
Definition: Item.php:285
setTaxInvoiced($taxInvoiced)
Definition: Item.php:1874
setBaseDiscountRefunded($baseDiscountRefunded)
Definition: Item.php:2152
setGwPriceRefunded($gwPriceRefunded)
Definition: Item.php:2240
setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced)
Definition: Item.php:2074
setQtyBackordered($qtyBackordered)
Definition: Item.php:1762
foreach($product->getExtensionAttributes() ->getBundleProductOptions() as $option) $buyRequest
setFreeShipping($freeShipping)
Definition: Item.php:2264
setBaseDiscountTaxCompensationAmount($amount)
Definition: Item.php:2066
setProductOptions(array $options=null)
Definition: Item.php:464
setWeeeTaxRowDisposition($weeeTaxRowDisposition)
Definition: Item.php:2336
setGwBasePriceRefunded($gwBasePriceRefunded)
Definition: Item.php:2232
setGwBaseTaxAmountInvoiced($gwBaseTaxAmountInvoiced)
Definition: Item.php:2216
setQtyInvoiced($qtyInvoiced)
Definition: Item.php:1778
setTaxPercent($taxPercent)
Definition: Item.php:1850
setBaseAmountRefunded($baseAmountRefunded)
Definition: Item.php:1938
setTaxCanceled($taxCanceled)
Definition: Item.php:2112
setQtyOrdered($qtyOrdered)
Definition: Item.php:1786
foreach($order->getItems() as $orderItem) $shipment
setQtyShipped($qtyShipped)
Definition: Item.php:1802
setTaxRefunded($taxRefunded)
Definition: Item.php:2128
$code
Definition: info.phtml:12
setBaseWeeeTaxAppliedAmount($amount)
Definition: Item.php:2288
if(!isset($_GET['name'])) $name
Definition: log.php:14