Skip to content

Commit 0d3e478

Browse files
authored
Merge branch '2.4-develop' into 25963-grid-export-labels
2 parents 4483911 + 7322e87 commit 0d3e478

File tree

82 files changed

+1520
-306
lines changed

Some content is hidden

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

82 files changed

+1520
-306
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
2525
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
2626
</test>
27-
</tests>
27+
</tests>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ define([
269269
*/
270270
onError: function () {
271271
self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized'));
272+
self.reInitPayPal();
272273
}
273274
}, self.paypalButtonSelector);
274275
},

app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1010
<test name="AdminCardinalCommerceSettingsHiddenTest">
1111
<annotations>
12+
<stories value="Cardinal Commerce Settings"/>
1213
<features value="CardinalCommerce"/>
1314
<title value="CardinalCommerce settings hidden" />
1415
<description value="CardinalCommerce config shouldn't be visible if the 3D secure is disabled for Authorize.Net."/>

app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
namespace Magento\Catalog\Block\Ui;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9+
use Magento\Catalog\Model\ProductRenderFactory;
10+
use Magento\Catalog\Model\ProductRepository;
911
use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorComposite;
12+
use Magento\Framework\App\Config\ScopeConfigInterface;
13+
use Magento\Framework\App\ObjectManager;
14+
use Magento\Framework\EntityManager\Hydrator;
1015
use Magento\Framework\Registry;
1116
use Magento\Framework\Serialize\SerializerInterface;
1217
use Magento\Framework\Url;
1318
use Magento\Framework\View\Element\Template;
1419
use Magento\Store\Model\Store;
15-
use Magento\Catalog\Model\ProductRenderFactory;
16-
use Magento\Catalog\Model\ProductRepository;
17-
use Magento\Framework\EntityManager\Hydrator;
1820
use Magento\Store\Model\StoreManager;
1921

