Skip to content

Commit caf209b

Browse files
authored
Trying to get data from non existent products
When calling Products in Cart report, it called data of deleted products resulting in exception trying to access $productData[$item->getProductId()]
1 parent 409eef5 commit caf209b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,10 @@ protected function _afterLoad()
219219
$orderData = $this->getOrdersData($productIds);
220220
foreach ($items as $item) {
221221
$item->setId($item->getProductId());
222-
$item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
223-
$item->setName($productData[$item->getProductId()]['name']);
222+
if (isset($productData[$item->getProductId()])) {
223+
$item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
224+
$item->setName($productData[$item->getProductId()]['name']);
225+
}
224226
$item->setOrders(0);
225227
if (isset($orderData[$item->getProductId()])) {
226228
$item->setOrders($orderData[$item->getProductId()]['orders']);

0 commit comments

Comments
 (0)