Skip to content

Commit bd1655b

Browse files
authored
Merge pull request #535 from magento-folks/bugfix
[Folks] Bugs: - MAGETWO-59258 [Github] Override module-directory/etc/zip_codes.xml only the last code of a country gets included #6694 - MAGETWO-59512 [GitHub] Products in wishlist show $0.00 price #6866 - MAGETWO-59185 [GITHUB] Offline carrier configuration option "showmethod" does not appear in admin panel carrier configuration page #5693 - MAGETWO-59130 [Github] REST API with searchCriteria does not return category_ids #6127 - MAGETWO-57850 Unable to filter blocks using store view and block ID - MAGETWO-57682 [GitHub] Checkout Agreement validation is broken on payment method change #6224 - MAGETWO-59573 Braintree JS error on checkout after applying 100% discount coupon with free shipping enabled
2 parents 9666070 + 6a08fad commit bd1655b

File tree

22 files changed

+252
-55
lines changed

22 files changed

+252
-55
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ define([
9898
quote.totals.subscribe(function () {
9999
if (self.grandTotalAmount !== quote.totals()['base_grand_total']) {
100100
self.grandTotalAmount = quote.totals()['base_grand_total'];
101-
self.reInitPayPal();
102101
}
103102
});
104103

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
640640

641641
$collection->load();
642642

643+
$collection->addCategoryIds();
643644
$searchResult = $this->searchResultsFactory->create();
644645
$searchResult->setSearchCriteria($searchCriteria);
645646
$searchResult->setItems($collection->getItems());

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ public function testGetList()
715715
->method('process')
716716
->with($searchCriteriaMock, $collectionMock);
717717
$collectionMock->expects($this->once())->method('load');
718+
$collectionMock->expects($this->once())->method('addCategoryIds');
718719
$collectionMock->expects($this->once())->method('getItems')->willReturn([$itemsMock]);
719720
$collectionMock->expects($this->once())->method('getSize')->willReturn(128);
720721
$searchResultsMock = $this->getMock(

app/code/Magento/CheckoutAgreements/view/frontend/web/js/model/agreement-validator.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ define(
1212
function ($) {
1313
'use strict';
1414
var checkoutConfig = window.checkoutConfig,
15-
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};
16-
17-
var agreementsInputPath = '.payment-method._active div.checkout-agreements input';
15+
agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},
16+
agreementsInputPath = '.payment-method._active div.checkout-agreements input';
1817

1918
return {
2019
/**
@@ -23,26 +22,11 @@ define(
2322
* @returns {boolean}
2423
*/
2524
validate: function() {
26-
if (!agreementsConfig.isEnabled) {
27-
return true;
28-
}
29-
30-
if ($(agreementsInputPath).length == 0) {
25+
if (!agreementsConfig.isEnabled || $(agreementsInputPath).length == 0) {
3126
return true;
3227
}
3328

34-
return $('#co-payment-form').validate({
35-
errorClass: 'mage-error',
36-
errorElement: 'div',
37-
meta: 'validate',
38-
errorPlacement: function (error, element) {
39-
var errorPlacement = element;
40-
if (element.is(':checkbox') || element.is(':radio')) {
41-
errorPlacement = element.siblings('label').last();
42-
}
43-
errorPlacement.after(error);
44-
}
45-
}).element(agreementsInputPath);
29+
return $.validator.validateSingleElement(agreementsInputPath, {errorElement: 'div'});
4630
}
4731
}
4832
}

app/code/Magento/CheckoutAgreements/view/frontend/web/template/checkout/checkout-agreements.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
<div class="checkout-agreements" data-bind="visible: isVisible">
99
<!-- ko foreach: agreements -->
1010
<!-- ko if: ($parent.isAgreementRequired($data)) -->
11-
<div class="checkout-agreement">
12-
<input type="checkbox"
11+
<div class="checkout-agreement required">
12+
<input type="checkbox" class="required-entry"
1313
data-bind="attr: {
1414
'id': 'agreement_' + agreementId,
1515
'name': 'agreement[' + agreementId + ']',
1616
'value': agreementId
17-
}"
18-
data-validate="{required:true}" />
17+
}"/>
1918
<label data-bind="attr: {'for': 'agreement_' + agreementId}">
2019
<button type="button"
2120
class="action action-show"

app/code/Magento/Cms/Model/ResourceModel/Block/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected function _construct()
4141
{
4242
$this->_init(\Magento\Cms\Model\Block::class, \Magento\Cms\Model\ResourceModel\Block::class);
4343
$this->_map['fields']['store'] = 'store_table.store_id';
44+
$this->_map['fields']['block_id'] = 'main_table.block_id';
4445
}
4546

4647
/**

app/code/Magento/Directory/Model/Country/Postcode/Config/Reader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class Reader extends \Magento\Framework\Config\Reader\Filesystem
1212
*
1313
* @var array
1414
*/
15-
protected $_idAttributes = ['/config/zip' => 'countryCode'];
15+
protected $_idAttributes = [
16+
'/config/zip' => 'countryCode',
17+
'/config/zip/codes/code' => 'id',
18+
];
1619

1720
/**
1821
* Construct the FileSystem Reader Class

app/code/Magento/OfflineShipping/etc/adminhtml/system.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0">
5353
<label>Show Method if Not Applicable</label>
5454
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
55+
<frontend_class>shipping-skip-hide</frontend_class>
5556
</field>
5657
<field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
5758
<label>Displayed Error Message</label>
@@ -146,6 +147,7 @@
146147
<field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0">
147148
<label>Show Method if Not Applicable</label>
148149
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
150+
<frontend_class>shipping-skip-hide</frontend_class>
149151
</field>
150152
<field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
151153
<label>Displayed Error Message</label>

app/code/Magento/Wishlist/Pricing/ConfiguredPrice/ConfigurableProduct.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,12 @@ class ConfigurableProduct extends FinalPrice implements ConfiguredPriceInterface
2121
*/
2222
public function getValue()
2323
{
24-
$result = 0.;
2524
/** @var \Magento\Wishlist\Model\Item\Option $customOption */
2625
$customOption = $this->getProduct()->getCustomOption('simple_product');
27-
if ($customOption) {
28-
/** @var \Magento\Framework\Pricing\PriceInfoInterface $priceInfo */
29-
$priceInfo = $customOption->getProduct()->getPriceInfo();
30-
$result = $priceInfo->getPrice(self::PRICE_CODE)->getValue();
31-
}
32-
return max(0, $result);
26+
$product = $customOption ? $customOption->getProduct() : $this->getProduct();
27+
$price = $product->getPriceInfo()->getPrice(self::PRICE_CODE)->getValue();
28+
29+
return max(0, $price);
3330
}
3431

3532
/**

app/code/Magento/Wishlist/Test/Unit/Pricing/ConfiguredPrice/ConfigurableProductTest.php

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,30 @@
55
*/
66
namespace Magento\Wishlist\Test\Unit\Pricing\ConfiguredPrice;
77

8-
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
9-
use Magento\Framework\Pricing\PriceCurrencyInterface;
10-
use Magento\Framework\Pricing\PriceInfoInterface;
11-
use Magento\Framework\Pricing\SaleableInterface;
12-
use Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct;
13-
148
class ConfigurableProductTest extends \PHPUnit_Framework_TestCase
159
{
1610
/**
17-
* @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
11+
* @var \Magento\Framework\Pricing\SaleableInterface|\PHPUnit_Framework_MockObject_MockObject
1812
*/
1913
private $saleableItem;
2014

2115
/**
22-
* @var CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
16+
* @var \Magento\Framework\Pricing\Adjustment\CalculatorInterface|\PHPUnit_Framework_MockObject_MockObject
2317
*/
2418
private $calculator;
2519

2620
/**
27-
* @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
21+
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
2822
*/
2923
private $priceCurrency;
3024

3125
/**
32-
* @var ConfigurableProduct
26+
* @var \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct
3327
*/
3428
private $model;
3529

3630
/**
37-
* @var PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
31+
* @var \Magento\Framework\Pricing\PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject
3832
*/
3933
private $priceInfoMock;
4034

@@ -49,17 +43,14 @@ protected function setUp()
4943
'getCustomOption',
5044
])
5145
->getMockForAbstractClass();
52-
$this->saleableItem->expects($this->once())
53-
->method('getPriceInfo')
54-
->willReturn($this->priceInfoMock);
5546

