Skip to content

Commit f50e3c0

Browse files
committed
Merge branch '2.4-develop' of github.com:magento-commerce/magento2ce into ACP2E-4019
2 parents 4eeea8c + a8cf637 commit f50e3c0

File tree

29 files changed

+3372
-320
lines changed

29 files changed

+3372
-320
lines changed

app/code/Magento/Catalog/Model/ProductLink/Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function save(\Magento\Catalog\Api\Data\ProductLinkInterface $entity)
139139
. 'Please ensure the parent product SKU is provided and try again.'
140140
));
141141
}
142-
if (!$entity->getLinkedProductSku()) {
142+
if ($entity->getLinkedProductSku() === null || $entity->getLinkedProductSku() === '') {
143143
throw new CouldNotSaveException(__('The linked product SKU is invalid. Verify the data and try again.'));
144144
}
145145
$linkedProduct = $this->productRepository->get($entity->getLinkedProductSku());

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddToCartFromStorefrontProductPageActionGroup.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
</arguments>
1919
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartDisabled}}" stepKey="waitForAddToCartButtonToRemoveDisabledState"/>
2020
<!-- Scroll to button to prevent overlapping elements from intercepting click -->
21-
<scrollToTopOfPage stepKey="scrollToAddToCartButton"/>
21+
<scrollTo selector="{{StorefrontProductActionSection.addToCart}}" stepKey="scrollToAddToCartButton"/>
22+
<wait time="1" stepKey="waitForScrollToComplete"/>
23+
<!-- Additional scroll with JS to ensure element is in viewport and not intercepted -->
24+
<executeJS function="
25+
var element = document.querySelector('#product-addtocart-button');
26+
if (element) {
27+
element.scrollIntoView({behavior: 'smooth', block: 'center'});
28+
}
29+
" stepKey="scrollToAddToCartButtonWithJS"/>
2230
<waitForElementClickable selector="{{StorefrontProductActionSection.addToCart}}" stepKey="waitForAddToCartButton"/>
2331
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
2432
<waitForPageLoad stepKey="waitForAddToCart"/>

app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,16 @@ public function testDeleteWithNoSuchEntityException()
298298

299299
$this->model->delete($entityMock);
300300
}
301+
302+
public function testSaveWithNullLinkedProductSku()
303+
{
304+
$this->expectException('Magento\Framework\Exception\CouldNotSaveException');
305+
$this->expectExceptionMessage('The linked product SKU is invalid. Verify the data and try again.');
306+
307+
$entityMock = $this->createMock(\Magento\Catalog\Model\ProductLink\Link::class);
308+
$entityMock->expects($this->any())->method('getSku')->willReturn('sku1');
309+
$entityMock->expects($this->any())->method('getLinkedProductSku')->willReturn(null);
310+
311+
$this->model->save($entityMock);
312+
}
301313
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductCustomAttributes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ function (AttributeInterface $customAttribute) {
108108
}
109109
$attributeValue = $productData[$attributeCode] ?? "";
110110
if (is_array($attributeValue)) {
111-
$attributeValue = implode(',', $attributeValue);
111+
$attributeValue = (count($attributeValue) != count($attributeValue, COUNT_RECURSIVE))
112+
? json_encode($attributeValue)
113+
: implode(',', $attributeValue);
112114
}
113115
$customAttributes[] = [
114116
'attribute_code' => $attributeCode,

0 commit comments

Comments
 (0)