Skip to content

Commit 4e81fd8

Browse files
Merge branch '2.4-develop' into fix_cloning_quote_billing_addres_street
2 parents 2687221 + 6b4a82b commit 4e81fd8

File tree

279 files changed

+9439
-1396
lines changed

Some content is hidden

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

279 files changed

+9439
-1396
lines changed

app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<argument name="submenuUiId" value="{{AdminMenuReportsBusinessIntelligenceAdvancedReporting.dataUiId}}"/>
3131
</actionGroup>
3232
<switchToNextTab stepKey="switchToNewTab"/>
33+
<waitForPageLoad stepKey="waitForAdvancedReportingPageLoad"/>
3334
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
3435
</test>
3536
</tests>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminLogoutActionGroup">
12+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
13+
</actionGroup>
14+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@
1818
<severity value="MAJOR"/>
1919
<group value="backend"/>
2020
<group value="mtf_migrated"/>
21-
<skip>
22-
<issueId value="MC-17140"/>
23-
</skip>
2421
</annotations>
2522
<before>
2623
<magentoCLI command="config:set {{MinifyJavaScriptFilesEnableConfigData.path}} {{MinifyJavaScriptFilesEnableConfigData.value}}" stepKey="enableJsMinification"/>
24+
<magentoCLI command="cache:clean config" stepKey="cleanCache"/>
2725
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2826
</before>
2927
<after>
3028
<magentoCLI command="config:set {{MinifyJavaScriptFilesDisableConfigData.path}} {{MinifyJavaScriptFilesDisableConfigData.value}}" stepKey="disableJsMinification"/>
3129
<actionGroup ref="logout" stepKey="logout"/>
3230
</after>
33-
31+
<see userInput="Dashboard" selector="{{AdminHeaderSection.pageTitle}}" stepKey="seeDashboardTitle"/>
32+
<waitForPageLoad stepKey="waitForPageLoadOnDashboard"/>
3433
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="loggedInSuccessfully"/>
3534
<actionGroup ref="AssertAdminPageIsNot404ActionGroup" stepKey="dontSee404Page"/>
3635
</test>

app/code/Magento/Backend/view/adminhtml/layout/adminhtml_cache_block.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<argument name="type" xsi:type="string">options</argument>
8181
<argument name="width" xsi:type="string">120</argument>
8282
<argument name="align" xsi:type="string">left</argument>
83+
<argument name="sortable" xsi:type="string">0</argument>
8384
<argument name="options" xsi:type="array">
8485
<item name="disabled" xsi:type="array">
8586
<item name="value" xsi:type="string">0</item>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAdminEditDataTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<waitForPageLoad stepKey="waitForElementAdded"/>
8080

8181
<!-- Go to the shopping cart page and grab the value of the option title -->
82-
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/>
82+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
8383
<waitForPageLoad stepKey="waitForCartPageLoad"/>
8484
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalBefore"/>
8585

@@ -100,7 +100,7 @@
100100
<see stepKey="assertSuccess2" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/>
101101

102102
<!-- Go to the shopping cart page and make sure the title has changed -->
103-
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart1"/>
103+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart1"/>
104104
<waitForPageLoad stepKey="waitForCartPageLoad1"/>
105105
<grabTextFrom selector="{{CheckoutCartProductSection.nthBundleOptionName('1')}}" stepKey="grabTotalAfter"/>
106106
<assertNotEquals expected="{$grabTotalBefore}" expectedType="string" actual="{$grabTotalAfter}" actualType="string" stepKey="assertNotEquals"/>

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<waitForPageLoad stepKey="waitForElementAdded2"/>
8787

8888
<!-- Go to the shopping cart page and edit the first product -->
89-
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart"/>
89+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart"/>
9090
<waitForPageLoad stepKey="waitForCartPageLoad"/>
9191
<waitForElementVisible stepKey="waitForInfoDropdown" selector="{{CheckoutCartSummarySection.total}}"/>
9292
<waitForPageLoad stepKey="waitForCartPageLoad3"/>
@@ -104,7 +104,7 @@
104104
<waitForPageLoad stepKey="waitForElementAdded3"/>
105105

106106
<!-- Go to the shopping cart page -->
107-
<amOnPage url="/checkout/cart/" stepKey="onPageShoppingCart2"/>
107+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="onPageShoppingCart2"/>
108108
<waitForPageLoad stepKey="waitForCartPageLoad2"/>
109109

110110
<!-- Assert that the options are both there and the proce no longer matches -->

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ define([
2828
controlContainer: 'dd', // should be eliminated
2929
priceFormat: {},
3030
isFixedPrice: false,
31-
optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role="selection-tier-prices"]'
31+
optionTierPricesBlocksSelector: '#option-tier-prices-{1} [data-role="selection-tier-prices"]',
32+
isOptionsInitialized: false
3233
};
3334