5647
$this->calculator = $this->getMockBuilder(\Magento\Framework\Pricing\Adjustment\CalculatorInterface::class)
5748
->getMockForAbstractClass();
5849

5950
$this->priceCurrency = $this->getMockBuilder(\Magento\Framework\Pricing\PriceCurrencyInterface::class)
6051
->getMockForAbstractClass();
6152

62-
$this->model = new ConfigurableProduct(
53+
$this->model = new \Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct(
6354
$this->saleableItem,
6455
null,
6556
$this->calculator,
@@ -82,7 +73,7 @@ public function testGetValue()
8273
->getMock();
8374
$this->priceInfoMock->expects($this->once())
8475
->method('getPrice')
85-
->with(ConfigurableProduct::PRICE_CODE)
76+
->with(\Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct::PRICE_CODE)
8677
->willReturn($priceMock);
8778

8879
$productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
@@ -109,11 +100,28 @@ public function testGetValue()
109100

110101
public function testGetValueWithNoCustomOption()
111102
{
103+
$priceValue = 100;
104+
105+
$priceMock = $this->getMockBuilder(\Magento\Framework\Pricing\Price\PriceInterface::class)
106+
->getMockForAbstractClass();
107+
$priceMock->expects($this->once())
108+
->method('getValue')
109+
->willReturn($priceValue);
110+
112111
$this->saleableItem->expects($this->once())
113112
->method('getCustomOption')
114113
->with('simple_product')
115114
->willReturn(null);
116115

117-
$this->assertEquals(0, $this->model->getValue());
116+
$this->saleableItem->expects($this->once())
117+
->method('getPriceInfo')
118+
->willReturn($this->priceInfoMock);
119+
120+
$this->priceInfoMock->expects($this->once())
121+
->method('getPrice')
122+
->with(\Magento\Wishlist\Pricing\ConfiguredPrice\ConfigurableProduct::PRICE_CODE)
123+
->willReturn($priceMock);
124+
125+
$this->assertEquals(100, $this->model->getValue());
118126
}
119127
}

0 commit comments

Comments
 (0)