Skip to content

Commit 8671083

Browse files
committed
Merge remote-tracking branch 'main-ce/develop' into MAGETWO-52343
2 parents b5ff5df + 584af4d commit 8671083

File tree

273 files changed

+5099
-3943
lines changed

Some content is hidden

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

273 files changed

+5099
-3943
lines changed

app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Most.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,14 @@ protected function _prepareColumns()
8080

8181
$this->addColumn(
8282
'orders_count',
83-
['header' => __('Orders'), 'sortable' => false, 'index' => 'orders_count', 'type' => 'number']
83+
[
84+
'header' => __('Orders'),
85+
'sortable' => false,
86+
'index' => 'orders_count',
87+
'type' => 'number',
88+
'header_css_class' => 'col-orders',
89+
'column_css_class' => 'col-orders'
90+
]
8491
);
8592

8693
$baseCurrencyCode = (string)$this->_storeManager->getStore(

app/code/Magento/Backend/Block/Dashboard/Tab/Customers/Newest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ protected function _prepareColumns()
7878

7979
$this->addColumn(
8080
'orders_count',
81-
['header' => __('Orders'), 'sortable' => false, 'index' => 'orders_count', 'type' => 'number']
81+
[
82+
'header' => __('Orders'),
83+
'sortable' => false,
84+
'index' => 'orders_count',
85+
'type' => 'number',
86+
'header_css_class' => 'col-orders',
87+
'column_css_class' => 'col-orders'
88+
]
8289
);
8390

8491
$baseCurrencyCode = (string)$this->_storeManager->getStore(

app/code/Magento/Backend/view/adminhtml/templates/page/copyright.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
?>
1010
<a class="link-copyright" href="http://magento.com" target="_blank" title="<?php /* @escapeNotVerified */ echo __('Magento') ?>"></a>
11-
<?php /* @escapeNotVerified */ echo __('Copyright&copy; %1 Magento Commerce Inc. All rights reserved.', date('Y')) ?>
11+
<?php /* @escapeNotVerified */ echo __('Copyright &copy; %1 Magento Commerce Inc. All rights reserved.', date('Y')) ?>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*/
66
-->
77

8-
<div class="admin_field-complex" if="element.addButton">
9-
<div class="admin_field-complex-title">
8+
<div class="admin__field-complex" if="element.addButton">
9+
<div class="admin__field-complex-title">
1010
<span class="label" translate="'User Agent Rules'"></span>
1111
</div>
1212

13-
<div class="admin_field-complex-elements">
13+
<div class="admin__field-complex-elements">
1414
<render args="fallbackResetTpl" if="$data.showFallbackReset && $data.isDifferedFromDefault"/>
1515
<button attr="{disabled: disabled}"
1616
class="action-secondary"
@@ -20,7 +20,7 @@
2020
</button>
2121
</div>
2222

23-
<div class="admin_field-complex-content"
23+
<div class="admin__field-complex-content"
2424
translate="'User agent exceptions override product and CMS pages rules.'"></div>
2525
</div>
2626

app/code/Magento/Braintree/view/adminhtml/web/js/vault.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
define([
88
'jquery',
99
'uiComponent',
10-
'Magento_Ui/js/modal/alert',
11-
'Magento_Checkout/js/model/full-screen-loader'
12-
], function ($, Class, alert, fullScreenLoader) {
10+
'Magento_Ui/js/modal/alert'
11+
], function ($, Class, alert) {
1312
'use strict';
1413

1514
return Class.extend({
@@ -84,7 +83,7 @@ define([
8483
submitOrder: function () {
8584
this.$selector.validate().form();
8685
this.$selector.trigger('afterValidate.beforeSubmit');
87-
fullScreenLoader.stopLoader();
86+
$('body').trigger('processStop');
8887

8988
// validate parent form
9089
if (this.$selector.validate().errorList.length) {
@@ -106,7 +105,7 @@ define([
106105
getPaymentMethodNonce: function () {
107106
var self = this;
108107

109-
fullScreenLoader.startLoader();
108+
$('body').trigger('processStart');
110109

111110
$.get(self.nonceUrl, {
112111
'public_hash': self.publicHash
@@ -118,7 +117,7 @@ define([
118117

119118
self.error(failed.message);
120119
}).always(function () {
121-
fullScreenLoader.stopLoader();
120+
$('body').trigger('processStop');
122121
});
123122
},
124123

app/code/Magento/Bundle/Model/Product/Price.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,9 @@ public function getFinalPrice($qty, $product)
183183
$finalPrice = $this->_applyOptionsPrice($product, $qty, $finalPrice);
184184
$finalPrice += $this->getTotalBundleItemsPrice($product, $qty);
185185

186+
$finalPrice = max(0, $finalPrice);
186187
$product->setFinalPrice($finalPrice);
187-
return max(0, $product->getData('final_price'));
188+
return $finalPrice;
188189
}
189190

190191
/**

app/code/Magento/Bundle/Pricing/Price/FinalPrice.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use Magento\Framework\Pricing\Adjustment\CalculatorInterface;
1111
use Magento\Catalog\Pricing\Price\CustomOptionPrice;
1212
use Magento\Bundle\Model\Product\Price;
13+
use Magento\Framework\App\ObjectManager;
14+
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface;
1315

1416
/**
1517
* Final price model
@@ -36,6 +38,11 @@ class FinalPrice extends \Magento\Catalog\Pricing\Price\FinalPrice implements Fi
3638
*/
3739
protected $bundleOptionPrice;
3840

41+
/**
42+
* @var \Magento\Catalog\Api\ProductCustomOptionRepositoryInterface
43+
*/
44+
private $productOptionRepository;
45+
3946
/**
4047
* @param Product $saleableItem
4148
* @param float $quantity
@@ -81,6 +88,22 @@ public function getMaximalPrice()
8188
return $this->maximalPrice;
8289
}
8390

91+
/**
92+
* Return ProductCustomOptionRepository
93+
*
94+
* @return ProductCustomOptionRepositoryInterface
95+
* @deprecated
96+
*/
97+
private function getProductOptionRepository()
98+
{
99+
if (!$this->productOptionRepository) {
100+
$this->productOptionRepository = ObjectManager::getInstance()->get(
101+
ProductCustomOptionRepositoryInterface::class
102+
);
103+
}
104+
return $this->productOptionRepository;
105+
}
106+
84107
/**
85108
* Returns min price
86109
*
@@ -101,6 +124,7 @@ public function getAmount()
101124
if (!$this->minimalPrice) {
102125
$price = parent::getValue();
103126
if ($this->product->getPriceType() == Price::PRICE_TYPE_FIXED) {
127+
$this->loadProductCustomOptions();
104128
/** @var \Magento\Catalog\Pricing\Price\CustomOptionPrice $customOptionPrice */
105129
$customOptionPrice = $this->priceInfo->getPrice(CustomOptionPrice::PRICE_CODE);
106130
$price += $customOptionPrice->getCustomOptionRange(true);
@@ -110,6 +134,23 @@ public function getAmount()
110134
return $this->minimalPrice;
111135
}
112136

137+
/**
138+
* Load product custom options
139+
*
140+
* @return void
141+
*/
142+
private function loadProductCustomOptions()
143+
{
144+
if (!$this->product->getOptions()) {
145+
$options = [];
146+
foreach ($this->getProductOptionRepository()->getProductOptions($this->product) as $option) {
147+
$option->setProduct($this->product);
148+
$options[] = $option;
149+
}
150+
$this->product->setOptions($options);
151+
}
152+
}
153+
113154
/**
114155
* get bundle product price without any option
115156
*

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
use Magento\Bundle\Pricing\Price\BundleOptionPrice;
1010
use Magento\Catalog\Pricing\Price\CustomOptionPrice;
1111
use Magento\Bundle\Model\Product\Price;
12-
12+
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface;
13+
use Magento\Framework\Pricing\PriceCurrencyInterface;
1314
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1415

16+
/**
17+
* @SuppressWarnings(PHPMD)
18+
*/
1519
class FinalPriceTest extends \PHPUnit_Framework_TestCase
1620
{
1721
/** @var \Magento\Bundle\Pricing\Price\FinalPrice */
@@ -45,10 +49,15 @@ class FinalPriceTest extends \PHPUnit_Framework_TestCase
4549
protected $customOptionPriceMock;
4650

4751
/**
48-
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
52+
* @var PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
4953
*/
5054
protected $priceCurrencyMock;
5155

56+
/**
57+
* @var ProductCustomOptionRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
58+
*/
59+
private $productOptionRepositoryMock;
60+
5261
/**
5362
* @return void
5463
*/
@@ -96,6 +105,14 @@ protected function prepareMock()
96105
$this->bundleCalculatorMock,
97106
$this->priceCurrencyMock
98107
);
108+
109+
$this->productOptionRepositoryMock = $this->getMockForAbstractClass(
110+
ProductCustomOptionRepositoryInterface::class
111+
);
112+
$reflection = new \ReflectionClass(get_class($this->finalPrice));
113+
$reflectionProperty = $reflection->getProperty('productOptionRepository');
114+
$reflectionProperty->setAccessible(true);
115+
$reflectionProperty->setValue($this->finalPrice, $this->productOptionRepositoryMock);
99116
}
100117

101118
/**
@@ -172,6 +189,16 @@ public function testGetMinimalPriceFixedBundleWithOption()
172189
$this->baseAmount = 5;
173190
$result = 7;
174191
$this->prepareMock();
192+
$customOptions = [
193+
$this->getMockBuilder(\Magento\Catalog\Api\Data\ProductCustomOptionInterface::class)
194+
->setMethods(['setProduct'])
195+
->getMockForAbstractClass()
196+
];
197+
198+
$this->productOptionRepositoryMock->expects(static::once())
199+
->method('getProductOptions')
200+
->with($this->saleableInterfaceMock)
201+
->willReturn($customOptions);
175202

176203
$this->saleableInterfaceMock->expects($this->once())
177204
->method('getPriceType')

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ protected function _prepareForm()
7070
}
7171
$this->_coreRegistry->register('attribute_type_hidden_fields', $_hiddenFields);
7272

73-
$this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $form]);
74-
7573
$frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
7674
$frontendInputElm->setValues($frontendInputValues);
7775

76+
$this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $form]);
77+
7878
return $this;
7979
}
8080

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected function createActionPage($title = null)
8888
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
8989
$resultPage = $this->resultPageFactory->create();
9090
if ($this->getRequest()->getParam('popup')) {
91-
if ($this->getRequest()->getParam('product_tab') == 'variations') {
91+
if ($this->getRequest()->getParam('product_tab') === 'variations') {
9292
$resultPage->addHandle(['popup', 'catalog_product_attribute_edit_product_tab_variations_popup']);
9393
} else {
9494
$resultPage->addHandle(['popup', 'catalog_product_attribute_edit_popup']);

0 commit comments

Comments
 (0)