Skip to content

Commit e571579

Browse files
author
Dmytro Aponasenko
committed
Merge branch 'develop' of https://github.corp.magento.com/magento2/magento2ce into develop
2 parents d62c8a1 + af32ac1 commit e571579

File tree

51 files changed

+1053
-584
lines changed

Some content is hidden

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

51 files changed

+1053
-584
lines changed

app/code/Magento/Catalog/Block/Product/View/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ protected function _getPriceConfiguration($option)
162162
$data = [
163163
'prices' => [
164164
'oldPrice' => [
165-
'amount' => $this->pricingHelper->currency($option->getPrice(false), false, false),
165+
'amount' => $optionPrice,
166166
'adjustments' => [],
167167
],
168168
'basePrice' => [

app/code/Magento/LayeredNavigation/view/frontend/layout/1column.xml

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

app/code/Magento/LayeredNavigation/view/frontend/layout/2columns-left.xml

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

app/code/Magento/LayeredNavigation/view/frontend/layout/2columns-right.xml

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

app/code/Magento/LayeredNavigation/view/frontend/layout/3columns.xml

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

app/code/Magento/LayeredNavigation/view/frontend/layout/page_empty.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
9+
<move element="catalog.leftnav" destination="content.top" after="-"/>
10+
</layout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
9+
<move element="catalog.leftnav" destination="sidebar.main" before="-"/>
10+
</layout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
9+
<move element="catalog.leftnav" destination="sidebar.main" before="-"/>
10+
</layout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
9+
<move element="catalog.leftnav" destination="sidebar.main" before="-"/>
10+
</layout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
9+
<move element="catalog.leftnav" destination="category.product.list.additional" before="-"/>
10+
</layout>

app/code/Magento/Tax/CustomerData/CheckoutTotalsJsLayoutDataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getData()
6161
protected function getTotalsConfig()
6262
{
6363
return [
64-
'display_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(),
64+
'display_cart_subtotal_incl_tax' => (int)$this->taxConfig->displayCartSubtotalInclTax(),
6565
'display_cart_subtotal_excl_tax' => (int)$this->taxConfig->displayCartSubtotalExclTax(),
6666
];
6767
}

app/code/Magento/Tax/Model/Calculation/AbstractAggregateCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function calculateWithTaxInPrice(QuoteDetailsItemInterface $item, $qua
2828
$priceInclTax = $this->calculationTool->round($item->getUnitPrice());
2929
$rowTotalInclTax = $priceInclTax * $quantity;
3030
if (!$this->isSameRateAsStore($rate, $storeRate)) {
31-
$priceInclTax = $this->calculatePriceInclTax($priceInclTax, $storeRate, $rate);
31+
$priceInclTax = $this->calculatePriceInclTax($priceInclTax, $storeRate, $rate, $round);
3232
$rowTotalInclTax = $priceInclTax * $quantity;
3333
}
3434
$rowTaxExact = $this->calculationTool->calcTaxAmount($rowTotalInclTax, $rate, true, false);

app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,14 +433,18 @@ protected function deltaRound($price, $rate, $direction, $type = self::KEY_REGUL
433433
* @param float $storePriceInclTax
434434
* @param float $storeRate
435435
* @param float $customerRate
436+
* @param boolean $round
436437
* @return float
437438
*/
438-
protected function calculatePriceInclTax($storePriceInclTax, $storeRate, $customerRate)
439+
protected function calculatePriceInclTax($storePriceInclTax, $storeRate, $customerRate, $round = true)
439440
{
440441
$storeTax = $this->calculationTool->calcTaxAmount($storePriceInclTax, $storeRate, true, false);
441442
$priceExclTax = $storePriceInclTax - $storeTax;
442443
$customerTax = $this->calculationTool->calcTaxAmount($priceExclTax, $customerRate, false, false);
443-
$customerPriceInclTax = $this->calculationTool->round($priceExclTax + $customerTax);
444+
$customerPriceInclTax = $priceExclTax + $customerTax;
445+
if ($round) {
446+
$customerPriceInclTax = $this->calculationTool->round($customerPriceInclTax);
447+
}
444448
return $customerPriceInclTax;
445449
}
446450
}

app/code/Magento/Tax/Model/Calculation/UnitBaseCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function calculateWithTaxInPrice(QuoteDetailsItemInterface $item, $qua
4545
$applyTaxAfterDiscount = $this->config->applyTaxAfterDiscount($this->storeId);
4646
$priceInclTax = $this->calculationTool->round($item->getUnitPrice());
4747
if (!$this->isSameRateAsStore($rate, $storeRate)) {
48-
$priceInclTax = $this->calculatePriceInclTax($priceInclTax, $storeRate, $rate);
48+
$priceInclTax = $this->calculatePriceInclTax($priceInclTax, $storeRate, $rate, $round);
4949
}
5050
$uniTax = $this->calculationTool->calcTaxAmount($priceInclTax, $rate, true, false);
5151
$deltaRoundingType = self::KEY_REGULAR_DELTA_ROUNDING;

app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public function __construct(
8888
* @param ShippingAssignmentInterface $shippingAssignment
8989
* @param Address\Total $total
9090
* @return $this
91+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
9192
*/
9293
public function collect(
9394
\Magento\Quote\Model\Quote $quote,
@@ -291,13 +292,18 @@ protected function processExtraTaxables(Address\Total $total, Array $itemsByType
291292
* @param Address\Total $total
292293
* @return array|null
293294
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
295+
* @SuppressWarnings(PHPMD.NPathComplexity)
294296
*/
295297
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
296298
{
297299
$totals = [];
298300
$store = $quote->getStore();
299301
$applied = $total->getAppliedTaxes();
300302
$amount = $total->getTaxAmount();
303+
if ($amount == null) {
304+
$this->enhanceTotalData($quote, $total);
305+
$amount = $total->getTaxAmount();
306+
}
301307
$taxAmount = $amount + $total->getTotalAmount('discount_tax_compensation');
302308

303309
$area = null;
@@ -340,6 +346,44 @@ public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Qu
340346
return $totals;
341347
}
342348

349+
/**
350+
* Adds minimal tax information to the "total" data structure
351+
*
352+
* @param \Magento\Quote\Model\Quote $quote
353+
* @param Address\Total $total
354+
* @return null
355+
*/
356+
protected function enhanceTotalData(
357+
\Magento\Quote\Model\Quote $quote,
358+
\Magento\Quote\Model\Quote\Address\Total $total
359+
) {
360+
$taxAmount = 0;
361+
$shippingTaxAmount = 0;
362+
$discountTaxCompensation = 0;
363+
364+
$subtotalInclTax = $total->getSubtotalInclTax();
365+
$computeSubtotalInclTax = true;
366+
if ($total->getSubtotalInclTax() > 0) {
367+
$computeSubtotalInclTax = false;
368+
}
369+
370+
/** @var \Magento\Quote\Model\Quote\Address $address */
371+
foreach ($quote->getAllAddresses() as $address) {
372+
$taxAmount += $address->getTaxAmount();
373+
$shippingTaxAmount += $address->getShippingTaxAmount();
374+
$discountTaxCompensation += $address->getDiscountTaxCompensationAmount();
375+
if ($computeSubtotalInclTax) {
376+
$subtotalInclTax += $address->getSubtotalInclTax();
377+
}
378+
}
379+
380+
$total->setTaxAmount($taxAmount);
381+
$total->setShippingTaxAmount($shippingTaxAmount);
382+
$total->setDiscountTaxCompensationAmount($discountTaxCompensation); // accessed via 'discount_tax_compensation'
383+
$total->setSubtotalInclTax($subtotalInclTax);
384+
return;
385+
}
386+
343387
/**
344388
* Process model configuration array.
345389
* This method can be used for changing totals collect sort order

0 commit comments

Comments
 (0)