orderCollectionFactory = $orderCollectionFactory; } public function getOrders() { if (!($customerId = $this->_customerSession->getCustomerId())) { return false; } if (!$this->orders) { $this->orders = $this->getOrderCollectionFactory()->create($customerId)->addFieldToSelect( '*' )->addFieldToFilter( 'status', ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()] )->setOrder( 'created_at', 'desc' ); } $q = trim((string)$this->_request->getParam('q', '')); if (!empty($q)) { $this->orders->addFieldToFilter('increment_id', ['like' => '%' . $q . '%']); } return $this->orders; } protected function getOrderCollectionFactory() { if ($this->orderCollectionFactory === null) { $this->orderCollectionFactory = ObjectManager::getInstance()->get(CollectionFactoryInterface::class); } return $this->orderCollectionFactory; } }