Skip to content

Commit ad665fd

Browse files
authored
Merge branch '2.4-develop' into no-author/downloadable
2 parents 3a10c4b + c8ba4ab commit ad665fd

File tree

87 files changed

+1001
-901
lines changed

Some content is hidden

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

87 files changed

+1001
-901
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe.
4+
* All Rights Reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
namespace Magento\Captcha\Block;
9+
10+
use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
11+
use Magento\Captcha\Helper\Data as HelperCaptcha;
12+
13+
class CheckoutLayoutProcessor implements LayoutProcessorInterface
14+
{
15+
/**
16+
* @param HelperCaptcha $helper
17+
*/
18+
public function __construct(
19+
private readonly HelperCaptcha $helper
20+
) {
21+
}
22+
23+
/**
24+
* Remove captcha from checkout page if it is disabled
25+
*
26+
* @param array $jsLayout
27+
* @return array
28+
*/
29+
public function process($jsLayout): array
30+
{
31+
if ($this->helper->getConfig('enable')) {
32+
$captcha = [
33+
'component' => 'Magento_Captcha/js/view/checkout/loginCaptcha',
34+
'displayArea' => 'additional-login-form-fields',
35+
'formId' => 'user_login',
36+
'configSource' => 'checkoutConfig'
37+
];
38+
$jsLayout['components']['checkout']['children']['authentication']['children']['captcha'] = $captcha;
39+
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
40+
['shippingAddress']['children']['customer-email']['children']['additional-login-form-fields']
41+
['children']['captcha'] = $captcha;
42+
}
43+
return $jsLayout;
44+
}
45+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe.
4+
* All Rights Reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
namespace Magento\Captcha\Block\Customer\AuthenticationPopup;
9+
10+
use Magento\Captcha\Helper\Data as HelperCaptcha;
11+
use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
12+
13+
class LayoutProcessor implements LayoutProcessorInterface
14+
{
15+
/**
16+
* @param HelperCaptcha $helper
17+
*/
18+
public function __construct(
19+
private readonly HelperCaptcha $helper
20+
) {
21+
}
22+
23+
/**
24+
* Process jsLayout of checkout page
25+
*
26+
* @param array $jsLayout
27+
* @return array
28+
*/
29+
public function process($jsLayout): array
30+
{
31+
if ($this->helper->getConfig('enable')) {
32+
$jsLayout['components']['authenticationPopup']['children']['captcha'] = [
33+
'component' => 'Magento_Captcha/js/view/checkout/loginCaptcha',
34+
'displayArea' => 'additional-login-form-fields',
35+
'formId' => 'user_login',
36+
'configSource' => 'checkout'
37+
];
38+
}
39+
return $jsLayout;
40+
}
41+
}

app/code/Magento/Captcha/etc/frontend/di.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2015 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
@@ -37,4 +37,18 @@
3737
<type name="Magento\Sales\Api\OrderManagementInterface">
3838
<plugin name="reset_payment_attempts_after_order_is_placed_plugin" type="Magento\Captcha\Plugin\ResetPaymentAttemptsAfterOrderIsPlacedPlugin"/>
3939
</type>
40+
<type name="Magento\Checkout\Block\Onepage">
41+
<arguments>
42+
<argument name="layoutProcessors" xsi:type="array">
43+
<item name="captcha_processor" xsi:type="object">Magento\Captcha\Block\CheckoutLayoutProcessor</item>
44+
</argument>
45+
</arguments>
46+
</type>
47+
<type name="Magento\Customer\Block\Account\AuthenticationPopup">
48+
<arguments>
49+
<argument name="layoutProcessors" xsi:type="array">
50+
<item name="authentication_popup_processor" xsi:type="object">Magento\Captcha\Block\Customer\AuthenticationPopup\LayoutProcessor</item>
51+
</argument>
52+
</arguments>
53+
</type>
4054
</config>

app/code/Magento/Captcha/view/frontend/layout/checkout_index_index.xml

Lines changed: 0 additions & 59 deletions
This file was deleted.

app/code/Magento/Captcha/view/frontend/layout/default.xml

Lines changed: 0 additions & 29 deletions
This file was deleted.

app/code/Magento/CatalogUrlRewrite/Model/Storage/DynamicStorage.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
2+
23
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
4+
* Copyright 2019 Adobe
5+
* All Rights Reserved.
56
*/
7+
68
declare(strict_types=1);
79

810
namespace Magento\CatalogUrlRewrite\Model\Storage;
@@ -170,7 +172,7 @@ private function findProductRewriteByRequestPath(array $data): ?array
170172
}
171173
$categorySuffix = $this->getCategoryUrlSuffix($data[UrlRewrite::STORE_ID]);
172174
$productResource = $this->productFactory->create();
173-
$categoryPath = str_replace('/' . $productUrl, '', $requestPath);
175+
$categoryPath = substr($requestPath, 0, -1 * strlen('/' . $productUrl));
174176
if ($productFromDb[UrlRewrite::REDIRECT_TYPE]) {
175177
$productUrl = $productFromDb[UrlRewrite::TARGET_PATH];
176178
}

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Storage/DynamicStorageTest.php

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2021 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -80,6 +80,11 @@ class DynamicStorageTest extends TestCase
8080
*/
8181
private $logger;
8282

