Skip to content

Commit 2a7960b

Browse files
committed
ACP2E-2704: Getting Unable to send the cookie. Size of 'mage-messages' while trying to Reorder
1 parent 410db1c commit 2a7960b

File tree

6 files changed

+51
-3
lines changed

6 files changed

+51
-3
lines changed

app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ public function testAddProductItemNew($request, $hasError): void
11641164
/**
11651165
* @return array[]
11661166
*/
1167-
private function dataProviderForTestAddProductItem(): array
1167+
public function dataProviderForTestAddProductItem(): array
11681168
{
11691169
return [
11701170
'not_force_item' => [null, false],

app/code/Magento/Sales/Model/Reorder/Reorder.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ class Reorder
104104
*/
105105
private $orderInfoBuyRequestGetter;
106106

107+
/**
108+
* @var bool
109+
*/
110+
private bool $forceAdd;
111+
107112
/**
108113
* @param OrderFactory $orderFactory
109114
* @param CustomerCartResolver $customerCartProvider
@@ -113,6 +118,7 @@ class Reorder
113118
* @param LoggerInterface $logger
114119
* @param ProductCollectionFactory $productCollectionFactory
115120
* @param OrderInfoBuyRequestGetter $orderInfoBuyRequestGetter
121+
* @param bool $forceAdd
116122
*/
117123
public function __construct(
118124
OrderFactory $orderFactory,
@@ -122,7 +128,8 @@ public function __construct(
122128
ReorderHelper $reorderHelper,
123129
LoggerInterface $logger,
124130
ProductCollectionFactory $productCollectionFactory,
125-
OrderInfoBuyRequestGetter $orderInfoBuyRequestGetter
131+
OrderInfoBuyRequestGetter $orderInfoBuyRequestGetter,
132+
bool $forceAdd = false
126133
) {
127134
$this->orderFactory = $orderFactory;
128135
$this->cartRepository = $cartRepository;
@@ -132,6 +139,7 @@ public function __construct(
132139
$this->guestCartResolver = $guestCartResolver;
133140
$this->productCollectionFactory = $productCollectionFactory;
134141
$this->orderInfoBuyRequestGetter = $orderInfoBuyRequestGetter;
142+
$this->forceAdd = $forceAdd;
135143
}
136144

137145
/**
@@ -264,7 +272,7 @@ private function addItemToCart(OrderItemInterface $orderItem, Quote $cart, Produ
264272

265273
$addProductResult = null;
266274
try {
267-
$infoBuyRequest->setForceAddToCart(true);
275+
$infoBuyRequest->setForceAddToCart($this->forceAdd);
268276
$addProductResult = $cart->addProduct($product, $infoBuyRequest);
269277
} catch (\Magento\Framework\Exception\LocalizedException $e) {
270278
$this->addError($this->getCartItemErrorMessage($orderItem, $product, $e->getMessage()));

app/code/Magento/Sales/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,4 +1038,9 @@
10381038
</argument>
10391039
</arguments>
10401040
</type>
1041+
<type name="Magento\Sales\Model\Reorder\Reorder">
1042+
<arguments>
1043+
<argument name="forceAdd" xsi:type="boolean">true</argument>
1044+
</arguments>
1045+
</type>
10411046
</config>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* Copyright 2023 Adobe
6+
* All Rights Reserved.
7+
*
8+
* NOTICE: All information contained herein is, and remains
9+
* the property of Adobe and its suppliers, if any. The intellectual
10+
* and technical concepts contained herein are proprietary to Adobe
11+
* and its suppliers and are protected by all applicable intellectual
12+
* property laws, including trade secret and copyright laws.
13+
* Dissemination of this information or reproduction of this material
14+
* is strictly forbidden unless prior written permission is obtained
15+
* from Adobe.
16+
* ***********************************************************************
17+
*/
18+
-->
19+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
20+
<type name="Magento\Sales\Model\Reorder\Reorder">
21+
<arguments>
22+
<argument name="forceAdd" xsi:type="boolean">false</argument>
23+
</arguments>
24+
</type>
25+
</config>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@
2222
<type name="Magento\Sales\Model\Service\InvoiceService">
2323
<plugin name="addTransactionCommentAfterCapture" type="Magento\Sales\Plugin\Model\Service\Invoice\AddTransactionCommentAfterCapture"/>
2424
</type>
25+
<type name="Magento\Sales\Model\Reorder\Reorder">
26+
<arguments>
27+
<argument name="forceAdd" xsi:type="boolean">false</argument>
28+
</arguments>
29+
</type>
2530
</config>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@
2222
<type name="Magento\Sales\Model\Service\InvoiceService">
2323
<plugin name="addTransactionCommentAfterCapture" type="Magento\Sales\Plugin\Model\Service\Invoice\AddTransactionCommentAfterCapture"/>
2424
</type>
25+
<type name="Magento\Sales\Model\Reorder\Reorder">
26+
<arguments>
27+
<argument name="forceAdd" xsi:type="boolean">false</argument>
28+
</arguments>
29+
</type>
2530
</config>

0 commit comments

Comments
 (0)