From 0fe06aaee22ff81a6fd6b4eb61270f33b5a02d68 Mon Sep 17 00:00:00 2001 From: Yuri Kovsher Date: Wed, 6 Apr 2016 13:38:39 +0300 Subject: [PATCH 1/5] MAGETWO-50605: Tier pricing is not validated against product special price --- app/code/Magento/Catalog/Pricing/Price/TierPrice.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php index 3ff4f5c898c66..6835453173dbd 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php @@ -162,6 +162,11 @@ protected function filterTierPrices(array $priceList) $qtyCache = []; $allCustomersGroupId = $this->groupManagement->getAllCustomersGroup()->getId(); foreach ($priceList as $priceKey => &$price) { + if ($price['price'] >= $this->priceInfo->getPrice(FinalPrice::PRICE_CODE)->getValue()) { + unset($priceList[$priceKey]); + continue; + } + if (isset($price['price_qty']) && $price['price_qty'] == 1) { unset($priceList[$priceKey]); continue; @@ -204,7 +209,7 @@ protected function getBasePrice() public function getSavePercent(AmountInterface $amount) { return ceil( - 100 - ((100 / $this->priceInfo->getPrice(RegularPrice::PRICE_CODE)->getAmount()->getBaseAmount()) + 100 - ((100 / $this->priceInfo->getPrice(FinalPrice::PRICE_CODE)->getValue()) * $amount->getBaseAmount()) ); } From b7c637f0f0618cc98a5d700a0684df43e6d8eeef Mon Sep 17 00:00:00 2001 From: Yuri Kovsher Date: Wed, 6 Apr 2016 15:57:40 +0300 Subject: [PATCH 2/5] MAGETWO-50605: Tier pricing is not validated against product special price --- .../Test/Unit/Pricing/Price/TierPriceTest.php | 10 ++----- .../Test/Unit/Pricing/Price/TierPriceTest.php | 26 +++++++++---------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/TierPriceTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/TierPriceTest.php index ab0329741ba04..46c6077978f46 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/TierPriceTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/TierPriceTest.php @@ -162,14 +162,8 @@ public function providerForGetterTierPriceList() 'basePrice' => 20., 'expectedResult' => [ [ - 'price' => '50.', - 'website_price' => '50.', - 'price_qty' => '2.', - 'cust_group' => Group::CUST_GROUP_ALL, - ], - [ - 'price' => '30.', - 'website_price' => '30.', + 'price' => '15.', + 'website_price' => '15.', 'price_qty' => '5.', 'cust_group' => Group::CUST_GROUP_ALL ], diff --git a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/TierPriceTest.php b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/TierPriceTest.php index c287f0263e299..fce88c3a3fea7 100644 --- a/app/code/Magento/Catalog/Test/Unit/Pricing/Price/TierPriceTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Pricing/Price/TierPriceTest.php @@ -8,9 +8,8 @@ namespace Magento\Catalog\Test\Unit\Pricing\Price; -use \Magento\Catalog\Pricing\Price\TierPrice; -use \Magento\Catalog\Pricing\Price\RegularPrice; - +use Magento\Catalog\Pricing\Price\TierPrice; +use Magento\Catalog\Pricing\Price\FinalPrice; use Magento\Customer\Model\Group; use Magento\Customer\Model\GroupManagement; @@ -271,6 +270,10 @@ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult $this->calculator->expects($this->atLeastOnce())->method('getAmount') ->will($this->returnArgument(0)); + $this->priceInfo->expects(static::atLeastOnce()) + ->method('getPrice') + ->with(FinalPrice::PRICE_CODE) + ->willReturn($price); $this->priceCurrencyMock->expects($this->any()) ->method('convertAndRound') ->will($this->returnCallback( @@ -365,20 +368,15 @@ public function providerForGetterTierPriceList() */ public function testGetSavePercent($basePrice, $tierPrice, $savedPercent) { - $priceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); - $priceAmount->expects($this->once()) - ->method('getBaseAmount') - ->will($this->returnValue($basePrice)); - $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); - $price->expects($this->any()) - ->method('getAmount') - ->will($this->returnValue($priceAmount)); - $this->priceInfo->expects($this->atLeastOnce()) + $this->priceInfo->expects(static::atLeastOnce()) ->method('getPrice') - ->will($this->returnValue($price)) - ->with(RegularPrice::PRICE_CODE); + ->with(FinalPrice::PRICE_CODE) + ->willReturn($price); + $price->expects(static::atLeastOnce()) + ->method('getValue') + ->willReturn($basePrice); $amount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); $amount->expects($this->atLeastOnce()) From 81a903c1ef55b87974d142f042e4d9069eb2614b Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 12 Apr 2016 16:23:20 +0300 Subject: [PATCH 3/5] MAGETWO-51831: Meta Title, Meta Keywords, Meta Description not saved when editing product --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/General.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 4cdc764568d63..594abc75f663a 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -342,6 +342,7 @@ protected function customizeNameListeners(array $meta) 'handleShortDescriptionChanges' => '${$.provider}:data.product.short_description', 'handleSizeChanges' => '${$.provider}:data.product.size' ], + 'allowImport' => $this->locator->getProduct()->getId() ? false : true, ]; if (!in_array($listener, $textListeners)) { @@ -356,8 +357,7 @@ protected function customizeNameListeners(array $meta) $skuPath . static::META_CONFIG_PATH, $meta, [ - 'autoImportIfEmpty' => true, - 'allowImport' => $this->locator->getProduct()->getId() ? false : true, + 'autoImportIfEmpty' => true ] ); From bd46881647637088e4f00c90d9ef4b37b3ee7d29 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 12 Apr 2016 16:44:28 +0300 Subject: [PATCH 4/5] MAGETWO-51831: Meta Title, Meta Keywords, Meta Description not saved when editing product --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/General.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php index 594abc75f663a..cde02906eb08d 100644 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php @@ -342,7 +342,7 @@ protected function customizeNameListeners(array $meta) 'handleShortDescriptionChanges' => '${$.provider}:data.product.short_description', 'handleSizeChanges' => '${$.provider}:data.product.size' ], - 'allowImport' => $this->locator->getProduct()->getId() ? false : true, + 'allowImport' => !$this->locator->getProduct()->getId(), ]; if (!in_array($listener, $textListeners)) { From ae6c574a1ea592094872463d8e0c6f8aaff697ec Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 12 Apr 2016 18:46:33 +0300 Subject: [PATCH 5/5] MAGETWO-51023: Merchant can't unselect variations' images back on "Create Configurable Product" Admin page --- .../Product/Form/Modifier/ConfigurablePanel.php | 5 +++-- .../view/adminhtml/web/js/components/file-uploader.js | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php index 0fe22484c114a..79d48c25fd478 100644 --- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php +++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php @@ -443,9 +443,10 @@ protected function getRows() 'elementTmpl' => 'Magento_ConfigurableProduct/components/file-uploader', 'fileInputName' => 'image', 'isMultipleFiles' => false, - 'imports' => [ + 'links' => [ 'thumbnailUrl' => '${$.provider}:${$.parentScope}.thumbnail_image', - 'thumbnail' => '${$.provider}:${$.parentScope}.thumbnail' + 'thumbnail' => '${$.provider}:${$.parentScope}.thumbnail', + 'smallImage' => '${$.provider}:${$.parentScope}.small_image', ], 'uploaderConfig' => [ 'url' => $this->urlBuilder->addSessionParam()->getUrl( diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js index d1062fd3df69e..37f183197dae0 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js @@ -13,6 +13,7 @@ define([ actionsListOpened: false, thumbnailUrl: '', thumbnail: null, + smallImage: null, defaults: { fileInputName: '' }, @@ -23,7 +24,7 @@ define([ * @returns {Object} Chainable. */ initObservable: function () { - this._super().observe(['processedFile', 'actionsListOpened', 'thumbnailUrl', 'thumbnail']); + this._super().observe(['processedFile', 'actionsListOpened', 'thumbnailUrl', 'thumbnail', 'smallImage']); return this; }, @@ -89,6 +90,9 @@ define([ deleteImage: function () { this.processedFile({}); this.value(null); + this.thumbnail(null); + this.thumbnailUrl(null); + this.smallImage(null); return this; }