Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Order.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Sales\Model;
7 
24 
55 {
56  const ENTITY = 'order';
57 
61  const STATE_NEW = 'new';
62 
63  const STATE_PENDING_PAYMENT = 'pending_payment';
64 
65  const STATE_PROCESSING = 'processing';
66 
67  const STATE_COMPLETE = 'complete';
68 
69  const STATE_CLOSED = 'closed';
70 
71  const STATE_CANCELED = 'canceled';
72 
73  const STATE_HOLDED = 'holded';
74 
75  const STATE_PAYMENT_REVIEW = 'payment_review';
76 
80  const STATUS_FRAUD = 'fraud';
81 
85  const ACTION_FLAG_CANCEL = 'cancel';
86 
87  const ACTION_FLAG_HOLD = 'hold';
88 
89  const ACTION_FLAG_UNHOLD = 'unhold';
90 
91  const ACTION_FLAG_EDIT = 'edit';
92 
93  const ACTION_FLAG_CREDITMEMO = 'creditmemo';
94 
95  const ACTION_FLAG_INVOICE = 'invoice';
96 
97  const ACTION_FLAG_REORDER = 'reorder';
98 
99  const ACTION_FLAG_SHIP = 'ship';
100 
101  const ACTION_FLAG_COMMENT = 'comment';
102 
106  const REPORT_DATE_TYPE_CREATED = 'created';
107 
108  const REPORT_DATE_TYPE_UPDATED = 'updated';
109 
113  protected $_eventPrefix = 'sales_order';
114 
118  protected $_eventObject = 'order';
119 
123  protected $_invoices;
124 
128  protected $_tracks;
129 
133  protected $_shipments;
134 
138  protected $_creditmemos;
139 
143  protected $_relatedObjects = [];
144 
148  protected $_orderCurrency = null;
149 
153  protected $_baseCurrency = null;
154 
160  protected $_actionFlag = [];
161 
167  protected $_canSendNewEmailFlag = true;
168 
174  protected $entityType = 'order';
175 
179  protected $_storeManager;
180 
184  protected $_orderConfig;
185 
191 
196 
201 
206 
211 
215  protected $_currencyFactory;
216 
220  private $_eavConfig;
221 
226 
231 
236 
241 
246 
251 
256 
261 
266 
270  protected $priceCurrency;
271 
275  protected $timezone;
276 
280  private $localeResolver;
281 
313  public function __construct(
314  \Magento\Framework\Model\Context $context,
315  \Magento\Framework\Registry $registry,
316  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
318  \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone,
320  \Magento\Sales\Model\Order\Config $orderConfig,
321  \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
322  \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory $orderItemCollectionFactory,
323  \Magento\Catalog\Model\Product\Visibility $productVisibility,
324  \Magento\Sales\Api\InvoiceManagementInterface $invoiceManagement,
325  \Magento\Directory\Model\CurrencyFactory $currencyFactory,
326  \Magento\Eav\Model\Config $eavConfig,
327  \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory,
328  \Magento\Sales\Model\ResourceModel\Order\Address\CollectionFactory $addressCollectionFactory,
329  \Magento\Sales\Model\ResourceModel\Order\Payment\CollectionFactory $paymentCollectionFactory,
330  \Magento\Sales\Model\ResourceModel\Order\Status\History\CollectionFactory $historyCollectionFactory,
331  \Magento\Sales\Model\ResourceModel\Order\Invoice\CollectionFactory $invoiceCollectionFactory,
332  \Magento\Sales\Model\ResourceModel\Order\Shipment\CollectionFactory $shipmentCollectionFactory,
333  \Magento\Sales\Model\ResourceModel\Order\Creditmemo\CollectionFactory $memoCollectionFactory,
334  \Magento\Sales\Model\ResourceModel\Order\Shipment\Track\CollectionFactory $trackCollectionFactory,
335  \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $salesOrderCollectionFactory,
337  \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productListFactory,
338  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
339  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
340  array $data = [],
341  ResolverInterface $localeResolver = null
342  ) {
343  $this->_storeManager = $storeManager;
344  $this->_orderConfig = $orderConfig;
345  $this->productRepository = $productRepository;
346  $this->productListFactory = $productListFactory;
347  $this->timezone = $timezone;
348  $this->_orderItemCollectionFactory = $orderItemCollectionFactory;
349  $this->_productVisibility = $productVisibility;
350  $this->invoiceManagement = $invoiceManagement;
351  $this->_currencyFactory = $currencyFactory;
352  $this->_eavConfig = $eavConfig;
353  $this->_orderHistoryFactory = $orderHistoryFactory;
354  $this->_addressCollectionFactory = $addressCollectionFactory;
355  $this->_paymentCollectionFactory = $paymentCollectionFactory;
356  $this->_historyCollectionFactory = $historyCollectionFactory;
357  $this->_invoiceCollectionFactory = $invoiceCollectionFactory;
358  $this->_shipmentCollectionFactory = $shipmentCollectionFactory;
359  $this->_memoCollectionFactory = $memoCollectionFactory;
360  $this->_trackCollectionFactory = $trackCollectionFactory;
361  $this->salesOrderCollectionFactory = $salesOrderCollectionFactory;
362  $this->priceCurrency = $priceCurrency;
363  $this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(ResolverInterface::class);
364 
365  parent::__construct(
366  $context,
367  $registry,
368  $extensionFactory,
370  $resource,
371  $resourceCollection,
372  $data
373  );
374  }
375 
381  protected function _construct()
382  {
383  $this->_init(\Magento\Sales\Model\ResourceModel\Order::class);
384  }
385 
392  public function unsetData($key = null)
393  {
394  parent::unsetData($key);
395  if ($key === null) {
396  $this->setItems(null);
397  }
398  return $this;
399  }
400 
407  public function getActionFlag($action)
408  {
409  if (isset($this->_actionFlag[$action])) {
410  return $this->_actionFlag[$action];
411  }
412  return null;
413  }
414 
422  public function setActionFlag($action, $flag)
423  {
424  $this->_actionFlag[$action] = (bool)$flag;
425  return $this;
426  }
427 
434  public function getCanSendNewEmailFlag()
435  {
437  }
438 
445  public function setCanSendNewEmailFlag($flag)
446  {
447  $this->_canSendNewEmailFlag = (bool)$flag;
448  return $this;
449  }
450 
457  public function loadByIncrementId($incrementId)
458  {
459  return $this->loadByAttribute('increment_id', $incrementId);
460  }
461 
469  public function loadByIncrementIdAndStoreId($incrementId, $storeId)
470  {
471  $orderCollection = $this->getSalesOrderCollection(
472  [
473  'increment_id' => $incrementId,
474  'store_id' => $storeId
475  ]
476  );
477  return $orderCollection->getFirstItem();
478  }
479 
486  protected function getSalesOrderCollection(array $filters = [])
487  {
489  $salesOrderCollection = $this->salesOrderCollectionFactory->create();
490  foreach ($filters as $field => $condition) {
491  $salesOrderCollection->addFieldToFilter($field, $condition);
492  }
493  return $salesOrderCollection->load();
494  }
495 
504  {
505  $this->load($value, $attribute);
506  return $this;
507  }
508 
514  public function getStore()
515  {
516  $storeId = $this->getStoreId();
517  if ($storeId) {
518  return $this->_storeManager->getStore($storeId);
519  }
520  return $this->_storeManager->getStore();
521  }
522 
530  public function canCancel()
531  {
532  if (!$this->_canVoidOrder()) {
533  return false;
534  }
535  if ($this->canUnhold()) {
536  return false;
537  }
538  if (!$this->canReviewPayment() && $this->canFetchPaymentReviewUpdate()) {
539  return false;
540  }
541 
542  $allInvoiced = true;
543  foreach ($this->getAllItems() as $item) {
544  if ($item->getQtyToInvoice()) {
545  $allInvoiced = false;
546  break;
547  }
548  }
549 
550  if ($allInvoiced) {
551  return false;
552  }
553 
554  $state = $this->getState();
555  if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) {
556  return false;
557  }
558 
559  if ($this->getActionFlag(self::ACTION_FLAG_CANCEL) === false) {
560  return false;
561  }
562 
563  return true;
564  }
565 
571  public function canVoidPayment()
572  {
573  return $this->_canVoidOrder() ? $this->getPayment()->canVoid() : false;
574  }
575 
581  protected function _canVoidOrder()
582  {
583  return !($this->isCanceled() || $this->canUnhold() || $this->isPaymentReview());
584  }
585 
592  public function canInvoice()
593  {
594  if ($this->canUnhold() || $this->isPaymentReview()) {
595  return false;
596  }
597  $state = $this->getState();
598  if ($this->isCanceled() || $state === self::STATE_COMPLETE || $state === self::STATE_CLOSED) {
599  return false;
600  }
601 
602  if ($this->getActionFlag(self::ACTION_FLAG_INVOICE) === false) {
603  return false;
604  }
605 
606  foreach ($this->getAllItems() as $item) {
607  if ($item->getQtyToInvoice() > 0 && !$item->getLockedDoInvoice()) {
608  return true;
609  }
610  }
611  return false;
612  }
613 
619  public function canCreditmemo()
620  {
621  if ($this->hasForcedCanCreditmemo()) {
622  return $this->getForcedCanCreditmemo();
623  }
624 
625  if ($this->canUnhold() || $this->isPaymentReview()) {
626  return false;
627  }
628 
629  if ($this->isCanceled() || $this->getState() === self::STATE_CLOSED) {
630  return false;
631  }
632 
638  $totalRefunded = $this->priceCurrency->round($this->getTotalPaid()) - $this->getTotalRefunded();
639  if (abs($totalRefunded) < .0001) {
640  return false;
641  }
642  // Case when Adjustment Fee (adjustment_negative) has been used for first creditmemo
643  if (abs($totalRefunded - $this->getAdjustmentNegative()) < .0001) {
644  return false;
645  }
646 
647  if ($this->getActionFlag(self::ACTION_FLAG_EDIT) === false) {
648  return false;
649  }
650  return true;
651  }
652 
658  public function canHold()
659  {
660  $notHoldableStates = [
666  ];
667  if (in_array($this->getState(), $notHoldableStates)) {
668  return false;
669  }
670 
671  if ($this->getActionFlag(self::ACTION_FLAG_HOLD) === false) {
672  return false;
673  }
674  return true;
675  }
676 
682  public function canUnhold()
683  {
684  if ($this->getActionFlag(self::ACTION_FLAG_UNHOLD) === false || $this->isPaymentReview()) {
685  return false;
686  }
687  return $this->getState() === self::STATE_HOLDED;
688  }
689 
695  public function canComment()
696  {
697  if ($this->getActionFlag(self::ACTION_FLAG_COMMENT) === false) {
698  return false;
699  }
700  return true;
701  }
702 
709  public function canShip()
710  {
711  if ($this->canUnhold() || $this->isPaymentReview()) {
712  return false;
713  }
714 
715  if ($this->getIsVirtual() || $this->isCanceled()) {
716  return false;
717  }
718 
719  if ($this->getActionFlag(self::ACTION_FLAG_SHIP) === false) {
720  return false;
721  }
722 
723  foreach ($this->getAllItems() as $item) {
724  if ($item->getQtyToShip() > 0 && !$item->getIsVirtual() && !$item->getLockedDoShip()) {
725  return true;
726  }
727  }
728  return false;
729  }
730 
736  public function canEdit()
737  {
738  if ($this->canUnhold()) {
739  return false;
740  }
741 
742  $state = $this->getState();
743  if ($this->isCanceled() ||
744  $this->isPaymentReview() ||
745  $state === self::STATE_COMPLETE ||
746  $state === self::STATE_CLOSED
747  ) {
748  return false;
749  }
750 
751  if ($this->hasInvoices()) {
752  return false;
753  }
754 
755  if (!$this->getPayment()->getMethodInstance()->canEdit()) {
756  return false;
757  }
758 
759  if ($this->getActionFlag(self::ACTION_FLAG_EDIT) === false) {
760  return false;
761  }
762 
763  return true;
764  }
765 
771  public function canReorder()
772  {
773  return $this->_canReorder(false);
774  }
775 
781  public function canReorderIgnoreSalable()
782  {
783  return $this->_canReorder(true);
784  }
785 
793  protected function _canReorder($ignoreSalable = false)
794  {
795  if ($this->canUnhold() || $this->isPaymentReview()) {
796  return false;
797  }
798 
799  if ($this->getActionFlag(self::ACTION_FLAG_REORDER) === false) {
800  return false;
801  }
802 
803  $products = [];
804  $itemsCollection = $this->getItemsCollection();
805  foreach ($itemsCollection as $item) {
806  $products[] = $item->getProductId();
807  }
808 
809  if (!empty($products)) {
810  $productsCollection = $this->productListFactory->create()
811  ->setStoreId($this->getStoreId())
812  ->addIdFilter($products)
813  ->addAttributeToSelect('status')
814  ->load();
815 
816  foreach ($itemsCollection as $item) {
817  $product = $productsCollection->getItemById($item->getProductId());
818  if (!$product) {
819  return false;
820  }
821  if (!$ignoreSalable && !$product->isSalable()) {
822  return false;
823  }
824  }
825  }
826 
827  return true;
828  }
829 
838  public function isPaymentReview()
839  {
840  return $this->getState() === self::STATE_PAYMENT_REVIEW;
841  }
842 
848  public function canReviewPayment()
849  {
850  return $this->isPaymentReview() && $this->getPayment()->canReviewPayment();
851  }
852 
858  public function canFetchPaymentReviewUpdate()
859  {
860  return $this->isPaymentReview() && $this->getPayment()->canFetchTransactionInfo();
861  }
862 
868  public function getConfig()
869  {
870  return $this->_orderConfig;
871  }
872 
878  protected function _placePayment()
879  {
880  $this->getPayment()->place();
881  return $this;
882  }
883 
887  public function getPayment()
888  {
890  if ($payment === null) {
891  $paymentItems = $this->getPaymentsCollection()->getItems();
892  if (count($paymentItems)) {
893  $payment = reset($paymentItems);
894  $this->setData(
896  $payment
897  );
898  }
899  }
900  if ($payment) {
901  $payment->setOrder($this);
902  }
903  return $payment;
904  }
905 
912  public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $address = null)
913  {
914  $old = $this->getBillingAddress();
915  if (!empty($old) && !empty($address)) {
916  $address->setId($old->getId());
917  }
918 
919  if (!empty($address)) {
920  $address->setEmail($this->getCustomerEmail());
921  $this->addAddress($address->setAddressType('billing'));
922  }
923  return $this;
924  }
925 
932  public function setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $address = null)
933  {
934  $old = $this->getShippingAddress();
935  if (!empty($old) && !empty($address)) {
936  $address->setId($old->getId());
937  }
938 
939  if (!empty($address)) {
940  $address->setEmail($this->getCustomerEmail());
941  $this->addAddress($address->setAddressType('shipping'));
942  }
943  return $this;
944  }
945 
951  public function getBillingAddress()
952  {
953  foreach ($this->getAddresses() as $address) {
954  if ($address->getAddressType() == 'billing' && !$address->isDeleted()) {
955  return $address;
956  }
957  }
958  return null;
959  }
960 
966  public function getShippingAddress()
967  {
968  foreach ($this->getAddresses() as $address) {
969  if ($address->getAddressType() == 'shipping' && !$address->isDeleted()) {
970  return $address;
971  }
972  }
973  return null;
974  }
975 
982  public function setState($state)
983  {
984  return $this->setData(self::STATE, $state);
985  }
986 
992  public function getStatusLabel()
993  {
994  return $this->getConfig()->getStatusLabel($this->getStatus());
995  }
996 
1005  public function addStatusToHistory($status, $comment = '', $isCustomerNotified = false)
1006  {
1007  $this->addStatusHistoryComment($comment, $status)->setIsCustomerNotified($isCustomerNotified);
1008  return $this;
1009  }
1010 
1022  public function addStatusHistoryComment($comment, $status = false)
1023  {
1024  return $this->addCommentToStatusHistory($comment, $status, false);
1025  }
1026 
1038  public function addCommentToStatusHistory($comment, $status = false, $isVisibleOnFront = false)
1039  {
1040  if (false === $status) {
1041  $status = $this->getStatus();
1042  } elseif (true === $status) {
1043  $status = $this->getConfig()->getStateDefaultStatus($this->getState());
1044  } else {
1045  $this->setStatus($status);
1046  }
1047  $history = $this->_orderHistoryFactory->create()->setStatus(
1048  $status
1049  )->setComment(
1050  $comment
1051  )->setEntityName(
1052  $this->entityType
1053  )->setIsVisibleOnFront(
1054  $isVisibleOnFront
1055  );
1056  $this->addStatusHistory($history);
1057  return $history;
1058  }
1059 
1066  public function setHistoryEntityName($entityName)
1067  {
1068  $this->entityType = $entityName;
1069  return $this;
1070  }
1071 
1077  public function getEntityType()
1078  {
1079  return $this->entityType;
1080  }
1081 
1087  public function place()
1088  {
1089  $this->_eventManager->dispatch('sales_order_place_before', ['order' => $this]);
1090  $this->_placePayment();
1091  $this->_eventManager->dispatch('sales_order_place_after', ['order' => $this]);
1092  return $this;
1093  }
1094 
1101  public function hold()
1102  {
1103  if (!$this->canHold()) {
1104  throw new \Magento\Framework\Exception\LocalizedException(__('A hold action is not available.'));
1105  }
1106  $this->setHoldBeforeState($this->getState());
1107  $this->setHoldBeforeStatus($this->getStatus());
1108  $this->setState(self::STATE_HOLDED)
1109  ->setStatus($this->getConfig()->getStateDefaultStatus(self::STATE_HOLDED));
1110  return $this;
1111  }
1112 
1119  public function unhold()
1120  {
1121  if (!$this->canUnhold()) {
1122  throw new \Magento\Framework\Exception\LocalizedException(__('You cannot remove the hold.'));
1123  }
1124 
1125  $this->setState($this->getHoldBeforeState())
1126  ->setStatus($this->getHoldBeforeStatus());
1127  $this->setHoldBeforeState(null);
1128  $this->setHoldBeforeStatus(null);
1129  return $this;
1130  }
1131 
1137  public function cancel()
1138  {
1139  if ($this->canCancel()) {
1140  $this->getPayment()->cancel();
1141  $this->registerCancellation();
1142 
1143  $this->_eventManager->dispatch('order_cancel_after', ['order' => $this]);
1144  }
1145 
1146  return $this;
1147  }
1148 
1154  public function isFraudDetected()
1155  {
1156  return $this->getOrigData(self::STATE) == self::STATE_PAYMENT_REVIEW
1157  && $this->getOrigData(self::STATUS) == self::STATUS_FRAUD;
1158  }
1159 
1169  public function registerCancellation($comment = '', $graceful = true)
1170  {
1171  if ($this->canCancel() || $this->isPaymentReview() || $this->isFraudDetected()) {
1172  $state = self::STATE_CANCELED;
1173  foreach ($this->getAllItems() as $item) {
1174  if ($state != self::STATE_PROCESSING && $item->getQtyToRefund()) {
1175  if ($item->isProcessingAvailable()) {
1176  $state = self::STATE_PROCESSING;
1177  } else {
1178  $state = self::STATE_COMPLETE;
1179  }
1180  }
1181  $item->cancel();
1182  }
1183 
1184  $this->setSubtotalCanceled($this->getSubtotal() - $this->getSubtotalInvoiced());
1186 
1187  $this->setTaxCanceled($this->getTaxAmount() - $this->getTaxInvoiced());
1188  $this->setBaseTaxCanceled($this->getBaseTaxAmount() - $this->getBaseTaxInvoiced());
1189 
1190  $this->setShippingCanceled($this->getShippingAmount() - $this->getShippingInvoiced());
1192 
1193  $this->setDiscountCanceled(abs($this->getDiscountAmount()) - $this->getDiscountInvoiced());
1195 
1196  $this->setTotalCanceled($this->getGrandTotal() - $this->getTotalPaid());
1197  $this->setBaseTotalCanceled($this->getBaseGrandTotal() - $this->getBaseTotalPaid());
1198 
1199  $this->setState($state)
1200  ->setStatus($this->getConfig()->getStateDefaultStatus($state));
1201  if (!empty($comment)) {
1202  $this->addStatusHistoryComment($comment, false);
1203  }
1204  } elseif (!$graceful) {
1205  throw new \Magento\Framework\Exception\LocalizedException(__('We cannot cancel this order.'));
1206  }
1207  return $this;
1208  }
1209 
1215  public function getTrackingNumbers()
1216  {
1217  if ($this->getData('tracking_numbers')) {
1218  return explode(',', $this->getData('tracking_numbers'));
1219  }
1220  return [];
1221  }
1222 
1229  public function getShippingMethod($asObject = false)
1230  {
1231  $shippingMethod = parent::getShippingMethod();
1232  if (!$asObject) {
1233  return $shippingMethod;
1234  } else {
1235  list($carrierCode, $method) = explode('_', $shippingMethod, 2);
1236  return new \Magento\Framework\DataObject(['carrier_code' => $carrierCode, 'method' => $method]);
1237  }
1238  }
1239 
1240  /*********************** ADDRESSES ***************************/
1241 
1247  public function getAddressesCollection()
1248  {
1249  $collection = $this->_addressCollectionFactory->create()->setOrderFilter($this);
1250  if ($this->getId()) {
1251  foreach ($collection as $address) {
1252  $address->setOrder($this);
1253  }
1254  }
1255  return $collection;
1256  }
1257 
1264  public function getAddressById($addressId)
1265  {
1266  foreach ($this->getAddressesCollection() as $address) {
1267  if ($address->getId() == $addressId) {
1268  return $address;
1269  }
1270  }
1271  return false;
1272  }
1273 
1280  public function addAddress(\Magento\Sales\Model\Order\Address $address)
1281  {
1282  $address->setOrder($this)->setParentId($this->getId());
1283  if (!$address->getId()) {
1284  $this->setAddresses(array_merge($this->getAddresses(), [$address]));
1285  $this->setDataChanges(true);
1286  }
1287  return $this;
1288  }
1289 
1297  public function getItemsCollection($filterByTypes = [], $nonChildrenOnly = false)
1298  {
1299  $collection = $this->_orderItemCollectionFactory->create()->setOrderFilter($this);
1300 
1301  if ($filterByTypes) {
1302  $collection->filterByTypes($filterByTypes);
1303  }
1304  if ($nonChildrenOnly) {
1305  $collection->filterByParent();
1306  }
1307 
1308  if ($this->getId()) {
1309  foreach ($collection as $item) {
1310  $item->setOrder($this);
1311  }
1312  }
1313  return $collection;
1314  }
1315 
1322  public function getParentItemsRandomCollection($limit = 1)
1323  {
1324  return $this->_getItemsRandomCollection($limit, true);
1325  }
1326 
1334  protected function _getItemsRandomCollection($limit, $nonChildrenOnly = false)
1335  {
1336  $collection = $this->_orderItemCollectionFactory->create()
1337  ->setOrderFilter($this)
1338  ->setRandomOrder()
1339  ->setPageSize($limit);
1340 
1341  if ($nonChildrenOnly) {
1342  $collection->filterByParent();
1343  }
1344  $products = [];
1345  foreach ($collection as $item) {
1346  $products[] = $item->getProductId();
1347  }
1348 
1349  $productsCollection = $this->productListFactory->create()->addIdFilter(
1350  $products
1351  )->setVisibility(
1352  $this->_productVisibility->getVisibleInSiteIds()
1353  )->addPriceData()->load();
1354 
1355  foreach ($collection as $item) {
1356  $product = $productsCollection->getItemById($item->getProductId());
1357  if ($product) {
1358  $item->setProduct($product);
1359  }
1360  }
1361 
1362  return $collection;
1363  }
1364 
1370  public function getAllItems()
1371  {
1372  $items = [];
1373  foreach ($this->getItems() as $item) {
1374  if (!$item->isDeleted()) {
1375  $items[] = $item;
1376  }
1377  }
1378  return $items;
1379  }
1380 
1386  public function getAllVisibleItems()
1387  {
1388  $items = [];
1389  foreach ($this->getItems() as $item) {
1390  if (!$item->isDeleted() && !$item->getParentItemId()) {
1391  $items[] = $item;
1392  }
1393  }
1394  return $items;
1395  }
1396 
1403  public function getItemById($itemId)
1404  {
1405  $items = $this->getItems();
1406 
1407  if (isset($items[$itemId])) {
1408  return $items[$itemId];
1409  }
1410 
1411  return null;
1412  }
1413 
1421  {
1422  foreach ($this->getItems() as $item) {
1423  if ($item->getQuoteItemId() == $quoteItemId) {
1424  return $item;
1425  }
1426  }
1427  return null;
1428  }
1429 
1436  public function addItem(\Magento\Sales\Model\Order\Item $item)
1437  {
1438  $item->setOrder($this);
1439  if (!$item->getId()) {
1440  $this->setItems(array_merge($this->getItems(), [$item]));
1441  }
1442  return $this;
1443  }
1444 
1445  /*********************** PAYMENTS ***************************/
1446 
1452  public function getPaymentsCollection()
1453  {
1454  $collection = $this->_paymentCollectionFactory->create()->setOrderFilter($this);
1455  if ($this->getId()) {
1456  foreach ($collection as $payment) {
1457  $payment->setOrder($this);
1458  }
1459  }
1460  return $collection;
1461  }
1462 
1468  public function getAllPayments()
1469  {
1470  $payments = [];
1471  foreach ($this->getPaymentsCollection() as $payment) {
1472  if (!$payment->isDeleted()) {
1473  $payments[] = $payment;
1474  }
1475  }
1476  return $payments;
1477  }
1478 
1485  public function getPaymentById($paymentId)
1486  {
1487  foreach ($this->getPaymentsCollection() as $payment) {
1488  if ($payment->getId() == $paymentId) {
1489  return $payment;
1490  }
1491  }
1492  return false;
1493  }
1494 
1498  public function setPayment(\Magento\Sales\Api\Data\OrderPaymentInterface $payment = null)
1499  {
1501  if ($payment !== null) {
1502  $payment->setOrder($this)->setParentId($this->getId());
1503  if (!$payment->getId()) {
1504  $this->setDataChanges(true);
1505  }
1506  }
1507  return $payment;
1508  }
1509 
1510  /*********************** STATUSES ***************************/
1511 
1517  public function getStatusHistoryCollection()
1518  {
1519  $collection = $this->_historyCollectionFactory->create()->setOrderFilter($this)
1520  ->setOrder('created_at', 'desc')
1521  ->setOrder('entity_id', 'desc');
1522  if ($this->getId()) {
1523  foreach ($collection as $status) {
1524  $status->setOrder($this);
1525  }
1526  }
1527  return $collection;
1528  }
1529 
1535  public function getAllStatusHistory()
1536  {
1537  $history = [];
1538  foreach ($this->getStatusHistoryCollection() as $status) {
1539  if (!$status->isDeleted()) {
1540  $history[] = $status;
1541  }
1542  }
1543  return $history;
1544  }
1545 
1551  public function getVisibleStatusHistory()
1552  {
1553  $history = [];
1554  foreach ($this->getStatusHistoryCollection() as $status) {
1555  if (!$status->isDeleted() && $status->getComment() && $status->getIsVisibleOnFront()) {
1556  $history[] = $status;
1557  }
1558  }
1559  return $history;
1560  }
1561 
1568  public function getStatusHistoryById($statusId)
1569  {
1570  foreach ($this->getStatusHistoryCollection() as $status) {
1571  if ($status->getId() == $statusId) {
1572  return $status;
1573  }
1574  }
1575  return false;
1576  }
1577 
1588  public function addStatusHistory(\Magento\Sales\Model\Order\Status\History $history)
1589  {
1590  $history->setOrder($this);
1591  $this->setStatus($history->getStatus());
1592  if (!$history->getId()) {
1593  $this->setStatusHistories(array_merge($this->getStatusHistories(), [$history]));
1594  $this->setDataChanges(true);
1595  }
1596  return $this;
1597  }
1598 
1604  public function getRealOrderId()
1605  {
1606  $id = $this->getData('real_order_id');
1607  if ($id === null) {
1608  $id = $this->getIncrementId();
1609  }
1610  return $id;
1611  }
1612 
1618  public function getOrderCurrency()
1619  {
1620  if ($this->_orderCurrency === null) {
1621  $this->_orderCurrency = $this->_currencyFactory->create();
1622  $this->_orderCurrency->load($this->getOrderCurrencyCode());
1623  }
1624  return $this->_orderCurrency;
1625  }
1626 
1634  public function formatPrice($price, $addBrackets = false)
1635  {
1636  return $this->formatPricePrecision($price, 2, $addBrackets);
1637  }
1638 
1647  public function formatPricePrecision($price, $precision, $addBrackets = false)
1648  {
1649  return $this->getOrderCurrency()->formatPrecision($price, $precision, [], true, $addBrackets);
1650  }
1651 
1658  public function formatPriceTxt($price)
1659  {
1660  return $this->getOrderCurrency()->formatTxt($price);
1661  }
1662 
1668  public function getBaseCurrency()
1669  {
1670  if ($this->_baseCurrency === null) {
1671  $this->_baseCurrency = $this->_currencyFactory->create()->load($this->getBaseCurrencyCode());
1672  }
1673  return $this->_baseCurrency;
1674  }
1675 
1682  public function formatBasePrice($price)
1683  {
1684  return $this->formatBasePricePrecision($price, 2);
1685  }
1686 
1694  public function formatBasePricePrecision($price, $precision)
1695  {
1696  return $this->getBaseCurrency()->formatPrecision($price, $precision);
1697  }
1698 
1704  public function isCurrencyDifferent()
1705  {
1706  return $this->getOrderCurrencyCode() != $this->getBaseCurrencyCode();
1707  }
1708 
1714  public function getTotalDue()
1715  {
1716  $total = $this->getGrandTotal() - $this->getTotalPaid();
1717  $total = $this->priceCurrency->round($total);
1718  return max($total, 0);
1719  }
1720 
1726  public function getBaseTotalDue()
1727  {
1728  $total = $this->getBaseGrandTotal() - $this->getBaseTotalPaid();
1729  $total = $this->priceCurrency->round($total);
1730  return max($total, 0);
1731  }
1732 
1740  public function getData($key = '', $index = null)
1741  {
1742  if ($key == 'total_due') {
1743  return $this->getTotalDue();
1744  }
1745  if ($key == 'base_total_due') {
1746  return $this->getBaseTotalDue();
1747  }
1748  return parent::getData($key, $index);
1749  }
1750 
1756  public function getInvoiceCollection()
1757  {
1758  if ($this->_invoices === null) {
1759  $this->_invoices = $this->_invoiceCollectionFactory->create()->setOrderFilter($this);
1760 
1761  if ($this->getId()) {
1762  foreach ($this->_invoices as $invoice) {
1763  $invoice->setOrder($this);
1764  }
1765  }
1766  }
1767  return $this->_invoices;
1768  }
1769 
1776  public function setInvoiceCollection(InvoiceCollection $invoices)
1777  {
1778  $this->_invoices = $invoices;
1779  return $this;
1780  }
1781 
1787  public function getShipmentsCollection()
1788  {
1789  if (empty($this->_shipments)) {
1790  if ($this->getId()) {
1791  $this->_shipments = $this->_shipmentCollectionFactory->create()->setOrderFilter($this)->load();
1792  } else {
1793  return false;
1794  }
1795  }
1796  return $this->_shipments;
1797  }
1798 
1804  public function getCreditmemosCollection()
1805  {
1806  if (empty($this->_creditmemos)) {
1807  if ($this->getId()) {
1808  $this->_creditmemos = $this->_memoCollectionFactory->create()->setOrderFilter($this)->load();
1809  } else {
1810  return false;
1811  }
1812  }
1813  return $this->_creditmemos;
1814  }
1815 
1821  public function getTracksCollection()
1822  {
1823  if (empty($this->_tracks)) {
1824  $this->_tracks = $this->_trackCollectionFactory->create()->setOrderFilter($this);
1825 
1826  if ($this->getId()) {
1827  $this->_tracks->load();
1828  }
1829  }
1830  return $this->_tracks;
1831  }
1832 
1838  public function hasInvoices()
1839  {
1840  return (bool)$this->getInvoiceCollection()->count();
1841  }
1842 
1848  public function hasShipments()
1849  {
1850  return (bool)$this->getShipmentsCollection()->count();
1851  }
1852 
1858  public function hasCreditmemos()
1859  {
1860  return (bool)$this->getCreditmemosCollection()->count();
1861  }
1862 
1870  public function getRelatedObjects()
1871  {
1872  return $this->_relatedObjects;
1873  }
1874 
1880  public function getCustomerName()
1881  {
1882  if ($this->getCustomerFirstname()) {
1883  $customerName = $this->getCustomerFirstname() . ' ' . $this->getCustomerLastname();
1884  } else {
1885  $customerName = (string)__('Guest');
1886  }
1887  return $customerName;
1888  }
1889 
1896  public function addRelatedObject(\Magento\Framework\Model\AbstractModel $object)
1897  {
1898  $this->_relatedObjects[] = $object;
1899  return $this;
1900  }
1901 
1909  {
1910  return $this->timezone->formatDateTime(
1911  new \DateTime($this->getCreatedAt()),
1912  $format,
1913  $format,
1914  $this->localeResolver->getDefaultLocale(),
1915  $this->timezone->getConfigTimezone('store', $this->getStore())
1916  );
1917  }
1918 
1924  public function getEmailCustomerNote()
1925  {
1926  if ($this->getCustomerNoteNotify()) {
1927  return $this->getCustomerNote();
1928  }
1929  return '';
1930  }
1931 
1937  public function getStoreGroupName()
1938  {
1939  $storeId = $this->getStoreId();
1940  if ($storeId === null) {
1941  return $this->getStoreName(1);
1942  }
1943  return $this->getStore()->getGroup()->getName();
1944  }
1945 
1951  public function reset()
1952  {
1953  $this->unsetData();
1954  $this->_actionFlag = [];
1955  $this->setAddresses(null);
1956  $this->setItems(null);
1957  $this->setPayment(null);
1958  $this->setStatusHistories(null);
1959  $this->_invoices = null;
1960  $this->_tracks = null;
1961  $this->_shipments = null;
1962  $this->_creditmemos = null;
1963  $this->_relatedObjects = [];
1964  $this->_orderCurrency = null;
1965  $this->_baseCurrency = null;
1966 
1967  return $this;
1968  }
1969 
1976  public function getIsNotVirtual()
1977  {
1978  return !$this->getIsVirtual();
1979  }
1980 
1987  public function prepareInvoice($qtys = [])
1988  {
1989  return $this->invoiceManagement->prepareInvoice($this, $qtys);
1990  }
1991 
1997  public function isCanceled()
1998  {
1999  return $this->getState() === self::STATE_CANCELED;
2000  }
2001 
2009  public function getIncrementId()
2010  {
2011  return $this->getData('increment_id');
2012  }
2013 
2019  public function getItems()
2020  {
2021  if ($this->getData(OrderInterface::ITEMS) == null) {
2022  $this->setData(
2024  $this->getItemsCollection()->getItems()
2025  );
2026  }
2027  return $this->getData(OrderInterface::ITEMS);
2028  }
2029 
2034  public function setItems($items)
2035  {
2036  return $this->setData(OrderInterface::ITEMS, $items);
2037  }
2038 
2044  public function getAddresses()
2045  {
2046  if ($this->getData('addresses') == null) {
2047  $this->setData(
2048  'addresses',
2049  $this->getAddressesCollection()->getItems()
2050  );
2051  }
2052  return $this->getData('addresses');
2053  }
2054 
2060  public function getStatusHistories()
2061  {
2062  if ($this->getData(OrderInterface::STATUS_HISTORIES) == null) {
2063  $this->setData(
2066  );
2067  }
2069  }
2070 
2076  public function getExtensionAttributes()
2077  {
2078  return $this->_getExtensionAttributes();
2079  }
2080 
2087  public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes)
2088  {
2089  return $this->_setExtensionAttributes($extensionAttributes);
2090  }
2091 
2092  //@codeCoverageIgnoreStart
2093 
2099  public function getAdjustmentNegative()
2100  {
2102  }
2103 
2109  public function getAdjustmentPositive()
2110  {
2112  }
2113 
2119  public function getAppliedRuleIds()
2120  {
2122  }
2123 
2129  public function getBaseAdjustmentNegative()
2130  {
2132  }
2133 
2139  public function getBaseAdjustmentPositive()
2140  {
2142  }
2143 
2149  public function getBaseCurrencyCode()
2150  {
2152  }
2153 
2159  public function getBaseDiscountAmount()
2160  {
2162  }
2163 
2169  public function getBaseDiscountCanceled()
2170  {
2172  }
2173 
2179  public function getBaseDiscountInvoiced()
2180  {
2182  }
2183 
2189  public function getBaseDiscountRefunded()
2190  {
2192  }
2193 
2199  public function getBaseGrandTotal()
2200  {
2202  }
2203 
2210  {
2212  }
2213 
2220  {
2222  }
2223 
2230  {
2232  }
2233 
2239  public function getBaseShippingAmount()
2240  {
2242  }
2243 
2249  public function getBaseShippingCanceled()
2250  {
2252  }
2253 
2260  {
2262  }
2263 
2270  {
2272  }
2273 
2279  public function getBaseShippingInclTax()
2280  {
2282  }
2283 
2289  public function getBaseShippingInvoiced()
2290  {
2292  }
2293 
2299  public function getBaseShippingRefunded()
2300  {
2302  }
2303 
2309  public function getBaseShippingTaxAmount()
2310  {
2312  }
2313 
2319  public function getBaseShippingTaxRefunded()
2320  {
2322  }
2323 
2329  public function getBaseSubtotal()
2330  {
2331  return $this->getData(OrderInterface::BASE_SUBTOTAL);
2332  }
2333 
2339  public function getBaseSubtotalCanceled()
2340  {
2342  }
2343 
2349  public function getBaseSubtotalInclTax()
2350  {
2352  }
2353 
2359  public function getBaseSubtotalInvoiced()
2360  {
2362  }
2363 
2369  public function getBaseSubtotalRefunded()
2370  {
2372  }
2373 
2379  public function getBaseTaxAmount()
2380  {
2382  }
2383 
2389  public function getBaseTaxCanceled()
2390  {
2392  }
2393 
2399  public function getBaseTaxInvoiced()
2400  {
2402  }
2403 
2409  public function getBaseTaxRefunded()
2410  {
2412  }
2413 
2419  public function getBaseTotalCanceled()
2420  {
2422  }
2423 
2429  public function getBaseTotalInvoiced()
2430  {
2432  }
2433 
2439  public function getBaseTotalInvoicedCost()
2440  {
2442  }
2443 
2450  {
2452  }
2453 
2459  public function getBaseTotalOnlineRefunded()
2460  {
2462  }
2463 
2469  public function getBaseTotalPaid()
2470  {
2472  }
2473 
2479  public function getBaseTotalQtyOrdered()
2480  {
2482  }
2483 
2489  public function getBaseTotalRefunded()
2490  {
2492  }
2493 
2499  public function getBaseToGlobalRate()
2500  {
2502  }
2503 
2509  public function getBaseToOrderRate()
2510  {
2512  }
2513 
2519  public function getBillingAddressId()
2520  {
2522  }
2523 
2529  public function getCanShipPartially()
2530  {
2532  }
2533 
2539  public function getCanShipPartiallyItem()
2540  {
2542  }
2543 
2549  public function getCouponCode()
2550  {
2551  return $this->getData(OrderInterface::COUPON_CODE);
2552  }
2553 
2559  public function getCreatedAt()
2560  {
2561  return $this->getData(OrderInterface::CREATED_AT);
2562  }
2563 
2567  public function setCreatedAt($createdAt)
2568  {
2569  return $this->setData(OrderInterface::CREATED_AT, $createdAt);
2570  }
2571 
2577  public function getCustomerDob()
2578  {
2579  return $this->getData(OrderInterface::CUSTOMER_DOB);
2580  }
2581 
2587  public function getCustomerEmail()
2588  {
2589  return $this->getData(OrderInterface::CUSTOMER_EMAIL);
2590  }
2591 
2597  public function getCustomerFirstname()
2598  {
2600  }
2601 
2607  public function getCustomerGender()
2608  {
2610  }
2611 
2617  public function getCustomerGroupId()
2618  {
2620  }
2621 
2627  public function getCustomerId()
2628  {
2629  return $this->getData(OrderInterface::CUSTOMER_ID);
2630  }
2631 
2637  public function getCustomerIsGuest()
2638  {
2640  }
2641 
2647  public function getCustomerLastname()
2648  {
2650  }
2651 
2657  public function getCustomerMiddlename()
2658  {
2660  }
2661 
2667  public function getCustomerNote()
2668  {
2669  return $this->getData(OrderInterface::CUSTOMER_NOTE);
2670  }
2671 
2677  public function getCustomerNoteNotify()
2678  {
2680  }
2681 
2687  public function getCustomerPrefix()
2688  {
2690  }
2691 
2697  public function getCustomerSuffix()
2698  {
2700  }
2701 
2707  public function getCustomerTaxvat()
2708  {
2710  }
2711 
2717  public function getDiscountAmount()
2718  {
2720  }
2721 
2727  public function getDiscountCanceled()
2728  {
2730  }
2731 
2737  public function getDiscountDescription()
2738  {
2740  }
2741 
2747  public function getDiscountInvoiced()
2748  {
2750  }
2751 
2757  public function getDiscountRefunded()
2758  {
2760  }
2761 
2767  public function getEditIncrement()
2768  {
2769  return $this->getData(OrderInterface::EDIT_INCREMENT);
2770  }
2771 
2777  public function getEmailSent()
2778  {
2779  return $this->getData(OrderInterface::EMAIL_SENT);
2780  }
2781 
2787  public function getExtCustomerId()
2788  {
2790  }
2791 
2797  public function getExtOrderId()
2798  {
2799  return $this->getData(OrderInterface::EXT_ORDER_ID);
2800  }
2801 
2808  {
2810  }
2811 
2817  public function getGlobalCurrencyCode()
2818  {
2820  }
2821 
2827  public function getGrandTotal()
2828  {
2829  return $this->getData(OrderInterface::GRAND_TOTAL);
2830  }
2831 
2838  {
2840  }
2841 
2848  {
2850  }
2851 
2858  {
2860  }
2861 
2867  public function getHoldBeforeState()
2868  {
2870  }
2871 
2877  public function getHoldBeforeStatus()
2878  {
2880  }
2881 
2887  public function getIsVirtual()
2888  {
2889  return $this->getData(OrderInterface::IS_VIRTUAL);
2890  }
2891 
2897  public function getOrderCurrencyCode()
2898  {
2900  }
2901 
2907  public function getOriginalIncrementId()
2908  {
2910  }
2911 
2918  {
2920  }
2921 
2927  public function getPaymentAuthExpiration()
2928  {
2930  }
2931 
2937  public function getProtectCode()
2938  {
2939  return $this->getData(OrderInterface::PROTECT_CODE);
2940  }
2941 
2947  public function getQuoteAddressId()
2948  {
2950  }
2951 
2957  public function getQuoteId()
2958  {
2959  return $this->getData(OrderInterface::QUOTE_ID);
2960  }
2961 
2967  public function getRelationChildId()
2968  {
2970  }
2971 
2977  public function getRelationChildRealId()
2978  {
2980  }
2981 
2987  public function getRelationParentId()
2988  {
2990  }
2991 
2997  public function getRelationParentRealId()
2998  {
3000  }
3001 
3007  public function getRemoteIp()
3008  {
3009  return $this->getData(OrderInterface::REMOTE_IP);
3010  }
3011 
3017  public function getShippingAmount()
3018  {
3020  }
3021 
3027  public function getShippingCanceled()
3028  {
3030  }
3031 
3037  public function getShippingDescription()
3038  {
3040  }
3041 
3047  public function getShippingDiscountAmount()
3048  {
3050  }
3051 
3058  {
3060  }
3061 
3067  public function getShippingInclTax()
3068  {
3070  }
3071 
3077  public function getShippingInvoiced()
3078  {
3080  }
3081 
3087  public function getShippingRefunded()
3088  {
3090  }
3091 
3097  public function getShippingTaxAmount()
3098  {
3100  }
3101 
3107  public function getShippingTaxRefunded()
3108  {
3110  }
3111 
3117  public function getState()
3118  {
3119  return $this->getData(OrderInterface::STATE);
3120  }
3121 
3127  public function getStatus()
3128  {
3129  return $this->getData(OrderInterface::STATUS);
3130  }
3131 
3137  public function getStoreCurrencyCode()
3138  {
3140  }
3141 
3147  public function getStoreId()
3148  {
3149  return $this->getData(OrderInterface::STORE_ID);
3150  }
3151 
3157  public function getStoreName()
3158  {
3159  return $this->getData(OrderInterface::STORE_NAME);
3160  }
3161 
3167  public function getStoreToBaseRate()
3168  {
3170  }
3171 
3177  public function getStoreToOrderRate()
3178  {
3180  }
3181 
3187  public function getSubtotal()
3188  {
3189  return $this->getData(OrderInterface::SUBTOTAL);
3190  }
3191 
3197  public function getSubtotalCanceled()
3198  {
3200  }
3201 
3207  public function getSubtotalInclTax()
3208  {
3210  }
3211 
3217  public function getSubtotalInvoiced()
3218  {
3220  }
3221 
3227  public function getSubtotalRefunded()
3228  {
3230  }
3231 
3237  public function getTaxAmount()
3238  {
3239  return $this->getData(OrderInterface::TAX_AMOUNT);
3240  }
3241 
3247  public function getTaxCanceled()
3248  {
3249  return $this->getData(OrderInterface::TAX_CANCELED);
3250  }
3251 
3257  public function getTaxInvoiced()
3258  {
3259  return $this->getData(OrderInterface::TAX_INVOICED);
3260  }
3261 
3267  public function getTaxRefunded()
3268  {
3269  return $this->getData(OrderInterface::TAX_REFUNDED);
3270  }
3271 
3277  public function getTotalCanceled()
3278  {
3279  return $this->getData(OrderInterface::TOTAL_CANCELED);
3280  }
3281 
3287  public function getTotalInvoiced()
3288  {
3289  return $this->getData(OrderInterface::TOTAL_INVOICED);
3290  }
3291 
3297  public function getTotalItemCount()
3298  {
3300  }
3301 
3307  public function getTotalOfflineRefunded()
3308  {
3310  }
3311 
3317  public function getTotalOnlineRefunded()
3318  {
3320  }
3321 
3327  public function getTotalPaid()
3328  {
3329  return $this->getData(OrderInterface::TOTAL_PAID);
3330  }
3331 
3337  public function getTotalQtyOrdered()
3338  {
3340  }
3341 
3347  public function getTotalRefunded()
3348  {
3349  return $this->getData(OrderInterface::TOTAL_REFUNDED);
3350  }
3351 
3357  public function getUpdatedAt()
3358  {
3359  return $this->getData(OrderInterface::UPDATED_AT);
3360  }
3361 
3367  public function getWeight()
3368  {
3369  return $this->getData(OrderInterface::WEIGHT);
3370  }
3371 
3377  public function getXForwardedFor()
3378  {
3380  }
3381 
3385  public function setStatusHistories(array $statusHistories = null)
3386  {
3387  return $this->setData(OrderInterface::STATUS_HISTORIES, $statusHistories);
3388  }
3389 
3393  public function setStatus($status)
3394  {
3395  return $this->setData(OrderInterface::STATUS, $status);
3396  }
3397 
3401  public function setCouponCode($code)
3402  {
3403  return $this->setData(OrderInterface::COUPON_CODE, $code);
3404  }
3405 
3409  public function setProtectCode($code)
3410  {
3411  return $this->setData(OrderInterface::PROTECT_CODE, $code);
3412  }
3413 
3418  {
3420  }
3421 
3425  public function setIsVirtual($isVirtual)
3426  {
3427  return $this->setData(OrderInterface::IS_VIRTUAL, $isVirtual);
3428  }
3429 
3433  public function setStoreId($id)
3434  {
3435  return $this->setData(OrderInterface::STORE_ID, $id);
3436  }
3437 
3441  public function setCustomerId($id)
3442  {
3443  return $this->setData(OrderInterface::CUSTOMER_ID, $id);
3444  }
3445 
3450  {
3452  }
3453 
3457  public function setBaseDiscountCanceled($baseDiscountCanceled)
3458  {
3459  return $this->setData(OrderInterface::BASE_DISCOUNT_CANCELED, $baseDiscountCanceled);
3460  }
3461 
3465  public function setBaseDiscountInvoiced($baseDiscountInvoiced)
3466  {
3467  return $this->setData(OrderInterface::BASE_DISCOUNT_INVOICED, $baseDiscountInvoiced);
3468  }
3469 
3473  public function setBaseDiscountRefunded($baseDiscountRefunded)
3474  {
3475  return $this->setData(OrderInterface::BASE_DISCOUNT_REFUNDED, $baseDiscountRefunded);
3476  }
3477 
3481  public function setBaseGrandTotal($amount)
3482  {
3484  }
3485 
3490  {
3492  }
3493 
3497  public function setBaseShippingCanceled($baseShippingCanceled)
3498  {
3499  return $this->setData(OrderInterface::BASE_SHIPPING_CANCELED, $baseShippingCanceled);
3500  }
3501 
3505  public function setBaseShippingInvoiced($baseShippingInvoiced)
3506  {
3507  return $this->setData(OrderInterface::BASE_SHIPPING_INVOICED, $baseShippingInvoiced);
3508  }
3509 
3513  public function setBaseShippingRefunded($baseShippingRefunded)
3514  {
3515  return $this->setData(OrderInterface::BASE_SHIPPING_REFUNDED, $baseShippingRefunded);
3516  }
3517 
3522  {
3524  }
3525 
3529  public function setBaseShippingTaxRefunded($baseShippingTaxRefunded)
3530  {
3531  return $this->setData(OrderInterface::BASE_SHIPPING_TAX_REFUNDED, $baseShippingTaxRefunded);
3532  }
3533 
3537  public function setBaseSubtotal($amount)
3538  {
3540  }
3541 
3545  public function setBaseSubtotalCanceled($baseSubtotalCanceled)
3546  {
3547  return $this->setData(OrderInterface::BASE_SUBTOTAL_CANCELED, $baseSubtotalCanceled);
3548  }
3549 
3553  public function setBaseSubtotalInvoiced($baseSubtotalInvoiced)
3554  {
3555  return $this->setData(OrderInterface::BASE_SUBTOTAL_INVOICED, $baseSubtotalInvoiced);
3556  }
3557 
3561  public function setBaseSubtotalRefunded($baseSubtotalRefunded)
3562  {
3563  return $this->setData(OrderInterface::BASE_SUBTOTAL_REFUNDED, $baseSubtotalRefunded);
3564  }
3565 
3569  public function setBaseTaxAmount($amount)
3570  {
3572  }
3573 
3577  public function setBaseTaxCanceled($baseTaxCanceled)
3578  {
3579  return $this->setData(OrderInterface::BASE_TAX_CANCELED, $baseTaxCanceled);
3580  }
3581 
3585  public function setBaseTaxInvoiced($baseTaxInvoiced)
3586  {
3587  return $this->setData(OrderInterface::BASE_TAX_INVOICED, $baseTaxInvoiced);
3588  }
3589 
3593  public function setBaseTaxRefunded($baseTaxRefunded)
3594  {
3595  return $this->setData(OrderInterface::BASE_TAX_REFUNDED, $baseTaxRefunded);
3596  }
3597 
3601  public function setBaseToGlobalRate($rate)
3602  {
3604  }
3605 
3609  public function setBaseToOrderRate($rate)
3610  {
3612  }
3613 
3617  public function setBaseTotalCanceled($baseTotalCanceled)
3618  {
3619  return $this->setData(OrderInterface::BASE_TOTAL_CANCELED, $baseTotalCanceled);
3620  }
3621 
3625  public function setBaseTotalInvoiced($baseTotalInvoiced)
3626  {
3627  return $this->setData(OrderInterface::BASE_TOTAL_INVOICED, $baseTotalInvoiced);
3628  }
3629 
3633  public function setBaseTotalInvoicedCost($baseTotalInvoicedCost)
3634  {
3635  return $this->setData(OrderInterface::BASE_TOTAL_INVOICED_COST, $baseTotalInvoicedCost);
3636  }
3637 
3641  public function setBaseTotalOfflineRefunded($baseTotalOfflineRefunded)
3642  {
3643  return $this->setData(OrderInterface::BASE_TOTAL_OFFLINE_REFUNDED, $baseTotalOfflineRefunded);
3644  }
3645 
3649  public function setBaseTotalOnlineRefunded($baseTotalOnlineRefunded)
3650  {
3651  return $this->setData(OrderInterface::BASE_TOTAL_ONLINE_REFUNDED, $baseTotalOnlineRefunded);
3652  }
3653 
3657  public function setBaseTotalPaid($baseTotalPaid)
3658  {
3659  return $this->setData(OrderInterface::BASE_TOTAL_PAID, $baseTotalPaid);
3660  }
3661 
3665  public function setBaseTotalQtyOrdered($baseTotalQtyOrdered)
3666  {
3667  return $this->setData(OrderInterface::BASE_TOTAL_QTY_ORDERED, $baseTotalQtyOrdered);
3668  }
3669 
3673  public function setBaseTotalRefunded($baseTotalRefunded)
3674  {
3675  return $this->setData(OrderInterface::BASE_TOTAL_REFUNDED, $baseTotalRefunded);
3676  }
3677 
3681  public function setDiscountAmount($amount)
3682  {
3684  }
3685 
3689  public function setDiscountCanceled($discountCanceled)
3690  {
3691  return $this->setData(OrderInterface::DISCOUNT_CANCELED, $discountCanceled);
3692  }
3693 
3697  public function setDiscountInvoiced($discountInvoiced)
3698  {
3699  return $this->setData(OrderInterface::DISCOUNT_INVOICED, $discountInvoiced);
3700  }
3701 
3705  public function setDiscountRefunded($discountRefunded)
3706  {
3707  return $this->setData(OrderInterface::DISCOUNT_REFUNDED, $discountRefunded);
3708  }
3709 
3713  public function setGrandTotal($amount)
3714  {
3716  }
3717 
3721  public function setShippingAmount($amount)
3722  {
3724  }
3725 
3729  public function setShippingCanceled($shippingCanceled)
3730  {
3731  return $this->setData(OrderInterface::SHIPPING_CANCELED, $shippingCanceled);
3732  }
3733 
3737  public function setShippingInvoiced($shippingInvoiced)
3738  {
3739  return $this->setData(OrderInterface::SHIPPING_INVOICED, $shippingInvoiced);
3740  }
3741 
3745  public function setShippingRefunded($shippingRefunded)
3746  {
3747  return $this->setData(OrderInterface::SHIPPING_REFUNDED, $shippingRefunded);
3748  }
3749 
3754  {
3756  }
3757 
3761  public function setShippingTaxRefunded($shippingTaxRefunded)
3762  {
3763  return $this->setData(OrderInterface::SHIPPING_TAX_REFUNDED, $shippingTaxRefunded);
3764  }
3765 
3769  public function setStoreToBaseRate($rate)
3770  {
3772  }
3773 
3777  public function setStoreToOrderRate($rate)
3778  {
3780  }
3781 
3785  public function setSubtotal($amount)
3786  {
3787  return $this->setData(OrderInterface::SUBTOTAL, $amount);
3788  }
3789 
3793  public function setSubtotalCanceled($subtotalCanceled)
3794  {
3795  return $this->setData(OrderInterface::SUBTOTAL_CANCELED, $subtotalCanceled);
3796  }
3797 
3801  public function setSubtotalInvoiced($subtotalInvoiced)
3802  {
3803  return $this->setData(OrderInterface::SUBTOTAL_INVOICED, $subtotalInvoiced);
3804  }
3805 
3809  public function setSubtotalRefunded($subtotalRefunded)
3810  {
3811  return $this->setData(OrderInterface::SUBTOTAL_REFUNDED, $subtotalRefunded);
3812  }
3813 
3817  public function setTaxAmount($amount)
3818  {
3819  return $this->setData(OrderInterface::TAX_AMOUNT, $amount);
3820  }
3821 
3825  public function setTaxCanceled($taxCanceled)
3826  {
3827  return $this->setData(OrderInterface::TAX_CANCELED, $taxCanceled);
3828  }
3829 
3833  public function setTaxInvoiced($taxInvoiced)
3834  {
3835  return $this->setData(OrderInterface::TAX_INVOICED, $taxInvoiced);
3836  }
3837 
3841  public function setTaxRefunded($taxRefunded)
3842  {
3843  return $this->setData(OrderInterface::TAX_REFUNDED, $taxRefunded);
3844  }
3845 
3849  public function setTotalCanceled($totalCanceled)
3850  {
3851  return $this->setData(OrderInterface::TOTAL_CANCELED, $totalCanceled);
3852  }
3853 
3857  public function setTotalInvoiced($totalInvoiced)
3858  {
3859  return $this->setData(OrderInterface::TOTAL_INVOICED, $totalInvoiced);
3860  }
3861 
3865  public function setTotalOfflineRefunded($totalOfflineRefunded)
3866  {
3867  return $this->setData(OrderInterface::TOTAL_OFFLINE_REFUNDED, $totalOfflineRefunded);
3868  }
3869 
3873  public function setTotalOnlineRefunded($totalOnlineRefunded)
3874  {
3875  return $this->setData(OrderInterface::TOTAL_ONLINE_REFUNDED, $totalOnlineRefunded);
3876  }
3877 
3881  public function setTotalPaid($totalPaid)
3882  {
3883  return $this->setData(OrderInterface::TOTAL_PAID, $totalPaid);
3884  }
3885 
3889  public function setTotalQtyOrdered($totalQtyOrdered)
3890  {
3891  return $this->setData(OrderInterface::TOTAL_QTY_ORDERED, $totalQtyOrdered);
3892  }
3893 
3897  public function setTotalRefunded($totalRefunded)
3898  {
3899  return $this->setData(OrderInterface::TOTAL_REFUNDED, $totalRefunded);
3900  }
3901 
3905  public function setCanShipPartially($flag)
3906  {
3907  return $this->setData(OrderInterface::CAN_SHIP_PARTIALLY, $flag);
3908  }
3909 
3913  public function setCanShipPartiallyItem($flag)
3914  {
3915  return $this->setData(OrderInterface::CAN_SHIP_PARTIALLY_ITEM, $flag);
3916  }
3917 
3921  public function setCustomerIsGuest($customerIsGuest)
3922  {
3923  return $this->setData(OrderInterface::CUSTOMER_IS_GUEST, $customerIsGuest);
3924  }
3925 
3929  public function setCustomerNoteNotify($customerNoteNotify)
3930  {
3931  return $this->setData(OrderInterface::CUSTOMER_NOTE_NOTIFY, $customerNoteNotify);
3932  }
3933 
3937  public function setBillingAddressId($id)
3938  {
3940  }
3941 
3945  public function setCustomerGroupId($id)
3946  {
3948  }
3949 
3953  public function setEditIncrement($editIncrement)
3954  {
3955  return $this->setData(OrderInterface::EDIT_INCREMENT, $editIncrement);
3956  }
3957 
3961  public function setEmailSent($emailSent)
3962  {
3963  return $this->setData(OrderInterface::EMAIL_SENT, $emailSent);
3964  }
3965 
3969  public function setForcedShipmentWithInvoice($forcedShipmentWithInvoice)
3970  {
3971  return $this->setData(OrderInterface::FORCED_SHIPMENT_WITH_INVOICE, $forcedShipmentWithInvoice);
3972  }
3973 
3977  public function setPaymentAuthExpiration($paymentAuthExpiration)
3978  {
3979  return $this->setData(OrderInterface::PAYMENT_AUTH_EXPIRATION, $paymentAuthExpiration);
3980  }
3981 
3985  public function setQuoteAddressId($id)
3986  {
3988  }
3989 
3993  public function setQuoteId($id)
3994  {
3995  return $this->setData(OrderInterface::QUOTE_ID, $id);
3996  }
3997 
4001  public function setAdjustmentNegative($adjustmentNegative)
4002  {
4003  return $this->setData(OrderInterface::ADJUSTMENT_NEGATIVE, $adjustmentNegative);
4004  }
4005 
4009  public function setAdjustmentPositive($adjustmentPositive)
4010  {
4011  return $this->setData(OrderInterface::ADJUSTMENT_POSITIVE, $adjustmentPositive);
4012  }
4013 
4017  public function setBaseAdjustmentNegative($baseAdjustmentNegative)
4018  {
4019  return $this->setData(OrderInterface::BASE_ADJUSTMENT_NEGATIVE, $baseAdjustmentNegative);
4020  }
4021 
4025  public function setBaseAdjustmentPositive($baseAdjustmentPositive)
4026  {
4027  return $this->setData(OrderInterface::BASE_ADJUSTMENT_POSITIVE, $baseAdjustmentPositive);
4028  }
4029 
4034  {
4036  }
4037 
4042  {
4044  }
4045 
4049  public function setBaseTotalDue($baseTotalDue)
4050  {
4051  return $this->setData(OrderInterface::BASE_TOTAL_DUE, $baseTotalDue);
4052  }
4053 
4058  {
4060  }
4061 
4066  {
4068  }
4069 
4073  public function setSubtotalInclTax($amount)
4074  {
4076  }
4077 
4081  public function setTotalDue($totalDue)
4082  {
4083  return $this->setData(OrderInterface::TOTAL_DUE, $totalDue);
4084  }
4085 
4089  public function setWeight($weight)
4090  {
4091  return $this->setData(OrderInterface::WEIGHT, $weight);
4092  }
4093 
4097  public function setCustomerDob($customerDob)
4098  {
4099  return $this->setData(OrderInterface::CUSTOMER_DOB, $customerDob);
4100  }
4101 
4105  public function setIncrementId($id)
4106  {
4107  return $this->setData(OrderInterface::INCREMENT_ID, $id);
4108  }
4109 
4113  public function setAppliedRuleIds($appliedRuleIds)
4114  {
4115  return $this->setData(OrderInterface::APPLIED_RULE_IDS, $appliedRuleIds);
4116  }
4117 
4121  public function setBaseCurrencyCode($code)
4122  {
4124  }
4125 
4130  {
4132  }
4133 
4137  public function setCustomerFirstname($customerFirstname)
4138  {
4139  return $this->setData(OrderInterface::CUSTOMER_FIRSTNAME, $customerFirstname);
4140  }
4141 
4145  public function setCustomerLastname($customerLastname)
4146  {
4147  return $this->setData(OrderInterface::CUSTOMER_LASTNAME, $customerLastname);
4148  }
4149 
4153  public function setCustomerMiddlename($customerMiddlename)
4154  {
4155  return $this->setData(OrderInterface::CUSTOMER_MIDDLENAME, $customerMiddlename);
4156  }
4157 
4161  public function setCustomerPrefix($customerPrefix)
4162  {
4163  return $this->setData(OrderInterface::CUSTOMER_PREFIX, $customerPrefix);
4164  }
4165 
4169  public function setCustomerSuffix($customerSuffix)
4170  {
4171  return $this->setData(OrderInterface::CUSTOMER_SUFFIX, $customerSuffix);
4172  }
4173 
4177  public function setCustomerTaxvat($customerTaxvat)
4178  {
4179  return $this->setData(OrderInterface::CUSTOMER_TAXVAT, $customerTaxvat);
4180  }
4181 
4186  {
4188  }
4189 
4193  public function setExtCustomerId($id)
4194  {
4196  }
4197 
4201  public function setExtOrderId($id)
4202  {
4203  return $this->setData(OrderInterface::EXT_ORDER_ID, $id);
4204  }
4205 
4209  public function setGlobalCurrencyCode($code)
4210  {
4212  }
4213 
4217  public function setHoldBeforeState($holdBeforeState)
4218  {
4219  return $this->setData(OrderInterface::HOLD_BEFORE_STATE, $holdBeforeState);
4220  }
4221 
4225  public function setHoldBeforeStatus($holdBeforeStatus)
4226  {
4227  return $this->setData(OrderInterface::HOLD_BEFORE_STATUS, $holdBeforeStatus);
4228  }
4229 
4233  public function setOrderCurrencyCode($code)
4234  {
4236  }
4237 
4241  public function setOriginalIncrementId($id)
4242  {
4244  }
4245 
4249  public function setRelationChildId($id)
4250  {
4252  }
4253 
4257  public function setRelationChildRealId($realId)
4258  {
4259  return $this->setData(OrderInterface::RELATION_CHILD_REAL_ID, $realId);
4260  }
4261 
4265  public function setRelationParentId($id)
4266  {
4268  }
4269 
4273  public function setRelationParentRealId($realId)
4274  {
4275  return $this->setData(OrderInterface::RELATION_PARENT_REAL_ID, $realId);
4276  }
4277 
4281  public function setRemoteIp($remoteIp)
4282  {
4283  return $this->setData(OrderInterface::REMOTE_IP, $remoteIp);
4284  }
4285 
4289  public function setStoreCurrencyCode($code)
4290  {
4292  }
4293 
4297  public function setStoreName($storeName)
4298  {
4300  }
4301 
4305  public function setXForwardedFor($xForwardedFor)
4306  {
4307  return $this->setData(OrderInterface::X_FORWARDED_FOR, $xForwardedFor);
4308  }
4309 
4313  public function setCustomerNote($customerNote)
4314  {
4315  return $this->setData(OrderInterface::CUSTOMER_NOTE, $customerNote);
4316  }
4317 
4321  public function setUpdatedAt($timestamp)
4322  {
4323  return $this->setData(OrderInterface::UPDATED_AT, $timestamp);
4324  }
4325 
4329  public function setTotalItemCount($totalItemCount)
4330  {
4331  return $this->setData(OrderInterface::TOTAL_ITEM_COUNT, $totalItemCount);
4332  }
4333 
4337  public function setCustomerGender($customerGender)
4338  {
4339  return $this->setData(OrderInterface::CUSTOMER_GENDER, $customerGender);
4340  }
4341 
4346  {
4348  }
4349 
4354  {
4356  }
4357 
4362  {
4364  }
4365 
4370  {
4372  }
4373 
4377  public function setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced)
4378  {
4379  return $this->setData(OrderInterface::DISCOUNT_TAX_COMPENSATION_INVOICED, $discountTaxCompensationInvoiced);
4380  }
4381 
4385  public function setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced)
4386  {
4387  return $this->setData(
4389  $baseDiscountTaxCompensationInvoiced
4390  );
4391  }
4392 
4396  public function setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded)
4397  {
4398  return $this->setData(
4400  $discountTaxCompensationRefunded
4401  );
4402  }
4403 
4407  public function setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded)
4408  {
4409  return $this->setData(
4411  $baseDiscountTaxCompensationRefunded
4412  );
4413  }
4414 
4418  public function setShippingInclTax($amount)
4419  {
4421  }
4422 
4427  {
4429  }
4430 
4439  {
4440  return $this->setData('shipping_method', $shippingMethod);
4441  }
4442 
4443  //@codeCoverageIgnoreEnd
4444 }
getShippingMethod($asObject=false)
Definition: Order.php:1229
setAdjustmentNegative($adjustmentNegative)
Definition: Order.php:4001
$old
Definition: website.php:27
setDiscountRefunded($discountRefunded)
Definition: Order.php:3705
getBaseDiscountTaxCompensationInvoiced()
Definition: Order.php:2219
setBaseTaxCanceled($baseTaxCanceled)
Definition: Order.php:3577
setDiscountInvoiced($discountInvoiced)
Definition: Order.php:3697
setInvoiceCollection(InvoiceCollection $invoices)
Definition: Order.php:1776
setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded)
Definition: Order.php:4396
setTotalRefunded($totalRefunded)
Definition: Order.php:3897
setShippingDiscountAmount($amount)
Definition: Order.php:4065
setTaxRefunded($taxRefunded)
Definition: Order.php:3841
setExtensionAttributes(\Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes)
Definition: Order.php:2087
setTaxCanceled($taxCanceled)
Definition: Order.php:3825
setForcedShipmentWithInvoice($forcedShipmentWithInvoice)
Definition: Order.php:3969
setPayment(\Magento\Sales\Api\Data\OrderPaymentInterface $payment=null)
Definition: Order.php:1498
setCustomerIsGuest($customerIsGuest)
Definition: Order.php:3921
setBaseAdjustmentPositive($baseAdjustmentPositive)
Definition: Order.php:4025
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
setPaymentAuthorizationAmount($amount)
Definition: Order.php:4057
_canReorder($ignoreSalable=false)
Definition: Order.php:793
getCreatedAtFormatted($format)
Definition: Order.php:1908
setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded)
Definition: Order.php:4407
setHoldBeforeStatus($holdBeforeStatus)
Definition: Order.php:4225
setBaseTotalQtyOrdered($baseTotalQtyOrdered)
Definition: Order.php:3665
setBaseTotalOnlineRefunded($baseTotalOnlineRefunded)
Definition: Order.php:3649
setBaseTotalOfflineRefunded($baseTotalOfflineRefunded)
Definition: Order.php:3641
setBaseShippingDiscountAmount($amount)
Definition: Order.php:4033
$id
Definition: fieldset.phtml:14
setBaseTotalPaid($baseTotalPaid)
Definition: Order.php:3657
setBaseSubtotalInclTax($amount)
Definition: Order.php:4041
setBaseTotalRefunded($baseTotalRefunded)
Definition: Order.php:3673
setTotalCanceled($totalCanceled)
Definition: Order.php:3849
setCanShipPartiallyItem($flag)
Definition: Order.php:3913
unsetData($key=null)
Definition: Order.php:392
addStatusToHistory($status, $comment='', $isCustomerNotified=false)
Definition: Order.php:1005
setBaseTotalInvoicedCost($baseTotalInvoicedCost)
Definition: Order.php:3633
setCustomerGender($customerGender)
Definition: Order.php:4337
formatPrice($price, $addBrackets=false)
Definition: Order.php:1634
setEmailSent($emailSent)
Definition: Order.php:3961
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
addAddress(\Magento\Sales\Model\Order\Address $address)
Definition: Order.php:1280
getStatusHistoryById($statusId)
Definition: Order.php:1568
setBaseShippingAmount($amount)
Definition: Order.php:3489
$storeManager
setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced)
Definition: Order.php:4385
setCustomerDob($customerDob)
Definition: Order.php:4097
setTotalInvoiced($totalInvoiced)
Definition: Order.php:3857
prepareInvoice($qtys=[])
Definition: Order.php:1987
addStatusHistory(\Magento\Sales\Model\Order\Status\History $history)
Definition: Order.php:1588
__()
Definition: __.php:13
setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $address=null)
Definition: Order.php:912
setSubtotalInclTax($amount)
Definition: Order.php:4073
setTotalItemCount($totalItemCount)
Definition: Order.php:4329
$resource
Definition: bulk.php:12
$price
setTotalQtyOrdered($totalQtyOrdered)
Definition: Order.php:3889
setDiscountCanceled($discountCanceled)
Definition: Order.php:3689
setSubtotalCanceled($subtotalCanceled)
Definition: Order.php:3793
setIsVirtual($isVirtual)
Definition: Order.php:3425
addCommentToStatusHistory($comment, $status=false, $isVisibleOnFront=false)
Definition: Order.php:1038
setShippingRefunded($shippingRefunded)
Definition: Order.php:3745
setBaseTotalDue($baseTotalDue)
Definition: Order.php:4049
setTaxInvoiced($taxInvoiced)
Definition: Order.php:3833
$invoices
$address
Definition: customer.php:38
getParentItemsRandomCollection($limit=1)
Definition: Order.php:1322
$amount
Definition: order.php:14
$payment
Definition: order.php:17
setHoldBeforeState($holdBeforeState)
Definition: Order.php:4217
setCustomerNote($customerNote)
Definition: Order.php:4313
setActionFlag($action, $flag)
Definition: Order.php:422
getItemsCollection($filterByTypes=[], $nonChildrenOnly=false)
Definition: Order.php:1297
addStatusHistoryComment($comment, $status=false)
Definition: Order.php:1022
const REPORT_DATE_TYPE_UPDATED
Definition: Order.php:108
setBaseShippingTaxAmount($amount)
Definition: Order.php:3521
setCustomerMiddlename($customerMiddlename)
Definition: Order.php:4153
setCustomerTaxvat($customerTaxvat)
Definition: Order.php:4177
setBaseShippingRefunded($baseShippingRefunded)
Definition: Order.php:3513
$value
Definition: gender.phtml:16
$format
Definition: list.phtml:12
setTotalOnlineRefunded($totalOnlineRefunded)
Definition: Order.php:3873
formatBasePricePrecision($price, $precision)
Definition: Order.php:1694
setTotalPaid($totalPaid)
Definition: Order.php:3881
addRelatedObject(\Magento\Framework\Model\AbstractModel $object)
Definition: Order.php:1896
setStoreName($storeName)
Definition: Order.php:4297
setBaseTotalCanceled($baseTotalCanceled)
Definition: Order.php:3617
setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced)
Definition: Order.php:4377
setTotalOfflineRefunded($totalOfflineRefunded)
Definition: Order.php:3865
setDiscountAmount($amount)
Definition: Order.php:3681
setHistoryEntityName($entityName)
Definition: Order.php:1066
getAddressById($addressId)
Definition: Order.php:1264
setBaseDiscountCanceled($baseDiscountCanceled)
Definition: Order.php:3457
setCustomerPrefix($customerPrefix)
Definition: Order.php:4161
setBaseDiscountAmount($amount)
Definition: Order.php:3449
setBaseTaxInvoiced($baseTaxInvoiced)
Definition: Order.php:3585
$invoice
setShippingTaxAmount($amount)
Definition: Order.php:3753
setShippingTaxRefunded($shippingTaxRefunded)
Definition: Order.php:3761
setShippingInclTax($amount)
Definition: Order.php:4418
setCustomerNoteNotify($customerNoteNotify)
Definition: Order.php:3929
getItemByQuoteItemId($quoteItemId)
Definition: Order.php:1420
setPaymentAuthExpiration($paymentAuthExpiration)
Definition: Order.php:3977
_getItemsRandomCollection($limit, $nonChildrenOnly=false)
Definition: Order.php:1334
setDiscountDescription($description)
Definition: Order.php:4185
getPaymentById($paymentId)
Definition: Order.php:1485
$status
Definition: order_status.php:8
loadByIncrementIdAndStoreId($incrementId, $storeId)
Definition: Order.php:469
setCustomerEmail($customerEmail)
Definition: Order.php:4129
setShippingMethod($shippingMethod)
Definition: Order.php:4438
addItem(\Magento\Sales\Model\Order\Item $item)
Definition: Order.php:1436
setCreatedAt($createdAt)
Definition: Order.php:2567
setRelationChildRealId($realId)
Definition: Order.php:4257
setCustomerLastname($customerLastname)
Definition: Order.php:4145
setEditIncrement($editIncrement)
Definition: Order.php:3953
$method
Definition: info.phtml:13
setTotalDue($totalDue)
Definition: Order.php:4081
getBaseDiscountTaxCompensationRefunded()
Definition: Order.php:2229
$filters
Definition: uploader.phtml:11
setDiscountTaxCompensationAmount($amount)
Definition: Order.php:4345
setStatusHistories(array $statusHistories=null)
Definition: Order.php:3385
setBaseSubtotalRefunded($baseSubtotalRefunded)
Definition: Order.php:3561
getShippingDiscountTaxCompensationAmount()
Definition: Order.php:3057
setCanSendNewEmailFlag($flag)
Definition: Order.php:445
setCustomerFirstname($customerFirstname)
Definition: Order.php:4137
$quoteItemId
Definition: cart.php:17
const REPORT_DATE_TYPE_CREATED
Definition: Order.php:106
setBaseGrandTotal($amount)
Definition: Order.php:3481
setShippingDescription($description)
Definition: Order.php:3417
setXForwardedFor($xForwardedFor)
Definition: Order.php:4305
setBaseShippingCanceled($baseShippingCanceled)
Definition: Order.php:3497
loadByAttribute($attribute, $value)
Definition: Order.php:503
getData($key='', $index=null)
Definition: Order.php:1740
setRelationParentRealId($realId)
Definition: Order.php:4273
$storeName
Definition: logo.phtml:13
getBaseShippingDiscountTaxCompensationAmnt()
Definition: Order.php:2269
setBaseShippingTaxRefunded($baseShippingTaxRefunded)
Definition: Order.php:3529
setAdjustmentPositive($adjustmentPositive)
Definition: Order.php:4009
setBaseShippingInclTax($amount)
Definition: Order.php:4426
setBaseShippingDiscountTaxCompensationAmnt($amnt)
Definition: Order.php:4369
registerCancellation($comment='', $graceful=true)
Definition: Order.php:1169
setShippingInvoiced($shippingInvoiced)
Definition: Order.php:3737
$shippingMethod
Definition: popup.phtml:12
setShippingDiscountTaxCompensationAmount($amount)
Definition: Order.php:4361
setBaseSubtotalInvoiced($baseSubtotalInvoiced)
Definition: Order.php:3553
setShippingAmount($amount)
Definition: Order.php:3721
const ACTION_FLAG_CREDITMEMO
Definition: Order.php:93
setBaseTotalInvoiced($baseTotalInvoiced)
Definition: Order.php:3625
setSubtotalRefunded($subtotalRefunded)
Definition: Order.php:3809
formatPricePrecision($price, $precision, $addBrackets=false)
Definition: Order.php:1647
setShippingCanceled($shippingCanceled)
Definition: Order.php:3729
setAppliedRuleIds($appliedRuleIds)
Definition: Order.php:4113
setUpdatedAt($timestamp)
Definition: Order.php:4321
setBaseDiscountRefunded($baseDiscountRefunded)
Definition: Order.php:3473
setBaseDiscountInvoiced($baseDiscountInvoiced)
Definition: Order.php:3465
setRemoteIp($remoteIp)
Definition: Order.php:4281
setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $address=null)
Definition: Order.php:932
setBaseSubtotalCanceled($baseSubtotalCanceled)
Definition: Order.php:3545
$index
Definition: list.phtml:44
setSubtotalInvoiced($subtotalInvoiced)
Definition: Order.php:3801
setCustomerSuffix($customerSuffix)
Definition: Order.php:4169
setBaseDiscountTaxCompensationAmount($amount)
Definition: Order.php:4353
setBaseShippingInvoiced($baseShippingInvoiced)
Definition: Order.php:3505
loadByIncrementId($incrementId)
Definition: Order.php:457
$code
Definition: info.phtml:12
setBaseTaxRefunded($baseTaxRefunded)
Definition: Order.php:3593
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Sales\Model\ResourceModel\Order\Item\CollectionFactory $orderItemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Sales\Api\InvoiceManagementInterface $invoiceManagement, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory, \Magento\Sales\Model\ResourceModel\Order\Address\CollectionFactory $addressCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\Payment\CollectionFactory $paymentCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\Status\History\CollectionFactory $historyCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\Invoice\CollectionFactory $invoiceCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\Shipment\CollectionFactory $shipmentCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\Creditmemo\CollectionFactory $memoCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $salesOrderCollectionFactory, PriceCurrencyInterface $priceCurrency, \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productListFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], ResolverInterface $localeResolver=null)
Definition: Order.php:313
setBaseAdjustmentNegative($baseAdjustmentNegative)
Definition: Order.php:4017
$items