2022
/**
@@ -25,6 +27,7 @@
2527
*
2628
* @api
2729
* @since 101.1.0
30+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2831
*/
2932
class ProductViewCounter extends Template
3033
{
@@ -68,6 +71,13 @@ class ProductViewCounter extends Template
6871
*/
6972
private $registry;
7073

74+
/**
75+
* Core store config
76+
*
77+
* @var ScopeConfigInterface
78+
*/
79+
private $scopeConfig;
80+
7181
/**
7282
* @param Template\Context $context
7383
* @param ProductRepository $productRepository
@@ -78,6 +88,8 @@ class ProductViewCounter extends Template
7888
* @param SerializerInterface $serialize
7989
* @param Url $url
8090
* @param Registry $registry
91+
* @param ScopeConfigInterface|null $scopeConfig
92+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8193
*/
8294
public function __construct(
8395
Template\Context $context,
@@ -88,7 +100,8 @@ public function __construct(
88100
Hydrator $hydrator,
89101
SerializerInterface $serialize,
90102
Url $url,
91-
Registry $registry
103+
Registry $registry,
104+
?ScopeConfigInterface $scopeConfig = null
92105
) {
93106
parent::__construct($context);
94107
$this->productRepository = $productRepository;
@@ -99,6 +112,7 @@ public function __construct(
99112
$this->serialize = $serialize;
100113
$this->url = $url;
101114
$this->registry = $registry;
115+
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
102116
}
103117

104118
/**
@@ -116,14 +130,19 @@ public function getCurrentProductData()
116130
{
117131
/** @var ProductInterface $product */
118132
$product = $this->registry->registry('product');
133+
$productsScope = $this->scopeConfig->getValue(
134+
'catalog/recently_products/scope',
135+
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
136+
);
119137
/** @var Store $store */
120138
$store = $this->storeManager->getStore();
121139

122140
if (!$product || !$product->getId()) {
123141
return $this->serialize->serialize([
124142
'items' => [],
125143
'store' => $store->getId(),
126-
'currency' => $store->getCurrentCurrency()->getCode()
144+
'currency' => $store->getCurrentCurrency()->getCode(),
145+
'productCurrentScope' => $productsScope
127146
]);
128147
}
129148

@@ -140,7 +159,8 @@ public function getCurrentProductData()
140159
$product->getId() => $data
141160
],
142161
'store' => $store->getId(),
143-
'currency' => $store->getCurrentCurrency()->getCode()
162+
'currency' => $store->getCurrentCurrency()->getCode(),
163+
'productCurrentScope' => $productsScope
144164
];
145165

146166
return $this->serialize->serialize($currentProductData);

app/code/Magento/Catalog/CustomerData/CompareProducts.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
namespace Magento\Catalog\CustomerData;
77

88
use Magento\Customer\CustomerData\SectionSourceInterface;
9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Exception\LocalizedException;
912

13+
/**
14+
* Catalog Product Compare Widget
15+
*/
1016
class CompareProducts implements SectionSourceInterface
1117
{
1218
/**
@@ -24,23 +30,33 @@ class CompareProducts implements SectionSourceInterface
2430
*/
2531
private $outputHelper;
2632

33+
/**
34+
* Core store config
35+
*
36+
* @var ScopeConfigInterface
37+
*/
38+
private $scopeConfig;
39+
2740
/**
2841
* @param \Magento\Catalog\Helper\Product\Compare $helper
2942
* @param \Magento\Catalog\Model\Product\Url $productUrl
3043
* @param \Magento\Catalog\Helper\Output $outputHelper
44+
* @param ScopeConfigInterface|null $scopeConfig
3145
*/
3246
public function __construct(
3347
\Magento\Catalog\Helper\Product\Compare $helper,
3448
\Magento\Catalog\Model\Product\Url $productUrl,
35-
\Magento\Catalog\Helper\Output $outputHelper
49+
\Magento\Catalog\Helper\Output $outputHelper,
50+
?ScopeConfigInterface $scopeConfig = null
3651
) {
3752
$this->helper = $helper;
3853
$this->productUrl = $productUrl;
3954
$this->outputHelper = $outputHelper;
55+
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
4056
}
4157

4258
/**
43-
* {@inheritdoc}
59+
* @inheritdoc
4460
*/
4561
public function getSectionData()
4662
{
@@ -54,18 +70,26 @@ public function getSectionData()
5470
}
5571

5672
/**
73+
* Get the list of compared product items
74+
*
5775
* @return array
76+
* @throws LocalizedException
5877
*/
5978
protected function getItems()
6079
{
6180
$items = [];
81+
$productsScope = $this->scopeConfig->getValue(
82+
'catalog/recently_products/scope',
83+
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
84+
);
6285
/** @var \Magento\Catalog\Model\Product $item */
6386
foreach ($this->helper->getItemCollection() as $item) {
6487
$items[] = [
6588
'id' => $item->getId(),
6689
'product_url' => $this->productUrl->getUrl($item),
6790
'name' => $this->outputHelper->productAttribute($item, $item->getName(), 'name'),
6891
'remove_url' => $this->helper->getPostDataRemove($item),
92+
'productScope' => $productsScope
6993
];
7094
}
7195
return $items;

app/code/Magento/Catalog/Model/ResourceModel/Product/Action.php

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Catalog\Model\ResourceModel\Product;
77

8+
use Magento\Catalog\Api\Data\ProductInterface;
89
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
910

1011
/**
@@ -14,6 +15,32 @@
1415
*/
1516
class Action extends \Magento\Catalog\Model\ResourceModel\AbstractResource
1617
{
18+
/**
19+
* @var \Magento\Framework\Stdlib\DateTime\DateTime
20+
*/
21+
private $dateTime;
22+
23+
/**
24+
* @param \Magento\Eav\Model\Entity\Context $context
25+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
26+
* @param \Magento\Catalog\Model\Factory $modelFactory
27+
* @param \Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface $uniqueValidator
28+
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
29+
* @param array $data
30+
*/
31+
public function __construct(
32+
\Magento\Eav\Model\Entity\Context $context,
33+
\Magento\Store\Model\StoreManagerInterface $storeManager,
34+
\Magento\Catalog\Model\Factory $modelFactory,
35+
\Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface $uniqueValidator,
36+
\Magento\Framework\Stdlib\DateTime\DateTime $dateTime,
37+
$data = []
38+
) {
39+
parent::__construct($context, $storeManager, $modelFactory, $data, $uniqueValidator);
40+
41+
$this->dateTime = $dateTime;
42+
}
43+
1744
/**
1845
* Initialize connection
1946
*
@@ -43,6 +70,7 @@ public function updateAttributes($entityIds, $attrData, $storeId)
4370
$object = new \Magento\Framework\DataObject();
4471
$object->setStoreId($storeId);
4572

73+
$attrData[ProductInterface::UPDATED_AT] = $this->dateTime->gmtDate();
4674
$this->getConnection()->beginTransaction();
4775
try {
4876
foreach ($attrData as $attrCode => $value) {
@@ -95,7 +123,7 @@ protected function _saveAttributeValue($object, $attribute, $value)
95123
* for default store id
96124
* In this case we clear all not default values
97125
*/
98-
if ($this->_storeManager->hasSingleStore()) {
126+
if ($this->_storeManager->hasSingleStore() && !$attribute->isStatic()) {
99127
$storeId = $this->getDefaultStoreId();
100128
$connection->delete(
101129
$table,
@@ -107,17 +135,24 @@ protected function _saveAttributeValue($object, $attribute, $value)
107135
);
108136
}
109137

110-
$data = new \Magento\Framework\DataObject(
111-
[
112-
'attribute_id' => $attribute->getAttributeId(),
113-
'store_id' => $storeId,
114-
$this->getLinkField() => $entityId,
115-
'value' => $this->_prepareValueForSave($value, $attribute),
116-
]
117-
);
138+
$data = $attribute->isStatic()
139+
? new \Magento\Framework\DataObject(
140+
[
141+
$this->getLinkField() => $entityId,
142+
$attribute->getAttributeCode() => $this->_prepareValueForSave($value, $attribute),
143+
]
144+
)
145+
: new \Magento\Framework\DataObject(
146+
[
147+
'attribute_id' => $attribute->getAttributeId(),
148+
'store_id' => $storeId,
149+
$this->getLinkField() => $entityId,
150+
'value' => $this->_prepareValueForSave($value, $attribute),
151+
]
152+
);
118153
$bind = $this->_prepareDataForTable($data, $table);
119154

120-
if ($attribute->isScopeStore()) {
155+
if ($attribute->isScopeStore() || $attribute->isStatic()) {
121156
/**
122157
* Update attribute value for store
123158
*/
@@ -143,6 +178,8 @@ protected function _saveAttributeValue($object, $attribute, $value)
143178
}
144179

145180
/**
181+
* Resolve entity id
182+
*
146183
* @param int $entityId
147184
* @return int
148185
*/

app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1111
<test name="ProductAttributeWithoutValueInCompareListTest">
1212
<annotations>
1313
<features value="Catalog"/>
14+
<stories value="Product Comparison"/>
1415
<title value="Product attribute without value in compare list test"/>
15-
<description
16-
value="The product attribute that has no value should output 'N/A' on the product comparison page."/>
16+
<description value="The product attribute that has no value should output 'N/A' on the product comparison page."/>
1717
<severity value="MINOR"/>
1818
<group value="Catalog"/>
1919
</annotations>
@@ -22,7 +22,7 @@
2222
<createData entity="textProductAttribute" stepKey="createProductAttribute"/>
2323
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
2424
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/"
25-
stepKey="onAttributeSetEdit"/>
25+
stepKey="onAttributeSetEdit"/>
2626
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignAttributeToGroup">
2727
<argument name="group" value="Product Details"/>
2828
<argument name="attribute" value="$$createProductAttribute.attribute_code$$"/>
@@ -69,11 +69,11 @@
6969
</actionGroup>
7070
<!--See attribute default value in the comparison list-->
7171
<see userInput="$createProductAttribute.defaultValue$"
72-
selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductCustom.name$)}}"
73-
stepKey="assertAttributeValueForProductCustom"/>
72+
selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductCustom.name$)}}"
73+
stepKey="assertAttributeValueForProductCustom"/>
7474
<!--See N/A if attribute has no value in the comparison list-->
7575
<see userInput="N/A"
76-
selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductDefault.name$)}}"
77-
stepKey="assertNAForProductDefault"/>
76+
selector="{{StorefrontProductCompareMainSection.ProductAttributeByCodeAndProductName(ProductAttributeFrontendLabel.label, $createProductDefault.name$)}}"
77+
stepKey="assertNAForProductDefault"/>
7878
</test>
7979
</tests>

0 commit comments

Comments
 (0)