Ekdant-Online-Store/catalog/controller/common/header.php

96 lines
4.6 KiB
PHP
Raw Permalink Normal View History

2024-08-06 12:21:00 +00:00
<?php
namespace Opencart\Catalog\Controller\Common;
/**
* Class Header
*
* @package Opencart\Catalog\Controller\Common
*/
class Header extends \Opencart\System\Engine\Controller {
/**
* @return string
*/
public function index(): string {
// Analytics
$data['analytics'] = [];
if (!$this->config->get('config_cookie_id') || (isset($this->request->cookie['policy']) && $this->request->cookie['policy'])) {
$this->load->model('setting/extension');
$analytics = $this->model_setting_extension->getExtensionsByType('analytics');
foreach ($analytics as $analytic) {
if ($this->config->get('analytics_' . $analytic['code'] . '_status')) {
$data['analytics'][] = $this->load->controller('extension/' . $analytic['extension'] . '/analytics/' . $analytic['code'], $this->config->get('analytics_' . $analytic['code'] . '_status'));
}
}
}
$data['lang'] = $this->language->get('code');
$data['direction'] = $this->language->get('direction');
$data['title'] = $this->document->getTitle();
$data['base'] = $this->config->get('config_url');
$data['description'] = $this->document->getDescription();
$data['keywords'] = $this->document->getKeywords();
// Hard coding css so they can be replaced via the event's system.
$data['bootstrap'] = 'catalog/view/stylesheet/bootstrap.css';
$data['icons'] = 'catalog/view/stylesheet/fonts/fontawesome/css/all.min.css';
$data['stylesheet'] = 'catalog/view/stylesheet/stylesheet.css';
// Hard coding scripts so they can be replaced via the event's system.
$data['jquery'] = 'catalog/view/javascript/jquery/jquery-3.7.1.min.js';
$data['links'] = $this->document->getLinks();
$data['styles'] = $this->document->getStyles();
$data['scripts'] = $this->document->getScripts('header');
$data['name'] = $this->config->get('config_name');
if (is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
$data['logo'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo');
} else {
$data['logo'] = '';
}
$this->load->language('common/header');
// Wishlist
if ($this->customer->isLogged()) {
$this->load->model('account/wishlist');
$data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), $this->model_account_wishlist->getTotalWishlist());
} else {
$data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
}
$data['home'] = $this->url->link('common/home', 'language=' . $this->config->get('config_language'));
$data['wishlist'] = $this->url->link('account/wishlist', 'language=' . $this->config->get('config_language') . (isset($this->session->data['customer_token']) ? '&customer_token=' . $this->session->data['customer_token'] : ''));
$data['logged'] = $this->customer->isLogged();
if (!$this->customer->isLogged()) {
$data['register'] = $this->url->link('account/register', 'language=' . $this->config->get('config_language'));
$data['login'] = $this->url->link('account/login', 'language=' . $this->config->get('config_language'));
} else {
$data['account'] = $this->url->link('account/account', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
$data['order'] = $this->url->link('account/order', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
$data['transaction'] = $this->url->link('account/transaction', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
$data['download'] = $this->url->link('account/download', 'language=' . $this->config->get('config_language') . '&customer_token=' . $this->session->data['customer_token']);
$data['logout'] = $this->url->link('account/logout', 'language=' . $this->config->get('config_language'));
}
$data['shopping_cart'] = $this->url->link('checkout/cart', 'language=' . $this->config->get('config_language'));
$data['checkout'] = $this->url->link('checkout/checkout', 'language=' . $this->config->get('config_language'));
$data['contact'] = $this->url->link('information/contact', 'language=' . $this->config->get('config_language'));
$data['telephone'] = $this->config->get('config_telephone');
$data['language'] = $this->load->controller('common/language');
$data['currency'] = $this->load->controller('common/currency');
$data['search'] = $this->load->controller('common/search');
$data['cart'] = $this->load->controller('common/cart');
$data['menu'] = $this->load->controller('common/menu');
return $this->load->view('common/header', $data);
}
}