Skip to content

Commit 868bd48

Browse files
committed
Merge pull request #29 from magento-mpi/develop
[MPI] Performance improvements and bug fixes
2 parents 6e6e2af + 2f31add commit 868bd48

File tree

84 files changed

+1324
-1431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1324
-1431
lines changed

app/code/Magento/Checkout/Block/Total/Nominal.php

Lines changed: 0 additions & 141 deletions
This file was deleted.

app/code/Magento/Checkout/Model/Type/Onepage.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public function saveBilling($data, $customerAddressId)
431431
$address = $this->getQuote()->getBillingAddress();
432432
}
433433

434-
if (!$this->getQuote()->getCustomerId() && self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
434+
if (!$this->getQuote()->getCustomerId() && $this->isCheckoutMethodRegister()) {
435435
if ($this->_customerEmailExists($address->getEmail(), $this->_storeManager->getWebsite()->getId())) {
436436
return [
437437
'error' => 1,
@@ -492,13 +492,19 @@ public function saveBilling($data, $customerAddressId)
492492
)->setCollectShippingRates(
493493
true
494494
)->collectTotals();
495-
$shipping->save();
495+
if (!$this->isCheckoutMethodRegister()) {
496+
$shipping->save();
497+
}
496498
$this->getCheckout()->setStepData('shipping', 'complete', true);
497499
break;
498500
}
499501
}
500502

501-
$this->quoteRepository->save($this->getQuote());
503+
if ($this->isCheckoutMethodRegister()) {
504+
$this->quoteRepository->save($this->getQuote());
505+
} else {
506+
$address->save();
507+
}
502508

503509
$this->getCheckout()->setStepData(
504510
'billing',
@@ -517,6 +523,16 @@ public function saveBilling($data, $customerAddressId)
517523
return [];
518524
}
519525

526+
/**
527+
* Check whether checkout method is "register"
528+
*
529+
* @return bool
530+
*/
531+
protected function isCheckoutMethodRegister()
532+
{
533+
return $this->getQuote()->getCheckoutMethod() == self::METHOD_REGISTER;
534+
}
535+
520536
/**
521537
* Validate customer data and set some its data for further usage in quote
522538
*

app/code/Magento/Checkout/etc/sales.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/code/Magento/Checkout/view/frontend/templates/total/nominal.phtml

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/code/Magento/Multishipping/Helper/Data.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public function isMultishippingCheckoutAvailable()
8787
true
8888
) &&
8989
$quote->getItemsSummaryQty() - $quote->getItemVirtualQty() > 0 &&
90-
$quote->getItemsSummaryQty() <= $this->getMaximumQty() &&
91-
!$quote->hasNominalItems();
90+
$quote->getItemsSummaryQty() <= $this->getMaximumQty();
9291
}
9392
}

app/code/Magento/Payment/Model/Cart/SalesModel/Quote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getAllItems()
5050
'parent_item' => $item->getParentItem(),
5151
'name' => $item->getName(),
5252
'qty' => (int)$item->getTotalQty(),
53-
'price' => $item->isNominal() ? 0 : (double)$item->getBaseCalculationPrice(),
53+
'price' => (double)$item->getBaseCalculationPrice(),
5454
'original_item' => $item,
5555
]
5656
);

app/code/Magento/Sales/Api/Data/OrderItemInterface.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,7 @@ interface OrderItemInterface extends \Magento\Framework\Api\ExtensibleDataInterf
266266
*/
267267
const BASE_HIDDEN_TAX_REFUNDED = 'base_hidden_tax_refunded';
268268
/*
269-
* Is-nominal flag.
270-
*/
271-
const IS_NOMINAL = 'is_nominal';
272-
/*
273-
* Tax-canceled flag.
269+
* Tax canceled flag
274270
*/
275271
const TAX_CANCELED = 'tax_canceled';
276272
/*
@@ -751,13 +747,6 @@ public function getHiddenTaxInvoiced();
751747
*/
752748
public function getHiddenTaxRefunded();
753749

754-
/**
755-
* Gets the is-nominal flag value for the order item.
756-
*
757-
* @return int Is-nominal flag value.
758-
*/
759-
public function getIsNominal();
760-
761750
/**
762751
* Gets the is-quantity-decimal flag value for the order item.
763752
*

app/code/Magento/Sales/Model/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getTotalsRenderer($section, $group, $code)
4949

5050
/**
5151
* Retrieve totals for group
52-
* e.g. quote, nominal_totals, etc
52+
* e.g. quote, etc
5353
*
5454
* @param string $section
5555
* @param string $group

app/code/Magento/Sales/Model/Config/Converter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
/**
8-
* Converts sales totals (incl. nominal, creditmemo, invoice) from \DOMDocument to array
8+
* Converts sales totals (incl. creditmemo, invoice) from \DOMDocument to array
99
*/
1010
namespace Magento\Sales\Model\Config;
1111

app/code/Magento/Sales/Model/Config/Reader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
/**
8-
* Sales configuration filesystem loader. Loads all totals (incl. nominal, creditmemo, invoice)
8+
* Sales configuration filesystem loader. Loads all totals (incl. creditmemo, invoice)
99
* configuration from XML file
1010
*/
1111
namespace Magento\Sales\Model\Config;

app/code/Magento/Sales/Model/ConfigInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getTotalsRenderer($section, $group, $code);
1919

2020
/**
2121
* Retrieve totals for group
22-
* e.g. quote, nominal_totals, etc
22+
* e.g. quote, etc
2323
*
2424
* @param string $section
2525
* @param string $group

app/code/Magento/Sales/Model/Order.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,10 @@ public function canEdit()
802802
return false;
803803
}
804804

805+
if ($this->hasInvoices()) {
806+
return false;
807+
}
808+
805809
if (!$this->getPayment()->getMethodInstance()->canEdit()) {
806810
return false;
807811
}
@@ -1491,21 +1495,6 @@ public function addItem(\Magento\Sales\Model\Order\Item $item)
14911495
return $this;
14921496
}
14931497

1494-
/**
1495-
* Whether the order has nominal items only
1496-
*
1497-
* @return bool
1498-
*/
1499-
public function isNominal()
1500-
{
1501-
foreach ($this->getAllVisibleItems() as $item) {
1502-
if ('0' == $item->getIsNominal()) {
1503-
return false;
1504-
}
1505-
}
1506-
return true;
1507-
}
1508-
15091498
/*********************** PAYMENTS ***************************/
15101499

15111500
/**
@@ -1821,6 +1810,18 @@ public function getInvoiceCollection()
18211810
return $this->_invoices;
18221811
}
18231812

1813+
/**
1814+
* Set order invoices collection
1815+
*
1816+
* @param InvoiceCollection $invoices
1817+
* @return $this
1818+
*/
1819+
public function setInvoiceCollection(InvoiceCollection $invoices)
1820+
{
1821+
$this->_invoices = $invoices;
1822+
return $this;
1823+
}
1824+
18241825
/**
18251826
* Retrieve order shipments collection
18261827
*

app/code/Magento/Sales/Model/Order/Item.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
* @method \Magento\Sales\Model\Order\Item setBaseHiddenTaxInvoiced(float $value)
8989
* @method \Magento\Sales\Model\Order\Item setHiddenTaxRefunded(float $value)
9090
* @method \Magento\Sales\Model\Order\Item setBaseHiddenTaxRefunded(float $value)
91-
* @method \Magento\Sales\Model\Order\Item setIsNominal(int $value)
9291
* @method \Magento\Sales\Model\Order\Item setTaxCanceled(float $value)
9392
* @method \Magento\Sales\Model\Order\Item setHiddenTaxCanceled(float $value)
9493
* @method \Magento\Sales\Model\Order\Item setTaxRefunded(float $value)
@@ -1272,16 +1271,6 @@ public function getHiddenTaxRefunded()
12721271
return $this->getData(OrderItemInterface::HIDDEN_TAX_REFUNDED);
12731272
}
12741273

1275-
/**
1276-
* Returns is_nominal
1277-
*
1278-
* @return int
1279-
*/
1280-
public function getIsNominal()
1281-
{
1282-
return $this->getData(OrderItemInterface::IS_NOMINAL);
1283-
}
1284-
12851274
/**
12861275
* Returns is_qty_decimal
12871276
*

0 commit comments

Comments
 (0)