Skip to content

Commit b55e1f2

Browse files
authored
Merge pull request #6448 from magento-tsg-csl3/2.4-develop-pr47
[TSG-CSL3] For 2.4 (pr47)
2 parents 6e0c28c + dd543a7 commit b55e1f2

File tree

18 files changed

+491
-31
lines changed

18 files changed

+491
-31
lines changed

app/code/Magento/Backend/Block/Widget/Button.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
namespace Magento\Backend\Block\Widget;
77

8+
use Magento\Backend\Block\Template\Context;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Math\Random;
10-
use Magento\Backend\Block\Template\Context;
1111
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1212

1313
/**
@@ -125,6 +125,9 @@ protected function _prepareAttributes($title, $classes, $disabled)
125125
'value' => $this->getValue(),
126126
'disabled' => $disabled,
127127
];
128+
if ($this->hasData('onclick_attribute')) {
129+
$attributes['onclick'] = $this->getData('onclick_attribute');
130+
}
128131
if ($this->hasData('backend_button_widget_hook_id')) {
129132
$attributes['backend-button-widget-hook-id'] = $this->getData('backend_button_widget_hook_id');
130133
}

app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ public function getAttributesHtmlDataProvider()
9494
]
9595
];
9696
}
97+
98+
/**
99+
* Verifies ability of adding button onclick attribute
100+
*
101+
* @return void
102+
*/
103+
public function testOnClickAttribute(): void
104+
{
105+
$this->_blockMock->setData(['onclick_attribute' => 'value']);
106+
$attributes = $this->_blockMock->getAttributesHtml();
107+
$this->assertStringContainsString('onclick', $attributes);
108+
}
97109
}

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public function getTierPrices($product)
379379
if (array_key_exists('website_price', $price)) {
380380
$value = $price['website_price'];
381381
} else {
382-
$value = $price['price'];
382+
$value = $price['price'] ?? 0;
383383
}
384384
$tierPrice->setValue($value);
385385
$tierPrice->setQty($price['price_qty']);

app/code/Magento/Catalog/Test/Unit/Model/Product/Type/PriceTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,40 @@ function () {
263263
);
264264
}
265265
}
266+
267+
/**
268+
* Get tier price with percent value type
269+
*
270+
* @return void
271+
*/
272+
public function testGetPricesWithPercentType(): void
273+
{
274+
$tierPrices = [
275+
0 => [
276+
'record_id' => 0,
277+
'cust_group' => 3200,
278+
'price_qty' => 3,
279+
'website_id' => 0,
280+
'value_type' => 'percent',
281+
'percentage_value' => 10,
282+
],
283+
];
284+
$this->product->setData('tier_price', $tierPrices);
285+
$this->tpFactory->expects($this->any())
286+
->method('create')
287+
->willReturnCallback(
288+
function () {
289+
return $this->objectManagerHelper->getObject(TierPrice::class);
290+
}
291+
);
292+
$tierPriceExtensionMock = $this->getMockBuilder(ProductTierPriceExtensionInterface::class)
293+
->onlyMethods(['getPercentageValue', 'setPercentageValue'])
294+
->getMockForAbstractClass();
295+
$tierPriceExtensionMock->method('getPercentageValue')
296+
->willReturn(50);
297+
$this->tierPriceExtensionFactoryMock->method('create')
298+
->willReturn($tierPriceExtensionMock);
299+
300+
$this->assertInstanceOf(TierPrice::class, $this->model->getTierPrices($this->product)[0]);
301+
}
266302
}

app/code/Magento/CatalogGraphQl/Plugin/Search/Request/ConfigReader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ private function getSearchableAttributes(): array
106106
$productAttributes->addFieldToFilter(
107107
['is_searchable', 'is_visible_in_advanced_search', 'is_filterable', 'is_filterable_in_search'],
108108
[1, 1, [1, 2], 1]
109+
)->setOrder(
110+
'position',
111+
'ASC'
109112
);
110113

