Skip to content

Commit

Permalink
Merge pull request #29 from magento-mpi/develop
Browse files Browse the repository at this point in the history
[MPI] Performance improvements and bug fixes
  • Loading branch information
vpelipenko committed Jan 14, 2015
2 parents 6e6e2af + 2f31add commit 868bd48
Show file tree
Hide file tree
Showing 84 changed files with 1,324 additions and 1,431 deletions.
141 changes: 0 additions & 141 deletions app/code/Magento/Checkout/Block/Total/Nominal.php

This file was deleted.

22 changes: 19 additions & 3 deletions app/code/Magento/Checkout/Model/Type/Onepage.php
Expand Up @@ -431,7 +431,7 @@ public function saveBilling($data, $customerAddressId)
$address = $this->getQuote()->getBillingAddress();
}

if (!$this->getQuote()->getCustomerId() && self::METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
if (!$this->getQuote()->getCustomerId() && $this->isCheckoutMethodRegister()) {
if ($this->_customerEmailExists($address->getEmail(), $this->_storeManager->getWebsite()->getId())) {
return [
'error' => 1,
Expand Down Expand Up @@ -492,13 +492,19 @@ public function saveBilling($data, $customerAddressId)
)->setCollectShippingRates(
true
)->collectTotals();
$shipping->save();
if (!$this->isCheckoutMethodRegister()) {
$shipping->save();
}
$this->getCheckout()->setStepData('shipping', 'complete', true);
break;
}
}

$this->quoteRepository->save($this->getQuote());
if ($this->isCheckoutMethodRegister()) {
$this->quoteRepository->save($this->getQuote());
} else {
$address->save();
}

$this->getCheckout()->setStepData(
'billing',
Expand All @@ -517,6 +523,16 @@ public function saveBilling($data, $customerAddressId)
return [];
}

/**
* Check whether checkout method is "register"
*
* @return bool
*/
protected function isCheckoutMethodRegister()
{
return $this->getQuote()->getCheckoutMethod() == self::METHOD_REGISTER;
}

/**
* Validate customer data and set some its data for further usage in quote
*
Expand Down
16 changes: 0 additions & 16 deletions app/code/Magento/Checkout/etc/sales.xml

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions app/code/Magento/Multishipping/Helper/Data.php
Expand Up @@ -87,7 +87,6 @@ public function isMultishippingCheckoutAvailable()
true
) &&
$quote->getItemsSummaryQty() - $quote->getItemVirtualQty() > 0 &&
$quote->getItemsSummaryQty() <= $this->getMaximumQty() &&
!$quote->hasNominalItems();
$quote->getItemsSummaryQty() <= $this->getMaximumQty();
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Model/Cart/SalesModel/Quote.php
Expand Up @@ -50,7 +50,7 @@ public function getAllItems()
'parent_item' => $item->getParentItem(),
'name' => $item->getName(),
'qty' => (int)$item->getTotalQty(),
'price' => $item->isNominal() ? 0 : (double)$item->getBaseCalculationPrice(),
'price' => (double)$item->getBaseCalculationPrice(),
'original_item' => $item,
]
);
Expand Down
13 changes: 1 addition & 12 deletions app/code/Magento/Sales/Api/Data/OrderItemInterface.php
Expand Up @@ -266,11 +266,7 @@ interface OrderItemInterface extends \Magento\Framework\Api\ExtensibleDataInterf
*/
const BASE_HIDDEN_TAX_REFUNDED = 'base_hidden_tax_refunded';
/*
* Is-nominal flag.
*/
const IS_NOMINAL = 'is_nominal';
/*
* Tax-canceled flag.
* Tax canceled flag
*/
const TAX_CANCELED = 'tax_canceled';
/*
Expand Down Expand Up @@ -751,13 +747,6 @@ public function getHiddenTaxInvoiced();
*/
public function getHiddenTaxRefunded();

/**
* Gets the is-nominal flag value for the order item.
*
* @return int Is-nominal flag value.
*/
public function getIsNominal();

/**
* Gets the is-quantity-decimal flag value for the order item.
*
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Config.php
Expand Up @@ -49,7 +49,7 @@ public function getTotalsRenderer($section, $group, $code)

/**
* Retrieve totals for group
* e.g. quote, nominal_totals, etc
* e.g. quote, etc
*
* @param string $section
* @param string $group
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Config/Converter.php
Expand Up @@ -5,7 +5,7 @@
*/

/**
* Converts sales totals (incl. nominal, creditmemo, invoice) from \DOMDocument to array
* Converts sales totals (incl. creditmemo, invoice) from \DOMDocument to array
*/
namespace Magento\Sales\Model\Config;

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/Config/Reader.php
Expand Up @@ -5,7 +5,7 @@
*/

/**
* Sales configuration filesystem loader. Loads all totals (incl. nominal, creditmemo, invoice)
* Sales configuration filesystem loader. Loads all totals (incl. creditmemo, invoice)
* configuration from XML file
*/
namespace Magento\Sales\Model\Config;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Sales/Model/ConfigInterface.php
Expand Up @@ -19,7 +19,7 @@ public function getTotalsRenderer($section, $group, $code);

/**
* Retrieve totals for group
* e.g. quote, nominal_totals, etc
* e.g. quote, etc
*
* @param string $section
* @param string $group
Expand Down
31 changes: 16 additions & 15 deletions app/code/Magento/Sales/Model/Order.php
Expand Up @@ -802,6 +802,10 @@ public function canEdit()
return false;
}

if ($this->hasInvoices()) {
return false;
}

if (!$this->getPayment()->getMethodInstance()->canEdit()) {
return false;
}
Expand Down Expand Up @@ -1491,21 +1495,6 @@ public function addItem(\Magento\Sales\Model\Order\Item $item)
return $this;
}

/**
* Whether the order has nominal items only
*
* @return bool
*/
public function isNominal()
{
foreach ($this->getAllVisibleItems() as $item) {
if ('0' == $item->getIsNominal()) {
return false;
}
}
return true;
}

/*********************** PAYMENTS ***************************/

/**
Expand Down Expand Up @@ -1821,6 +1810,18 @@ public function getInvoiceCollection()
return $this->_invoices;
}

/**
* Set order invoices collection
*
* @param InvoiceCollection $invoices
* @return $this
*/
public function setInvoiceCollection(InvoiceCollection $invoices)
{
$this->_invoices = $invoices;
return $this;
}

/**
* Retrieve order shipments collection
*
Expand Down
11 changes: 0 additions & 11 deletions app/code/Magento/Sales/Model/Order/Item.php
Expand Up @@ -88,7 +88,6 @@
* @method \Magento\Sales\Model\Order\Item setBaseHiddenTaxInvoiced(float $value)
* @method \Magento\Sales\Model\Order\Item setHiddenTaxRefunded(float $value)
* @method \Magento\Sales\Model\Order\Item setBaseHiddenTaxRefunded(float $value)
* @method \Magento\Sales\Model\Order\Item setIsNominal(int $value)
* @method \Magento\Sales\Model\Order\Item setTaxCanceled(float $value)
* @method \Magento\Sales\Model\Order\Item setHiddenTaxCanceled(float $value)
* @method \Magento\Sales\Model\Order\Item setTaxRefunded(float $value)
Expand Down Expand Up @@ -1272,16 +1271,6 @@ public function getHiddenTaxRefunded()
return $this->getData(OrderItemInterface::HIDDEN_TAX_REFUNDED);
}

/**
* Returns is_nominal
*
* @return int
*/
public function getIsNominal()
{
return $this->getData(OrderItemInterface::IS_NOMINAL);
}

/**
* Returns is_qty_decimal
*
Expand Down

0 comments on commit 868bd48

Please sign in to comment.