Skip to content

Commit c731c59

Browse files
committed
ACP2E-3618: [CLOUD] Re-order button functionality
1 parent fcfe4da commit c731c59

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

app/code/Magento/Quote/Model/Cart/AddProductsToCart.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,17 @@ private function addItemToCart(
168168
$stockItemQuantity
169169
);
170170
}
171-
171+
//here $result has errors
172172
if (is_string($result)) {
173173
foreach (array_unique(explode("\n", $result)) as $error) {
174174
$errors[] = $this->error->create(__($error)->render(), $cartItemPosition, $stockItemQuantity);
175175
}
176+
} elseif ($result->getHasError() && $result->getStockStateResult()->getHasError()) {
177+
$errors[] = $this->error->create(
178+
__($result->getStockStateResult()->getMessage())->render(),
179+
$cartItemPosition,
180+
$stockItemQuantity
181+
);
176182
}
177183

178184
return $errors;

app/code/Magento/Quote/Model/Quote.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,8 +1668,6 @@ public function addProduct(
16681668
}
16691669

16701670
$parentItem = null;
1671-
$errors = [];
1672-
$item = null;
16731671
$items = [];
16741672
foreach ($cartCandidates as $candidate) {
16751673
// Child items can be sticked together only within their parent

app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Reorder.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,4 @@ public function execute()
130130

131131
return $resultRedirect;
132132
}
133-
134-
/**
135-
* Collect all item errors
136-
*
137-
* @param $order
138-
* @return array
139-
*/
140-
private function getItemErrors($order): array
141-
{
142-
$errors = [];
143-
$items = $order->getAllItems();
144-
foreach($items as $item) {
145-
if (!$item->getMessage(false)) {
146-
continue;
147-
}
148-
foreach ($item->getMessage(false) as $message) {
149-
if (!in_array($message, $errors)) {
150-
$errors[] = $message;
151-
}
152-
}
153-
}
154-
155-
return $errors;
156-
}
157133
}

0 commit comments

Comments
 (0)