Skip to content

Commit f93b8da

Browse files
author
Bomko, Alex(abomko)
committed
Merge pull request #540 from magento-tango/MAGETWO-51859
[Tango] Bugfixes
2 parents 072a1ae + de3ce5c commit f93b8da

File tree

6 files changed

+30
-28
lines changed

6 files changed

+30
-28
lines changed

app/code/Magento/Bundle/Test/Unit/Pricing/Price/TierPriceTest.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,8 @@ public function providerForGetterTierPriceList()
162162
'basePrice' => 20.,
163163
'expectedResult' => [
164164
[
165-
'price' => '50.',
166-
'website_price' => '50.',
167-
'price_qty' => '2.',
168-
'cust_group' => Group::CUST_GROUP_ALL,
169-
],
170-
[
171-
'price' => '30.',
172-
'website_price' => '30.',
165+
'price' => '15.',
166+
'website_price' => '15.',
173167
'price_qty' => '5.',
174168
'cust_group' => Group::CUST_GROUP_ALL
175169
],

app/code/Magento/Catalog/Pricing/Price/TierPrice.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ protected function filterTierPrices(array $priceList)
162162
$qtyCache = [];
163163
$allCustomersGroupId = $this->groupManagement->getAllCustomersGroup()->getId();
164164
foreach ($priceList as $priceKey => &$price) {
165+
if ($price['price'] >= $this->priceInfo->getPrice(FinalPrice::PRICE_CODE)->getValue()) {
166+
unset($priceList[$priceKey]);
167+
continue;
168+
}
169+
165170
if (isset($price['price_qty']) && $price['price_qty'] == 1) {
166171
unset($priceList[$priceKey]);
167172
continue;
@@ -204,7 +209,7 @@ protected function getBasePrice()
204209
public function getSavePercent(AmountInterface $amount)
205210
{
206211
return ceil(
207-
100 - ((100 / $this->priceInfo->getPrice(RegularPrice::PRICE_CODE)->getAmount()->getBaseAmount())
212+
100 - ((100 / $this->priceInfo->getPrice(FinalPrice::PRICE_CODE)->getValue())
208213
* $amount->getBaseAmount())
209214
);
210215
}

app/code/Magento/Catalog/Test/Unit/Pricing/Price/TierPriceTest.php

+12-14
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88

99
namespace Magento\Catalog\Test\Unit\Pricing\Price;
1010

11-
use \Magento\Catalog\Pricing\Price\TierPrice;
12-
use \Magento\Catalog\Pricing\Price\RegularPrice;
13-
11+
use Magento\Catalog\Pricing\Price\TierPrice;
12+
use Magento\Catalog\Pricing\Price\FinalPrice;
1413
use Magento\Customer\Model\Group;
1514
use Magento\Customer\Model\GroupManagement;
1615

@@ -271,6 +270,10 @@ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult
271270
$this->calculator->expects($this->atLeastOnce())->method('getAmount')
272271
->will($this->returnArgument(0));
273272

273+
$this->priceInfo->expects(static::atLeastOnce())
274+
->method('getPrice')
275+
->with(FinalPrice::PRICE_CODE)
276+
->willReturn($price);
274277
$this->priceCurrencyMock->expects($this->any())
275278
->method('convertAndRound')
276279
->will($this->returnCallback(
@@ -365,20 +368,15 @@ public function providerForGetterTierPriceList()
365368
*/
366369
public function testGetSavePercent($basePrice, $tierPrice, $savedPercent)
367370
{
368-
$priceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface');
369-
$priceAmount->expects($this->once())
370-
->method('getBaseAmount')
371-
->will($this->returnValue($basePrice));
372-
373371
$price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface');
374-
$price->expects($this->any())
375-
->method('getAmount')
376-
->will($this->returnValue($priceAmount));
377372

378-
$this->priceInfo->expects($this->atLeastOnce())
373+
$this->priceInfo->expects(static::atLeastOnce())
379374
->method('getPrice')
380-
->will($this->returnValue($price))
381-
->with(RegularPrice::PRICE_CODE);
375+
->with(FinalPrice::PRICE_CODE)
376+
->willReturn($price);
377+
$price->expects(static::atLeastOnce())
378+
->method('getValue')
379+
->willReturn($basePrice);
382380

383381
$amount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface');
384382
$amount->expects($this->atLeastOnce())

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ protected function customizeNameListeners(array $meta)
342342
'handleShortDescriptionChanges' => '${$.provider}:data.product.short_description',
343343
'handleSizeChanges' => '${$.provider}:data.product.size'
344344
],
345+
'allowImport' => !$this->locator->getProduct()->getId(),
345346
];
346347

347348
if (!in_array($listener, $textListeners)) {
@@ -356,8 +357,7 @@ protected function customizeNameListeners(array $meta)
356357
$skuPath . static::META_CONFIG_PATH,
357358
$meta,
358359
[
359-
'autoImportIfEmpty' => true,
360-
'allowImport' => $this->locator->getProduct()->getId() ? false : true,
360+
'autoImportIfEmpty' => true
361361
]
362362
);
363363

app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,10 @@ protected function getRows()
443443
'elementTmpl' => 'Magento_ConfigurableProduct/components/file-uploader',
444444
'fileInputName' => 'image',
445445
'isMultipleFiles' => false,
446-
'imports' => [
446+
'links' => [
447447
'thumbnailUrl' => '${$.provider}:${$.parentScope}.thumbnail_image',
448-
'thumbnail' => '${$.provider}:${$.parentScope}.thumbnail'
448+
'thumbnail' => '${$.provider}:${$.parentScope}.thumbnail',
449+
'smallImage' => '${$.provider}:${$.parentScope}.small_image',
449450
],
450451
'uploaderConfig' => [
451452
'url' => $this->urlBuilder->addSessionParam()->getUrl(

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/file-uploader.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ define([
1313
actionsListOpened: false,
1414
thumbnailUrl: '',
1515
thumbnail: null,
16+
smallImage: null,
1617
defaults: {
1718
fileInputName: ''
1819
},
@@ -23,7 +24,7 @@ define([
2324
* @returns {Object} Chainable.
2425
*/
2526
initObservable: function () {
26-
this._super().observe(['processedFile', 'actionsListOpened', 'thumbnailUrl', 'thumbnail']);
27+
this._super().observe(['processedFile', 'actionsListOpened', 'thumbnailUrl', 'thumbnail', 'smallImage']);
2728

2829
return this;
2930
},
@@ -89,6 +90,9 @@ define([
8990
deleteImage: function () {
9091
this.processedFile({});
9192
this.value(null);
93+
this.thumbnail(null);
94+
this.thumbnailUrl(null);
95+
this.smallImage(null);
9296

9397
return this;
9498
}

0 commit comments

Comments
 (0)