3435
$.widget('mage.priceBundle', {
@@ -53,20 +54,37 @@ define([
5354
priceBox = $(this.options.priceBoxSelector, form),
5455
qty = $(this.options.qtyFieldSelector, form);
5556

56-
if (priceBox.data('magePriceBox') &&
57-
priceBox.priceBox('option') &&
58-
priceBox.priceBox('option').priceConfig
59-
) {
60-
if (priceBox.priceBox('option').priceConfig.optionTemplate) {
61-
this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate);
57+
this._updatePriceBox();
58+
priceBox.on('price-box-initialized', this._updatePriceBox.bind(this));
59+
options.on('change', this._onBundleOptionChanged.bind(this));
60+
qty.on('change', this._onQtyFieldChanged.bind(this));
61+
},
62+
63+
/**
64+
* Update price box config with bundle option prices
65+
* @private
66+
*/
67+
_updatePriceBox: function () {
68+
var form = this.element,
69+
options = $(this.options.productBundleSelector, form),
70+
priceBox = $(this.options.priceBoxSelector, form);
71+
72+
if (!this.options.isOptionsInitialized) {
73+
if (priceBox.data('magePriceBox') &&
74+
priceBox.priceBox('option') &&
75+
priceBox.priceBox('option').priceConfig
76+
) {
77+
if (priceBox.priceBox('option').priceConfig.optionTemplate) { //eslint-disable-line max-depth
78+
this._setOption('optionTemplate', priceBox.priceBox('option').priceConfig.optionTemplate);
79+
}
80+
this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);
81+
priceBox.priceBox('setDefault', this.options.optionConfig.prices);
82+
this.options.isOptionsInitialized = true;
6283
}
63-
this._setOption('priceFormat', priceBox.priceBox('option').priceConfig.priceFormat);
64-
priceBox.priceBox('setDefault', this.options.optionConfig.prices);
84+
this._applyOptionNodeFix(options);
6585
}
66-
this._applyOptionNodeFix(options);
6786

68-
options.on('change', this._onBundleOptionChanged.bind(this));
69-
qty.on('change', this._onQtyFieldChanged.bind(this));
87+
return this;
7088
},
7189

7290
/**

app/code/Magento/Captcha/Test/Mftf/Section/CaptchaFormsDisplayingSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="CaptchaFormsDisplayingSection">
1212
<element name="store" type="button" selector="#menu-magento-backend-stores"/>
1313
<element name="config" type="button" selector="//li[@data-ui-id='menu-magento-config-system-config']//span"/>

app/code/Magento/Catalog/Api/Data/ProductRender/FormattedPriceInfoInterface.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function getFinalPrice();
2929

3030
/**
3131
* Set the final price: usually it calculated as minimal price of the product
32+
*
3233
* Can be different depends on type of product
3334
*
3435
* @param string $finalPrice
@@ -39,6 +40,7 @@ public function setFinalPrice($finalPrice);
3940

4041
/**
4142
* Retrieve max price of a product
43+
*
4244
* E.g. for product with custom options is price with the most expensive custom option
4345
*
4446
* @return string
@@ -57,6 +59,7 @@ public function setMaxPrice($maxPrice);
5759

5860
/**
5961
* Retrieve the minimal price of the product or variation
62+
*
6063
* The minimal price is for example, the lowest price of all variations for complex product
6164
*
6265
* @return string
@@ -66,7 +69,7 @@ public function getMinimalPrice();
6669

6770
/**
6871
* Set max regular price
69-
* Max regular price is the same, as maximum price, except of excluding calculating special price and catalogules
72+
* Max regular price is the same, as maximum price, except of excluding calculating special price and catalog rules
7073
* in it
7174
*
7275
* @param string $maxRegularPrice
@@ -130,6 +133,7 @@ public function setMinimalPrice($minimalPrice);
130133

131134
/**
132135
* Regular price - is price of product without discounts and special price with taxes and fixed product tax
136+
*
133137
* Usually this price is corresponding to price in admin panel of product
134138
*
135139
* @return string

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
/**
8-
* Product options abstract type block
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
6+
declare(strict_types=1);
127

138
namespace Magento\Catalog\Block\Product\View\Options;
149

10+
use Magento\Catalog\Pricing\Price\BasePrice;
11+
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
1512
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
13+
use Magento\Framework\App\ObjectManager;
1614

1715
/**
1816
* Product options section abstract block.
@@ -47,20 +45,29 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
4745
*/
4846
protected $_catalogHelper;
4947

48+
/**
49+
* @var CalculateCustomOptionCatalogRule
50+
*/
51+
private $calculateCustomOptionCatalogRule;
52+
5053
/**
5154
* @param \Magento\Framework\View\Element\Template\Context $context
5255
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
5356
* @param \Magento\Catalog\Helper\Data $catalogData
5457
* @param array $data
58+
* @param CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule
5559
*/
5660
public function __construct(
5761
\Magento\Framework\View\Element\Template\Context $context,
5862
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
5963
\Magento\Catalog\Helper\Data $catalogData,
60-
array $data = []
64+
array $data = [],
65+
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
6166
) {
6267
$this->pricingHelper = $pricingHelper;
6368
$this->_catalogHelper = $catalogData;
69+
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
70+
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
6471
parent::__construct($context, $data);
6572
}
6673

@@ -161,6 +168,15 @@ protected function _formatPrice($value, $flag = true)
161168
$priceStr = $sign;
162169

163170
$customOptionPrice = $this->getProduct()->getPriceInfo()->getPrice('custom_option_price');
171+
172+
if (!$value['is_percent']) {
173+
$value['pricing_value'] = $this->calculateCustomOptionCatalogRule->execute(
174+
$this->getProduct(),
175+
(float)$value['pricing_value'],
176+
(bool)$value['is_percent']
177+
);
178+
}
179+
164180
$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
165181
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
166182
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
use Magento\Eav\Api\Data\AttributeGroupInterfaceFactory;
1818
use Magento\Eav\Api\Data\AttributeInterface;
1919
use Magento\Eav\Api\Data\AttributeSetInterface;
20+
use Magento\Eav\Model\Cache\Type as CacheType;
2021
use Magento\Framework\Api\ExtensionAttributesFactory;
2122
use Magento\Framework\Api\SearchCriteriaBuilder;
2223
use Magento\Framework\App\Action\HttpPostActionInterface;
24+
use Magento\Framework\App\CacheInterface;
2325
use Magento\Framework\App\ObjectManager;
2426
use Magento\Framework\Controller\Result\Json;
2527
use Magento\Framework\Controller\Result\JsonFactory;
@@ -29,7 +31,7 @@
2931
use Psr\Log\LoggerInterface;
3032

3133
/**
32-
* Class AddAttributeToTemplate
34+
* Assign attribute to attribute set.
3335
*
3436
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3537
*/
@@ -80,6 +82,11 @@ class AddAttributeToTemplate extends Product implements HttpPostActionInterface
8082
*/
8183
protected $extensionAttributesFactory;
8284

85+
/**
86+
* @var CacheInterface
87+
*/
88+
private $cache;
89+
8390
/**
8491
* Constructor
8592
*
@@ -94,8 +101,8 @@ class AddAttributeToTemplate extends Product implements HttpPostActionInterface
94101
* @param AttributeManagementInterface $attributeManagement
95102
* @param LoggerInterface $logger
96103
* @param ExtensionAttributesFactory $extensionAttributesFactory
104+
* @param CacheInterface|null $cache
97105
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
98-
* @SuppressWarnings(PHPMD.LongVariable)
99106
* @SuppressWarnings(PHPMD.NPathComplexity)
100107
*/
101108
public function __construct(
@@ -109,7 +116,8 @@ public function __construct(
109116
SearchCriteriaBuilder $searchCriteriaBuilder = null,
110117
AttributeManagementInterface $attributeManagement = null,
111118
LoggerInterface $logger = null,
112-
ExtensionAttributesFactory $extensionAttributesFactory = null
119+
ExtensionAttributesFactory $extensionAttributesFactory = null,
120+
CacheInterface $cache = null
113121
) {
114122
parent::__construct($context, $productBuilder);
115123
$this->resultJsonFactory = $resultJsonFactory;
@@ -129,6 +137,7 @@ public function __construct(
129137
->get(LoggerInterface::class);
130138
$this->extensionAttributesFactory = $extensionAttributesFactory ?: ObjectManager::getInstance()
131139
->get(ExtensionAttributesFactory::class);
140+
$this->cache = $cache ?? ObjectManager::getInstance()->get(CacheInterface::class);
132141
}
133142

134143
/**
@@ -203,6 +212,7 @@ function (AttributeInterface $attribute) use ($attributeSet, $attributeGroup) {
203212
);
204213
}
205214
);
215+
$this->cache->clean([CacheType::CACHE_TAG]);
206216
} catch (LocalizedException $e) {
207217
$response->setError(true);
208218
$response->setMessage($e->getMessage());
@@ -223,7 +233,7 @@ function (AttributeInterface $attribute) use ($attributeSet, $attributeGroup) {
223233
*/
224234
private function getBasicAttributeSearchCriteriaBuilder()
225235
{
226-
$attributeIds = (array) $this->getRequest()->getParam('attributeIds', []);
236+
$attributeIds = (array)$this->getRequest()->getParam('attributeIds', []);
227237

228238
if (empty($attributeIds['selected'])) {
229239
throw new LocalizedException(__('Attributes were missing and must be specified.'));

0 commit comments

Comments
 (0)