_customerSession->getCustomerId(); if (!$customerId) { return false; } if ($this->esunOrders === null) { $status = (string)$this->getRequest()->getParam('status'); $search = mb_substr(trim((string)$this->getRequest()->getParam('q')), 0, 100); $this->esunOrders = $this->provider->getHistory($customerId, $status ?: null, $search); } return $this->esunOrders; } public function getCounts(): array { $counts = $this->provider->getStatusCounts((int)$this->_customerSession->getCustomerId()); $counts['awaiting_review'] = $this->awaitingReviews->getCount((int)$this->_customerSession->getCustomerId()); return $counts; } public function getCurrentStatus(): string { return (string)$this->getRequest()->getParam('status'); } public function getSearchQuery(): string { return trim((string)$this->getRequest()->getParam('q')); } public function getItemImageUrl(\Magento\Sales\Model\Order\Item $item): string { $product = $item->getProduct(); return $product ? $this->imageHelper->init($product, 'wishlist_thumbnail')->getUrl() : $this->imageHelper->getDefaultPlaceholderUrl('thumbnail'); } public function canRepay(\Magento\Sales\Model\Order $order): bool { $payment = $order->getPayment(); $method = $payment ? (string)$payment->getMethod() : ''; return (string)$order->getStatus() === 'pending' && (float)$order->getTotalPaid() <= 0.0 && in_array($method, [OceanpaymentConfig::METHOD_CODE, OceanpaymentConfig::LEGACY_METHOD_CODE], true); } public function getRepayUrl(\Magento\Sales\Model\Order $order): string { return $this->getUrl('esun_customer/order/repay', ['order_id' => (int)$order->getId()]); } public function canBuyAgain(\Magento\Sales\Model\Order $order): bool { return $this->reorderHelper->canReorder((int)$order->getId()); } public function getBuyAgainPostData(\Magento\Sales\Model\Order $order): string { return $this->postHelper->getPostData($this->getReorderUrl($order)); } public function canCancel(\Magento\Sales\Model\Order $order): bool { return (string)$order->getStatus() === 'pending' && $order->canCancel(); } public function getCancelUrl(\Magento\Sales\Model\Order $order): string { return $this->getUrl('esun_customer/order/cancel', ['order_id' => (int)$order->getId()]); } protected function _prepareLayout() { parent::_prepareLayout(); $pager = $this->getChildBlock('pager'); if ($pager instanceof \Magento\Theme\Block\Html\Pager) { $pager->setShowPerPage(false); } return $this; } }