diff --git a/app/code/Magento/Weee/view/frontend/web/template/checkout/summary/weee.html b/app/code/Magento/Weee/view/frontend/web/template/checkout/summary/weee.html
index 7a3696a829ef8..886e2443918e6 100644
--- a/app/code/Magento/Weee/view/frontend/web/template/checkout/summary/weee.html
+++ b/app/code/Magento/Weee/view/frontend/web/template/checkout/summary/weee.html
@@ -8,7 +8,7 @@
|
-
+
|
\ No newline at end of file
diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less
index 41727f629e33c..d65fc3090a9fa 100644
--- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less
+++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less
@@ -241,6 +241,9 @@
.note {
display: block;
}
+ .price-notice {
+ &:extend(.abs-adjustment-incl-excl-tax all);
+ }
}
}
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml
index 328c932717e73..36e2655c40562 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml
@@ -917,6 +917,9 @@
- default_subcategory
+
+ - taxable_goods
+
- Main Website
@@ -946,6 +949,9 @@
- default_subcategory
+
+ - taxable_goods
+
- Main Website
diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php b/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php
index 6e58923b821a2..2814c8597df1c 100644
--- a/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php
+++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php
@@ -120,7 +120,7 @@ protected function getPrices(CatalogProductSimple $product)
// Get prices with fpt on cart page
$actualPrices = $this->getCartPrice($product, $actualPrices);
- return $actualPrices;
+ return array_filter($actualPrices);
}
/**
@@ -181,6 +181,8 @@ protected function getCartPrice(CatalogProductSimple $product, array $actualPric
$actualPrices['cart_item_subtotal_fpt'] = $productWeeeItem->getSubtotalFptBlock()->getFpt();
$actualPrices['cart_item_subtotal_fpt_total'] = $productWeeeItem->getSubtotalFptBlock()->getFptTotal();
$actualPrices['grand_total'] = $this->checkoutCart->getTotalsBlock()->getGrandTotal();
+ $actualPrices['grand_total_excl_tax'] = $this->checkoutCart->getTotalsBlock()->getGrandTotalExcludingTax();
+ $actualPrices['grand_total_incl_tax'] = $this->checkoutCart->getTotalsBlock()->getGrandTotalIncludingTax();
$actualPrices['total_fpt'] = $this->checkoutCart->getWeeeTotalsBlock()->getFptBlock()->getTotalFpt();
return $actualPrices;
diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/Page/CheckoutCart.xml b/dev/tests/functional/tests/app/Magento/Weee/Test/Page/CheckoutCart.xml
index be49a88ca0d71..4cfab8b70af86 100644
--- a/dev/tests/functional/tests/app/Magento/Weee/Test/Page/CheckoutCart.xml
+++ b/dev/tests/functional/tests/app/Magento/Weee/Test/Page/CheckoutCart.xml
@@ -8,6 +8,6 @@
-
+
diff --git a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml
index 5e3c1447ed7df..c6700d12186a8 100644
--- a/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.xml
@@ -23,7 +23,7 @@
100.00
10.00
110.00
- 118.25
+ 123.66
10.00
@@ -31,15 +31,21 @@
Check not taxed FPT display set to Including FPT and Description on product with custom option catalog price Excluding Tax
shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_incl, display_including_tax
with_custom_option_and_fpt
- 80.00
+ 75.78
10.00
- 100.00
+ 85.78
+ 108.25
10.00
- 110.00
+ 118.25
+ 108.25
10.00
- 110.00
+ 118.25
+ 108.25
10.00
- 118.25
+ 118.25
+ 123.66
+ 115.00
+ 123.66
10.00
@@ -47,21 +53,27 @@
Check not taxed FPT display set to Excluding, Description and Including FPT on product with special price catalog price Excluding Tax
shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_incl, display_including_tax
with_special_price_and_fpt
- 110.00
+ 108.25
10.00
- 110.00
+ 118.25
+ 108.25
10.00
- 110.00
+ 118.25
+ 108.25
10.00
- 110.00
+ 118.25
+ 108.25
10.00
- 118.25
+ 118.25
+ 123.66
+ 115.00
+ 123.66
10.00
Check not taxed FPT display set to Including FPT and Description on product with special price catalog price Excluding Tax
- shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_excl,
+ shipping_tax_class_taxable_goods,tax_with_fpt_cat_excl_disc_on_excl
with_special_price_and_fpt
100.00
10.00
@@ -75,7 +87,7 @@
100.00
10.00
110.00
- 118.25
+ 123.66
10.00
@@ -95,7 +107,7 @@
100.00
10.00
110.00
- 119.08
+ 124.49
10.00
@@ -103,15 +115,17 @@
Check taxed FPT display set to Including FPT and Description on product with with custom option catalog price Excluding Tax
shipping_tax_class_taxable_goods,tax_with_fpt_taxed_cat_excl_disc_on_incl, display_including_tax
with_custom_option_and_fpt
- 80.00
+ 86.60
10.00
- 100.00
+ 119.08
10.00
- 110.00
- 10.00
- 110.00
- 10.00
- 119.08
+ 119.08
+ 10.83
+ 119.08
+ 10.83
+ 124.49
+ 115.00
+ 124.49
10.00
@@ -119,15 +133,17 @@
Check taxed FPT display set to Excluding, Description and Including FPT on product with special price catalog price Excluding Tax
shipping_tax_class_taxable_goods,tax_with_fpt_taxed_cat_excl_disc_on_incl, display_including_tax
with_special_price_and_fpt
- 110.00
+ 119.08
10.00
- 110.00
+ 119.08
10.00
- 110.00
- 10.00
- 110.00
- 10.00
- 119.08
+ 119.08
+ 10.83
+ 119.08
+ 10.83
+ 124.49
+ 115.00
+ 124.49
10.00
@@ -147,7 +163,7 @@
100.00
10.00
110.00
- 119.08
+ 124.49
10.00
@@ -167,13 +183,13 @@
92.38
9.24
101.62
- 110.00
+ 115.00
10.00
Check taxed FPT display set to Including FPT and Description on product with with special price and catalog price Including Tax
- shipping_tax_class_taxable_goods,tax_with_fpt_taxed_cat_incl_disc_on_incl, display_including_tax
+ shipping_tax_class_taxable_goods,tax_with_fpt_taxed_cat_incl_disc_on_incl
with_special_price_and_fpt
92.38
10.00
@@ -183,7 +199,7 @@
9.24
101.62
9.24
- 110.00
+ 115.00
10.00
@@ -203,7 +219,7 @@
92.38
9.24
101.62
- 110.00
+ 115.00
10.00
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php
index cef578e0114a3..354a4c4533d65 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php
@@ -97,10 +97,19 @@ public function testSingleLikeFilter()
/**
* @expectedException \Magento\Framework\Exception\LocalizedException
- * @expectedExceptionMessage When passing in a field array there must be a matching condition array.
+ * @expectedExceptionMessage When passing an array of fields there must be at least one field in the array.
*/
public function testAddToFilterException()
{
$this->collection->addFieldToFilter([], 'not_array');
}
+
+ /**
+ * @expectedException \Magento\Framework\Exception\LocalizedException
+ * @expectedExceptionMessage When passing in a field array there must be a matching condition array.
+ */
+ public function testAddToFilterExceptionArrayNotSymmetric()
+ {
+ $this->collection->addFieldToFilter(['field2', 'field2'], ['condition1']);
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php
index b242bb0ef8464..b94bcc54d13db 100644
--- a/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Shipping/Helper/DataTest.php
@@ -32,8 +32,8 @@ public function testGetTrackingPopupUrlBySalesModel($modelName, $getIdMethod, $e
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$constructArgs = [];
if ('Magento\Sales\Model\Order\Shipment' == $modelName) {
- $orderFactory = $this->_getMockOrderFactory($code);
- $constructArgs['orderFactory'] = $orderFactory;
+ $orderRepository = $this->_getMockOrderRepository($code);
+ $constructArgs['orderRepository'] = $orderRepository;
} elseif ('Magento\Sales\Model\Order\Shipment\Track' == $modelName) {
$shipmentRepository = $this->_getMockShipmentRepository($code);
$constructArgs['shipmentRepository'] = $shipmentRepository;
@@ -52,16 +52,16 @@ public function testGetTrackingPopupUrlBySalesModel($modelName, $getIdMethod, $e
/**
* @param $code
- * @return \Magento\Sales\Model\OrderFactory
+ * @return \Magento\Sales\Api\OrderRepositoryInterface
*/
- protected function _getMockOrderFactory($code)
+ protected function _getMockOrderRepository($code)
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$order = $objectManager->create('Magento\Sales\Model\Order');
$order->setProtectCode($code);
- $orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', ['create'], [], '', false);
- $orderFactory->expects($this->atLeastOnce())->method('create')->will($this->returnValue($order));
- return $orderFactory;
+ $orderRepository = $this->getMock('Magento\Sales\Api\OrderRepositoryInterface', [], [], '', false);
+ $orderRepository->expects($this->atLeastOnce())->method('get')->will($this->returnValue($order));
+ return $orderRepository;
}
/**
@@ -71,8 +71,8 @@ protected function _getMockOrderFactory($code)
protected function _getMockShipmentRepository($code)
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
- $orderFactory = $this->_getMockOrderFactory($code);
- $shipmentArgs = ['orderFactory' => $orderFactory];
+ $orderRepository = $this->_getMockOrderRepository($code);
+ $shipmentArgs = ['orderRepository' => $orderRepository];
$shipment = $objectManager->create('Magento\Sales\Model\Order\Shipment', $shipmentArgs);
$shipmentRepository = $this->getMock(
diff --git a/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php b/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php
index a834a2151282e..c7c910a4c07be 100644
--- a/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php
+++ b/lib/internal/Magento/Framework/Api/AbstractServiceCollection.php
@@ -96,6 +96,9 @@ public function __construct(
*
* $field = ['age', 'name'];
* $condition = [42, ['like' => 'Mage']];
+ * or
+ * ['rate', 'tax_postcode']
+ * [['from'=>"3",'to'=>'8.25'], ['like' =>'%91000%']];
*
* The above would find where age equal to 42 OR name like %Mage%.
*
@@ -106,15 +109,94 @@ public function __construct(
*/
public function addFieldToFilter($field, $condition)
{
- if (is_array($field) && count($field) != count($condition)) {
+ if (is_array($field) && is_array($condition) && count($field) != count($condition)) {
throw new LocalizedException(
new \Magento\Framework\Phrase('When passing in a field array there must be a matching condition array.')
);
+ } elseif (is_array($field) && !count($field) > 0) {
+ throw new LocalizedException(
+ new \Magento\Framework\Phrase(
+ 'When passing an array of fields there must be at least one field in the array.'
+ )
+ );
+ }
+ $this->processFilters($field, $condition);
+ return $this;
+ }
+
+ /**
+ * Pre-process filters to create multiple groups in case of multiple conditions eg: from & to
+ * @param string|array $field
+ * @param string|int|array $condition
+ * @return $this
+ */
+ private function processFilters($field, $condition)
+ {
+ //test if we have multiple conditions per field
+ $requiresMultipleFilterGroups = false;
+ if (is_array($field) && is_array($condition)) {
+ foreach ($condition as $cond) {
+ if (is_array($cond) && count($cond) > 1) {
+ $requiresMultipleFilterGroups = true;
+ break;
+ }
+ }
+ } elseif (is_array($condition)) {
+ $requiresMultipleFilterGroups = true;
+ }
+
+ if ($requiresMultipleFilterGroups) {
+ $this->addFilterGroupsForMultipleConditions($field, $condition);
+ } else {
+ $this->addFilterGroupsForSingleConditions($field, $condition);
}
+ return $this;
+ }
+
+ /**
+ * Return a single filter group in case of single conditions
+ * @param string|array $field
+ * @param string|int|array $condition
+ * @return $this
+ */
+ private function addFilterGroupsForSingleConditions($field, $condition)
+ {
$this->fieldFilters[] = ['field' => $field, 'condition' => $condition];
return $this;
}
+ /**
+ * Return multiple filters groups in case of multiple conditions eg: from & to
+ * @param string|array $field
+ * @param array $condition
+ * @return $this
+ */
+ private function addFilterGroupsForMultipleConditions($field, $condition)
+ {
+ if (!is_array($field) && is_array($condition)) {
+ foreach ($condition as $key => $value) {
+ $this->fieldFilters[] = ['field' => $field, 'condition' => [$key => $value]];
+ }
+ } else {
+ $cnt = 0;
+ foreach ($condition as $cond) {
+ if (is_array($cond)) {
+ //we Do want multiple groups in this case
+ foreach ($cond as $condKey => $condValue) {
+ $this->fieldFilters[] = [
+ 'field' => array_slice($field, $cnt, 1, true),
+ 'condition' => [$condKey => $condValue]
+ ];
+ }
+ } else {
+ $this->fieldFilters[] = ['field' => array_slice($field, $cnt, 1, true), 'condition' => $cond];
+ }
+ $cnt++;
+ }
+ }
+ return $this;
+ }
+
/**
* Creates a search criteria DTO based on the array of field filters.
*
diff --git a/lib/internal/Magento/Framework/Pricing/Render/Amount.php b/lib/internal/Magento/Framework/Pricing/Render/Amount.php
index a17c6d08af4c5..0f91eedf9850b 100644
--- a/lib/internal/Magento/Framework/Pricing/Render/Amount.php
+++ b/lib/internal/Magento/Framework/Pricing/Render/Amount.php
@@ -207,9 +207,11 @@ protected function getAdjustments($adjustmentRenders)
$data = $this->getData();
$adjustments = [];
foreach ($adjustmentRenders as $adjustmentRender) {
- $html = $adjustmentRender->render($this, $data);
- if (trim($html)) {
- $adjustments[$adjustmentRender->getAdjustmentCode()] = $html;
+ if ($this->getAmount()->getAdjustmentAmount($adjustmentRender->getAdjustmentCode()) !== false) {
+ $html = $adjustmentRender->render($this, $data);
+ if (trim($html)) {
+ $adjustments[$adjustmentRender->getAdjustmentCode()] = $html;
+ }
}
}
return $adjustments;
diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/AmountTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/AmountTest.php
index fbf8d4f834f2f..75d87e1f96ca4 100644
--- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/AmountTest.php
+++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/AmountTest.php
@@ -169,6 +169,9 @@ public function testToHtmlGetAdjustmentRenders()
$this->rendererPool->expects($this->once())
->method('getAdjustmentRenders')
->will($this->returnValue($adjustmentRenders));
+ $this->amount->expects($this->atLeastOnce())
+ ->method('getAdjustmentAmount')
+ ->willReturn(true);
$this->model->toHtml();
}
@@ -226,6 +229,9 @@ public function testAdjustmentsHtml()
$this->rendererPool->expects($this->once())
->method('getAdjustmentRenders')
->will($this->returnValue($adjustmentRenders));
+ $this->amount->expects($this->atLeastOnce())
+ ->method('getAdjustmentAmount')
+ ->willReturn(true);
$this->model->toHtml();