Skip to content

Commit de95b3e

Browse files
Merge pull request #1807 from magento-engcom/2.1-develop-prs
[EngCom] Public Pull Requests - 2.1-develop - MAGETWO-84476: Trying to get data from non existent products #12321
2 parents bc7f7be + 0913457 commit de95b3e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
namespace Magento\Reports\Model\ResourceModel\Quote\Item;
88

9-
use Magento\Framework\App\ResourceConnection;
10-
119
/**
1210
* Collection of Magento\Quote\Model\Quote\Item
1311
*
@@ -89,7 +87,6 @@ protected function _construct()
8987
$this->_init('Magento\Quote\Model\Quote\Item', 'Magento\Quote\Model\ResourceModel\Quote\Item');
9088
}
9189

92-
9390
/**
9491
* Prepare select query for products in carts report
9592
*
@@ -219,8 +216,10 @@ protected function _afterLoad()
219216
$orderData = $this->getOrdersData($productIds);
220217
foreach ($items as $item) {
221218
$item->setId($item->getProductId());
222-
$item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
223-
$item->setName($productData[$item->getProductId()]['name']);
219+
if (isset($productData[$item->getProductId()])) {
220+
$item->setPrice($productData[$item->getProductId()]['price'] * $item->getBaseToGlobalRate());
221+
$item->setName($productData[$item->getProductId()]['name']);
222+
}
224223
$item->setOrders(0);
225224
if (isset($orderData[$item->getProductId()])) {
226225
$item->setOrders($orderData[$item->getProductId()]['orders']);

0 commit comments

Comments
 (0)