@@ -23,7 +23,7 @@ class LastOrderedItems implements SectionSourceInterface
23
23
const SIDEBAR_ORDER_LIMIT = 5 ;
24
24
25
25
/**
26
- * @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactory
26
+ * @var \Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface
27
27
*/
28
28
protected $ _orderCollectionFactory ;
29
29
@@ -68,7 +68,7 @@ class LastOrderedItems implements SectionSourceInterface
68
68
private $ logger ;
69
69
70
70
/**
71
- * @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory
71
+ * @param \Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface $orderCollectionFactory
72
72
* @param \Magento\Sales\Model\Order\Config $orderConfig
73
73
* @param \Magento\Customer\Model\Session $customerSession
74
74
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
@@ -77,7 +77,7 @@ class LastOrderedItems implements SectionSourceInterface
77
77
* @param LoggerInterface $logger
78
78
*/
79
79
public function __construct (
80
- \Magento \Sales \Model \ResourceModel \Order \CollectionFactory $ orderCollectionFactory ,
80
+ \Magento \Sales \Model \ResourceModel \Order \CollectionFactoryInterface $ orderCollectionFactory ,
81
81
\Magento \Sales \Model \Order \Config $ orderConfig ,
82
82
\Magento \Customer \Model \Session $ customerSession ,
83
83
\Magento \CatalogInventory \Api \StockRegistryInterface $ stockRegistry ,
@@ -103,7 +103,7 @@ protected function initOrders()
103
103
{
104
104
$ customerId = $ this ->_customerSession ->getCustomerId ();
105
105
106
- $ orders = $ this ->_orderCollectionFactory ->create ()
106
+ $ orders = $ this ->_orderCollectionFactory ->create ($ customerId )
107
107
->addAttributeToFilter ('customer_id ' , $ customerId )
108
108
->addAttributeToFilter ('status ' , ['in ' => $ this ->_orderConfig ->getVisibleOnFrontStatuses ()])
109
109
->addAttributeToSort ('created_at ' , 'desc ' )
@@ -138,7 +138,7 @@ protected function getItems()
138
138
$ this ->logger ->critical ($ noEntityException );
139
139
continue ;
140
140
}
141
- if (isset ( $ product ) && in_array ($ website , $ product ->getWebsiteIds ())) {
141
+ if (in_array ($ website , $ product ->getWebsiteIds ())) {
142
142
$ url = $ product ->isVisibleInSiteVisibility () ? $ product ->getProductUrl () : null ;
143
143
$ items [] = [
144
144
'id ' => $ item ->getId (),
@@ -188,7 +188,7 @@ protected function getLastOrder()
188
188
}
189
189
190
190
/**
191
- * { @inheritdoc}
191
+ * @inheritdoc
192
192
*/
193
193
public function getSectionData ()
194
194
{
0 commit comments