83+
/**
84+
* @var string
85+
*/
86+
private $requestPath;
87+
8388
/**
8489
* @inheritdoc
8590
*/
@@ -169,9 +174,7 @@ public function testFindProductRewriteByRequestPath(
169174
bool $canBeShownInCategory,
170175
?array $expectedProductRewrite
171176
): void {
172-
$this->connectionMock->expects($this->any())
173-
->method('fetchRow')
174-
->will($this->onConsecutiveCalls($productFromDb, $categoryFromDb));
177+
$this->fetchDataMock($productFromDb, $categoryFromDb);
175178

176179
$scopeConfigMap = [
177180
[
@@ -347,6 +350,68 @@ public static function findProductRewriteByRequestPathDataProvider(): array
347350
'redirect_type' => OptionProvider::PERMANENT,
348351
]
349352
],
353+
[
354+
// Category has product url key at the beginning of its url key
355+
[
356+
'request_path' => 'test-category/test-sub-category/test',
357+
'store_id' => 1
358+
],
359+
[
360+
'entity_type' => 'product',
361+
'entity_id' => '1',
362+
'request_path' => 'test',
363+
'target_path' => 'catalog/product/view/id/1',
364+
'redirect_type' => '0',
365+
],
366+
'',
367+
[
368+
'entity_type' => 'category',
369+
'entity_id' => '38',
370+
'request_path' => 'test-category/test-sub-category',
371+
'target_path' => 'catalog/category/view/id/38',
372+
'redirect_type' => '0',
373+
],
374+
true,
375+
[
376+
'entity_type' => 'product',
377+
'entity_id' => '1',
378+
'request_path' => 'test-category/test-sub-category/test',
379+
'target_path' => 'catalog/product/view/id/1/category/38',
380+
'redirect_type' => '0',
381+
]
382+
],
350383
];
351384
}
385+
386+
/**
387+
* @param array|false $productFromDb
388+
* @param array|false $categoryFromDb
389+
*
390+
* @return void
391+
*/
392+
private function fetchDataMock($productFromDb, $categoryFromDb): void
393+
{
394+
$selectMock = $this->selectMock;
395+
$this->selectMock->expects($this->any())
396+
->method('where')
397+
->willReturnCallback(function ($string, $value) use ($selectMock) {
398+
if ($string == 'url_rewrite.request_path IN (?)') {
399+
$this->requestPath = array_shift($value);
400+
}
401+
return $selectMock;
402+
});
403+
$this->connectionMock->expects($this->any())
404+
->method('fetchRow')
405+
->willReturnCallback(function () use ($productFromDb, $categoryFromDb) {
406+
switch (true) {
407+
case $productFromDb && $productFromDb['request_path'] == $this->requestPath:
408+
return $productFromDb;
409+
case $categoryFromDb && $categoryFromDb['request_path'] == $this->requestPath:
410+
return $categoryFromDb;
411+
default:
412+
return false;
413+
}
414+
})
415+
;
416+
}
352417
}

app/code/Magento/Cms/Block/Adminhtml/Block/Widget/Chooser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Cms\Block\Adminhtml\Block\Widget;
77

@@ -100,7 +100,7 @@ public function getRowClickCallback()
100100
$js = '
101101
function (grid, event) {
102102
var trElement = Event.findElement(event, "tr");
103-
var blockId = trElement.down("td").next().next().innerHTML.replace(/^\s+|\s+$/g,"");
103+
var blockId = trElement.down("td").innerHTML.replace(/^\s+|\s+$/g,"");
104104
var blockTitle = trElement.down("td").next().innerHTML;
105105
' .
106106
$chooserJsObject .

app/code/Magento/Cms/Test/Mftf/Test/AdminAddBlockWidgetToCMSPageTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2020 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -51,7 +51,7 @@
5151
<!-- Assert block_id value in page content -->
5252
<actionGroup ref="AdminAssertCMSPageContentParamValueActionGroup" stepKey="assertBlockId">
5353
<argument name="param" value="block_id"/>
54-
<argument name="value" value="$$createPreReqBlock.identifier$$"/>
54+
<argument name="value" value="$$createPreReqBlock.id$$"/>
5555
</actionGroup>
5656
</test>
5757
</tests>

0 commit comments

Comments
 (0)