getData(self::SORT_ORDER); } public function isCurrent(): bool { if ( $this->getRequest()->getModuleName() === 'legacy_order' && $this->getRequest()->getControllerName() === 'account' ) { return true; } return parent::isCurrent(); } protected function _toHtml(): string { return $this->hasLegacyOrders() ? parent::_toHtml() : ''; } private function hasLegacyOrders(): bool { if ($this->hasLegacyOrders !== null) { return $this->hasLegacyOrders; } $customerId = (int)$this->customerSession->getCustomerId(); if ($customerId <= 0) { return $this->hasLegacyOrders = false; } $connection = $this->resource->getConnection(); return $this->hasLegacyOrders = (bool)$connection->fetchOne( $connection->select() ->from($this->resource->getTableName('esun_legacy_order'), ['legacy_order_id']) ->where('customer_id = ?', $customerId) ->limit(1) ); } }