111114
/** @var Attribute $attribute */

app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div if="isAddressDetailsVisible() && currentBillingAddress()" class="billing-address-details">
88
<text args="currentBillingAddress().prefix"/> <text args="currentBillingAddress().firstname"/> <text args="currentBillingAddress().middlename"/>
99
<text args="currentBillingAddress().lastname"/> <text args="currentBillingAddress().suffix"/><br/>
10-
<text args="_.values(currentBillingAddress().street).join(', ')"/><br/>
10+
<text args="currentBillingAddress().street.join(', ')"/><br/>
1111
<text args="currentBillingAddress().city "/>, <span text="currentBillingAddress().region"></span> <text args="currentBillingAddress().postcode"/><br/>
1212
<text args="getCountryName(currentBillingAddress().countryId)"/><br/>
1313
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone" text="currentBillingAddress().telephone"></a><br/>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Quote\Model\Quote\Plugin;
9+
10+
use Magento\Quote\Model\Quote;
11+
use Magento\Store\Model\StoreManagerInterface;
12+
13+
/**
14+
* Updates quote store id.
15+
*/
16+
class UpdateQuoteStoreId
17+
{
18+
/**
19+
* @var StoreManagerInterface
20+
*/
21+
private $storeManager;
22+
23+
/**
24+
* @param StoreManagerInterface $storeManager
25+
*/
26+
public function __construct(
27+
StoreManagerInterface $storeManager
28+
) {
29+
$this->storeManager = $storeManager;
30+
}
31+
32+
/**
33+
* Update store id in requested quote by store id from request.
34+
*
35+
* @param Quote $subject
36+
* @param Quote $result
37+
* @return Quote
38+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
39+
*/
40+
public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
41+
{
42+
$storeId = $this->storeManager->getStore()
43+
->getId() ?: $this->storeManager->getDefaultStoreView()
44+
->getId();
45+
$result->setStoreId($storeId);
46+
47+
return $result;
48+
}
49+
}

app/code/Magento/Quote/etc/webapi_rest/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@
1616
<type name="Magento\Quote\Api\GuestCartItemRepositoryInterface">
1717
<plugin name="updateCartIdFromRequest" type="Magento\Quote\Plugin\UpdateCartId" />
1818
</type>
19+
<type name="Magento\Quote\Model\Quote">
20+
<plugin name="updateQuoteStoreId" type="Magento\Quote\Model\Quote\Plugin\UpdateQuoteStoreId" />
21+
</type>
1922
</config>

app/code/Magento/Quote/etc/webapi_soap/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
<plugin name="accessControl" type="Magento\Quote\Model\QuoteRepository\Plugin\AccessChangeQuoteControl" />
1414
<plugin name="authorization" type="Magento\Quote\Model\QuoteRepository\Plugin\Authorization" />
1515
</type>
16+
<type name="Magento\Quote\Model\Quote">
17+
<plugin name="updateQuoteStoreId" type="Magento\Quote\Model\Quote\Plugin\UpdateQuoteStoreId" />
18+
</type>
1619
</config>

app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addSimpleProductToOrder">
4848
<argument name="product" value="$$createSimpleProduct$$"/>
4949
</actionGroup>
50+
<!-- By default checkbox 'Add to address book' must be unchecked -->
51+
<dontSeeCheckboxIsChecked selector="{{AdminOrderFormBillingAddressSection.SaveAddress}}" stepKey="checkBoxAddBillingAddressIsUnchecked"/>
5052
<!-- Just in case uncheck and check 'Same as Billing Address checkbox' -->
5153
<comment userInput="Just in case uncheck and check 'Same as Billing Address checkbox'" stepKey="uncheckAndCheckAgain"/>
5254
<uncheckOption selector="{{AdminOrderFormShippingAddressSection.SameAsBilling}}" stepKey="unCheckSameAsShippingAddressCheckbox"/>

0 commit comments

Comments
 (0)