first commit
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
class ControllerCommonCart extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/cart');
|
||||
|
||||
// Totals
|
||||
$this->load->model('setting/extension');
|
||||
|
||||
$totals = array();
|
||||
$taxes = $this->cart->getTaxes();
|
||||
$total = 0;
|
||||
|
||||
// Because __call can not keep var references so we put them into an array.
|
||||
$total_data = array(
|
||||
'totals' => &$totals,
|
||||
'taxes' => &$taxes,
|
||||
'total' => &$total
|
||||
);
|
||||
|
||||
// Display prices
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$sort_order = array();
|
||||
|
||||
$results = $this->model_setting_extension->getExtensions('total');
|
||||
|
||||
foreach ($results as $key => $value) {
|
||||
$sort_order[$key] = $this->config->get('total_' . $value['code'] . '_sort_order');
|
||||
}
|
||||
|
||||
array_multisort($sort_order, SORT_ASC, $results);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($this->config->get('total_' . $result['code'] . '_status')) {
|
||||
$this->load->model('extension/total/' . $result['code']);
|
||||
|
||||
// We have to put the totals in an array so that they pass by reference.
|
||||
$this->{'model_extension_total_' . $result['code']}->getTotal($total_data);
|
||||
}
|
||||
}
|
||||
|
||||
$sort_order = array();
|
||||
|
||||
foreach ($totals as $key => $value) {
|
||||
$sort_order[$key] = $value['sort_order'];
|
||||
}
|
||||
|
||||
array_multisort($sort_order, SORT_ASC, $totals);
|
||||
}
|
||||
|
||||
$data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total, $this->session->data['currency']));
|
||||
|
||||
$this->load->model('tool/image');
|
||||
$this->load->model('tool/upload');
|
||||
|
||||
$data['products'] = array();
|
||||
|
||||
foreach ($this->cart->getProducts() as $product) {
|
||||
if ($product['image']) {
|
||||
$image = $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_height'));
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_height'));
|
||||
}
|
||||
|
||||
$option_data = array();
|
||||
|
||||
foreach ($product['option'] as $option) {
|
||||
if ($option['type'] != 'file') {
|
||||
$value = $option['value'];
|
||||
} else {
|
||||
$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);
|
||||
|
||||
if ($upload_info) {
|
||||
$value = $upload_info['name'];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
}
|
||||
|
||||
$option_data[] = array(
|
||||
'name' => $option['name'],
|
||||
'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value),
|
||||
'type' => $option['type']
|
||||
);
|
||||
}
|
||||
|
||||
// Display prices
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$unit_price = $this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'));
|
||||
|
||||
$price = $this->currency->format($unit_price, $this->session->data['currency']);
|
||||
$total = $this->currency->format($unit_price * $product['quantity'], $this->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
$total = false;
|
||||
}
|
||||
|
||||
$data['products'][] = array(
|
||||
'cart_id' => $product['cart_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $product['name'],
|
||||
'model' => $product['model'],
|
||||
'option' => $option_data,
|
||||
'recurring' => ($product['recurring'] ? $product['recurring']['name'] : ''),
|
||||
'quantity' => $product['quantity'],
|
||||
'price' => $price,
|
||||
'total' => $total,
|
||||
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id'])
|
||||
);
|
||||
}
|
||||
|
||||
// Gift Voucher
|
||||
$data['vouchers'] = array();
|
||||
|
||||
if (!empty($this->session->data['vouchers'])) {
|
||||
foreach ($this->session->data['vouchers'] as $key => $voucher) {
|
||||
$data['vouchers'][] = array(
|
||||
'key' => $key,
|
||||
'description' => $voucher['description'],
|
||||
'amount' => $this->currency->format($voucher['amount'], $this->session->data['currency'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['totals'] = array();
|
||||
|
||||
foreach ($totals as $total) {
|
||||
$data['totals'][] = array(
|
||||
'title' => $total['title'],
|
||||
'text' => $this->currency->format($total['value'], $this->session->data['currency']),
|
||||
);
|
||||
}
|
||||
|
||||
$data['cart'] = $this->url->link('checkout/cart');
|
||||
$data['checkout'] = $this->url->link('checkout/checkout', '', true);
|
||||
|
||||
return $this->load->view('common/cart', $data);
|
||||
}
|
||||
|
||||
public function info() {
|
||||
$this->response->setOutput($this->index());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerCommonColumnLeft extends Controller {
|
||||
public function index() {
|
||||
$this->load->model('design/layout');
|
||||
|
||||
if (isset($this->request->get['route'])) {
|
||||
$route = (string)$this->request->get['route'];
|
||||
} else {
|
||||
$route = 'common/home';
|
||||
}
|
||||
|
||||
$layout_id = 0;
|
||||
|
||||
if ($route == 'product/category' && isset($this->request->get['path'])) {
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['path']);
|
||||
|
||||
$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'product/manufacturer/info' && isset($this->request->get['manufacturer_id'])) {
|
||||
$this->load->model('catalog/manufacturer');
|
||||
|
||||
$layout_id = $this->model_catalog_manufacturer->getManufacturerLayoutId($this->request->get['manufacturer_id']);
|
||||
}
|
||||
|
||||
if ($route == 'product/product' && isset($this->request->get['product_id'])) {
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
|
||||
}
|
||||
|
||||
if ($route == 'information/information' && isset($this->request->get['information_id'])) {
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->config->get('config_layout_id');
|
||||
}
|
||||
|
||||
$this->load->model('setting/module');
|
||||
|
||||
$data['modules'] = array();
|
||||
|
||||
$modules = $this->model_design_layout->getLayoutModules($layout_id, 'column_left');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$part = explode('.', $module['code']);
|
||||
|
||||
if (isset($part[0]) && $this->config->get('module_' . $part[0] . '_status')) {
|
||||
$module_data = $this->load->controller('extension/module/' . $part[0]);
|
||||
|
||||
if ($module_data) {
|
||||
$data['modules'][] = $module_data;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($part[1])) {
|
||||
$setting_info = $this->model_setting_module->getModule($part[1]);
|
||||
|
||||
if ($setting_info && $setting_info['status']) {
|
||||
$output = $this->load->controller('extension/module/' . $part[0], $setting_info);
|
||||
|
||||
if ($output) {
|
||||
$data['modules'][] = $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load->view('common/column_left', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerCommonColumnRight extends Controller {
|
||||
public function index() {
|
||||
$this->load->model('design/layout');
|
||||
|
||||
if (isset($this->request->get['route'])) {
|
||||
$route = (string)$this->request->get['route'];
|
||||
} else {
|
||||
$route = 'common/home';
|
||||
}
|
||||
|
||||
$layout_id = 0;
|
||||
|
||||
if ($route == 'product/category' && isset($this->request->get['path'])) {
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['path']);
|
||||
|
||||
$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'product/manufacturer/info' && isset($this->request->get['manufacturer_id'])) {
|
||||
$this->load->model('catalog/manufacturer');
|
||||
|
||||
$layout_id = $this->model_catalog_manufacturer->getManufacturerLayoutId($this->request->get['manufacturer_id']);
|
||||
}
|
||||
|
||||
if ($route == 'product/product' && isset($this->request->get['product_id'])) {
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
|
||||
}
|
||||
|
||||
if ($route == 'information/information' && isset($this->request->get['information_id'])) {
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->config->get('config_layout_id');
|
||||
}
|
||||
|
||||
$this->load->model('setting/module');
|
||||
|
||||
$data['modules'] = array();
|
||||
|
||||
$modules = $this->model_design_layout->getLayoutModules($layout_id, 'column_right');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$part = explode('.', $module['code']);
|
||||
|
||||
if (isset($part[0]) && $this->config->get('module_' . $part[0] . '_status')) {
|
||||
$module_data = $this->load->controller('extension/module/' . $part[0]);
|
||||
|
||||
if ($module_data) {
|
||||
$data['modules'][] = $module_data;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($part[1])) {
|
||||
$setting_info = $this->model_setting_module->getModule($part[1]);
|
||||
|
||||
if ($setting_info && $setting_info['status']) {
|
||||
$output = $this->load->controller('extension/module/' . $part[0], $setting_info);
|
||||
|
||||
if ($output) {
|
||||
$data['modules'][] = $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load->view('common/column_right', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerCommonContentBottom extends Controller {
|
||||
public function index() {
|
||||
$this->load->model('design/layout');
|
||||
|
||||
if (isset($this->request->get['route'])) {
|
||||
$route = (string)$this->request->get['route'];
|
||||
} else {
|
||||
$route = 'common/home';
|
||||
}
|
||||
|
||||
$layout_id = 0;
|
||||
|
||||
if ($route == 'product/category' && isset($this->request->get['path'])) {
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['path']);
|
||||
|
||||
$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'product/manufacturer/info' && isset($this->request->get['manufacturer_id'])) {
|
||||
$this->load->model('catalog/manufacturer');
|
||||
|
||||
$layout_id = $this->model_catalog_manufacturer->getManufacturerLayoutId($this->request->get['manufacturer_id']);
|
||||
}
|
||||
|
||||
if ($route == 'product/product' && isset($this->request->get['product_id'])) {
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
|
||||
}
|
||||
|
||||
if ($route == 'information/information' && isset($this->request->get['information_id'])) {
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->config->get('config_layout_id');
|
||||
}
|
||||
|
||||
$this->load->model('setting/module');
|
||||
|
||||
$data['modules'] = array();
|
||||
|
||||
$modules = $this->model_design_layout->getLayoutModules($layout_id, 'content_bottom');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$part = explode('.', $module['code']);
|
||||
|
||||
if (isset($part[0]) && $this->config->get('module_' . $part[0] . '_status')) {
|
||||
$module_data = $this->load->controller('extension/module/' . $part[0]);
|
||||
|
||||
if ($module_data) {
|
||||
$data['modules'][] = $module_data;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($part[1])) {
|
||||
$setting_info = $this->model_setting_module->getModule($part[1]);
|
||||
|
||||
if ($setting_info && $setting_info['status']) {
|
||||
$output = $this->load->controller('extension/module/' . $part[0], $setting_info);
|
||||
|
||||
if ($output) {
|
||||
$data['modules'][] = $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load->view('common/content_bottom', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerCommonContentTop extends Controller {
|
||||
public function index() {
|
||||
$this->load->model('design/layout');
|
||||
|
||||
if (isset($this->request->get['route'])) {
|
||||
$route = (string)$this->request->get['route'];
|
||||
} else {
|
||||
$route = 'common/home';
|
||||
}
|
||||
|
||||
$layout_id = 0;
|
||||
|
||||
if ($route == 'product/category' && isset($this->request->get['path'])) {
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['path']);
|
||||
|
||||
$layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'product/manufacturer/info' && isset($this->request->get['manufacturer_id'])) {
|
||||
$this->load->model('catalog/manufacturer');
|
||||
|
||||
$layout_id = $this->model_catalog_manufacturer->getManufacturerLayoutId($this->request->get['manufacturer_id']);
|
||||
}
|
||||
|
||||
if ($route == 'product/product' && isset($this->request->get['product_id'])) {
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
|
||||
}
|
||||
|
||||
if ($route == 'information/information' && isset($this->request->get['information_id'])) {
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->config->get('config_layout_id');
|
||||
}
|
||||
|
||||
$this->load->model('setting/module');
|
||||
|
||||
$data['modules'] = array();
|
||||
|
||||
$modules = $this->model_design_layout->getLayoutModules($layout_id, 'content_top');
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$part = explode('.', $module['code']);
|
||||
|
||||
if (isset($part[0]) && $this->config->get('module_' . $part[0] . '_status')) {
|
||||
$module_data = $this->load->controller('extension/module/' . $part[0]);
|
||||
|
||||
if ($module_data) {
|
||||
$data['modules'][] = $module_data;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($part[1])) {
|
||||
$setting_info = $this->model_setting_module->getModule($part[1]);
|
||||
|
||||
if ($setting_info && $setting_info['status']) {
|
||||
$output = $this->load->controller('extension/module/' . $part[0], $setting_info);
|
||||
|
||||
if ($output) {
|
||||
$data['modules'][] = $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load->view('common/content_top', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
class ControllerCommonCurrency extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/currency');
|
||||
|
||||
$data['action'] = $this->url->link('common/currency/currency', '', $this->request->server['HTTPS']);
|
||||
|
||||
$data['code'] = $this->session->data['currency'];
|
||||
|
||||
$this->load->model('localisation/currency');
|
||||
|
||||
$data['currencies'] = array();
|
||||
|
||||
$results = $this->model_localisation_currency->getCurrencies();
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($result['status']) {
|
||||
$data['currencies'][] = array(
|
||||
'title' => $result['title'],
|
||||
'code' => $result['code'],
|
||||
'symbol_left' => $result['symbol_left'],
|
||||
'symbol_right' => $result['symbol_right']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($this->request->get['route'])) {
|
||||
$data['redirect'] = $this->url->link('common/home');
|
||||
} else {
|
||||
$url_data = $this->request->get;
|
||||
|
||||
unset($url_data['_route_']);
|
||||
|
||||
$route = $url_data['route'];
|
||||
|
||||
unset($url_data['route']);
|
||||
|
||||
$url = '';
|
||||
|
||||
if ($url_data) {
|
||||
$url = '&' . urldecode(http_build_query($url_data, '', '&'));
|
||||
}
|
||||
|
||||
$data['redirect'] = $this->url->link($route, $url, $this->request->server['HTTPS']);
|
||||
}
|
||||
|
||||
return $this->load->view('common/currency', $data);
|
||||
}
|
||||
|
||||
public function currency() {
|
||||
if (isset($this->request->post['code'])) {
|
||||
$this->session->data['currency'] = $this->request->post['code'];
|
||||
|
||||
unset($this->session->data['shipping_method']);
|
||||
unset($this->session->data['shipping_methods']);
|
||||
}
|
||||
|
||||
if (isset($this->request->post['redirect'])) {
|
||||
$this->response->redirect($this->request->post['redirect']);
|
||||
} else {
|
||||
$this->response->redirect($this->url->link('common/home'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
class ControllerCommonFooter extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/footer');
|
||||
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$data['informations'] = array();
|
||||
|
||||
foreach ($this->model_catalog_information->getInformations() as $result) {
|
||||
if ($result['bottom']) {
|
||||
$data['informations'][] = array(
|
||||
'title' => $result['title'],
|
||||
'href' => $this->url->link('information/information', 'information_id=' . $result['information_id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['contact'] = $this->url->link('information/contact');
|
||||
$data['return'] = $this->url->link('account/return/add', '', true);
|
||||
$data['sitemap'] = $this->url->link('information/sitemap');
|
||||
$data['tracking'] = $this->url->link('information/tracking');
|
||||
$data['manufacturer'] = $this->url->link('product/manufacturer');
|
||||
$data['voucher'] = $this->url->link('account/voucher', '', true);
|
||||
$data['affiliate'] = $this->url->link('affiliate/login', '', true);
|
||||
$data['special'] = $this->url->link('product/special');
|
||||
$data['account'] = $this->url->link('account/account', '', true);
|
||||
$data['order'] = $this->url->link('account/order', '', true);
|
||||
$data['wishlist'] = $this->url->link('account/wishlist', '', true);
|
||||
$data['newsletter'] = $this->url->link('account/newsletter', '', true);
|
||||
|
||||
$data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time()));
|
||||
|
||||
// Whos Online
|
||||
if ($this->config->get('config_customer_online')) {
|
||||
$this->load->model('tool/online');
|
||||
|
||||
if (isset($this->request->server['REMOTE_ADDR'])) {
|
||||
$ip = $this->request->server['REMOTE_ADDR'];
|
||||
} else {
|
||||
$ip = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->server['HTTP_HOST']) && isset($this->request->server['REQUEST_URI'])) {
|
||||
$url = ($this->request->server['HTTPS'] ? 'https://' : 'http://') . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];
|
||||
} else {
|
||||
$url = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->server['HTTP_REFERER'])) {
|
||||
$referer = $this->request->server['HTTP_REFERER'];
|
||||
} else {
|
||||
$referer = '';
|
||||
}
|
||||
|
||||
$this->model_tool_online->addOnline($ip, $this->customer->getId(), $url, $referer);
|
||||
}
|
||||
|
||||
foreach(['name','email','telephone','address','open', 'comment'] as $item){
|
||||
$data['config_' . $item] = $this->config->get('config_' . $item);
|
||||
}
|
||||
|
||||
$data['scripts'] = $this->document->getScripts('footer');
|
||||
$data['styles'] = $this->document->getStyles('footer');
|
||||
|
||||
return $this->load->view('common/footer', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerCommonHeader extends Controller {
|
||||
public function index() {
|
||||
// Analytics
|
||||
$this->load->model('setting/extension');
|
||||
|
||||
$data['analytics'] = array();
|
||||
|
||||
$analytics = $this->model_setting_extension->getExtensions('analytics');
|
||||
|
||||
foreach ($analytics as $analytic) {
|
||||
if ($this->config->get('analytics_' . $analytic['code'] . '_status')) {
|
||||
$data['analytics'][] = $this->load->controller('extension/analytics/' . $analytic['code'], $this->config->get('analytics_' . $analytic['code'] . '_status'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->request->server['HTTPS']) {
|
||||
$server = $this->config->get('config_ssl');
|
||||
} else {
|
||||
$server = $this->config->get('config_url');
|
||||
}
|
||||
|
||||
if (is_file(DIR_IMAGE . $this->config->get('config_icon'))) {
|
||||
$this->document->addLink($server . 'image/' . $this->config->get('config_icon'), 'icon');
|
||||
}
|
||||
|
||||
$data['title'] = $this->document->getTitle();
|
||||
|
||||
$data['base'] = $server;
|
||||
$data['description'] = $this->document->getDescription();
|
||||
$data['keywords'] = $this->document->getKeywords();
|
||||
$data['links'] = $this->document->getLinks();
|
||||
$data['robots'] = $this->document->getRobots();
|
||||
$data['styles'] = $this->document->getStyles();
|
||||
foreach(['name','email','telephone','address','open', 'comment'] as $item){
|
||||
$data['config_' . $item] = $this->config->get('config_' . $item);
|
||||
}
|
||||
|
||||
$data['scripts'] = $this->document->getScripts('header');
|
||||
$data['lang'] = $this->language->get('code');
|
||||
$data['direction'] = $this->language->get('direction');
|
||||
|
||||
$data['name'] = $this->config->get('config_name');
|
||||
|
||||
if (is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
|
||||
$data['logo'] = $server . 'image/' . $this->config->get('config_logo');
|
||||
} else {
|
||||
$data['logo'] = '';
|
||||
}
|
||||
|
||||
$this->load->language('common/header');
|
||||
|
||||
|
||||
$host = isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1')) ? HTTPS_SERVER : HTTP_SERVER;
|
||||
if ($this->request->server['REQUEST_URI'] == '/') {
|
||||
$data['og_url'] = $this->url->link('common/home');
|
||||
} else {
|
||||
$data['og_url'] = $host . substr($this->request->server['REQUEST_URI'], 1, (strlen($this->request->server['REQUEST_URI'])-1));
|
||||
}
|
||||
|
||||
$data['og_image'] = $this->document->getOgImage();
|
||||
|
||||
|
||||
|
||||
// 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['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), $this->url->link('account/logout', '', true));
|
||||
|
||||
$data['home'] = $this->url->link('common/home');
|
||||
$data['wishlist'] = $this->url->link('account/wishlist', '', true);
|
||||
$data['logged'] = $this->customer->isLogged();
|
||||
$data['account'] = $this->url->link('account/account', '', true);
|
||||
$data['register'] = $this->url->link('account/register', '', true);
|
||||
$data['login'] = $this->url->link('account/login', '', true);
|
||||
$data['order'] = $this->url->link('account/order', '', true);
|
||||
$data['transaction'] = $this->url->link('account/transaction', '', true);
|
||||
$data['download'] = $this->url->link('account/download', '', true);
|
||||
$data['logout'] = $this->url->link('account/logout', '', true);
|
||||
$data['shopping_cart'] = $this->url->link('checkout/cart');
|
||||
$data['checkout'] = $this->url->link('checkout/checkout', '', true);
|
||||
$data['contact'] = $this->url->link('information/contact');
|
||||
$data['telephone'] = $this->config->get('config_telephone');
|
||||
|
||||
$data['language'] = $this->load->controller('common/language');
|
||||
$data['currency'] = $this->load->controller('common/currency');
|
||||
$data['currency'] = $this->load->controller('common/currency');
|
||||
if ($this->config->get('configblog_blog_menu')) {
|
||||
$data['blog_menu'] = $this->load->controller('blog/menu');
|
||||
} else {
|
||||
$data['blog_menu'] = '';
|
||||
}
|
||||
$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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
class ControllerCommonHome extends Controller {
|
||||
public function index() {
|
||||
$this->document->setTitle($this->config->get('config_meta_title'));
|
||||
$this->document->setDescription($this->config->get('config_meta_description'));
|
||||
$this->document->setKeywords($this->config->get('config_meta_keyword'));
|
||||
|
||||
if (isset($this->request->get['route'])) {
|
||||
$canonical = $this->url->link('common/home');
|
||||
if ($this->config->get('config_seo_pro') && !$this->config->get('config_seopro_addslash')) {
|
||||
$canonical = rtrim($canonical, '/');
|
||||
}
|
||||
$this->document->addLink($canonical, 'canonical');
|
||||
}
|
||||
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['column_right'] = $this->load->controller('common/column_right');
|
||||
$data['content_top'] = $this->load->controller('common/content_top');
|
||||
$data['content_bottom'] = $this->load->controller('common/content_bottom');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
|
||||
$this->response->setOutput($this->load->view('common/home', $data));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerCommonLanguage extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/language');
|
||||
|
||||
$data['action'] = $this->url->link('common/language/language', '', $this->request->server['HTTPS']);
|
||||
|
||||
$data['code'] = $this->session->data['language'];
|
||||
|
||||
$this->load->model('localisation/language');
|
||||
|
||||
$data['languages'] = array();
|
||||
|
||||
$results = $this->model_localisation_language->getLanguages();
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($result['status']) {
|
||||
$data['languages'][] = array(
|
||||
'name' => $result['name'],
|
||||
'code' => $result['code']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($this->request->get['route'])) {
|
||||
|
||||
if($this->config->get('config_seo_pro')){
|
||||
$redirect_data = ['route' => 'common/home', 'url' => '', 'protocol' => $this->request->server['HTTPS']];
|
||||
$data['redirect'] = base64_encode(json_encode($redirect_data));
|
||||
} else {
|
||||
$data['redirect'] = $this->url->link('common/home');
|
||||
};
|
||||
|
||||
} else {
|
||||
$url_data = $this->request->get;
|
||||
|
||||
unset($url_data['_route_']);
|
||||
|
||||
$route = $url_data['route'];
|
||||
|
||||
unset($url_data['route']);
|
||||
|
||||
$url = '';
|
||||
|
||||
if ($url_data) {
|
||||
$url = '&' . urldecode(http_build_query($url_data, '', '&'));
|
||||
}
|
||||
|
||||
if($this->config->get('config_seo_pro')){
|
||||
$redirect_data = ['route' => $route, 'url' => $url, 'protocol' => $this->request->server['HTTPS']];
|
||||
$data['redirect'] = base64_encode(json_encode($redirect_data));
|
||||
} else {
|
||||
$data['redirect'] = $this->url->link($route, $url, $this->request->server['HTTPS']);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return $this->load->view('common/language', $data);
|
||||
}
|
||||
|
||||
public function language() {
|
||||
if($this->config->get('config_seo_pro'))
|
||||
$this->seo_language();
|
||||
|
||||
if (isset($this->request->post['code'])) {
|
||||
$this->session->data['language'] = $this->request->post['code'];
|
||||
}
|
||||
|
||||
if (isset($this->request->post['redirect'])) {
|
||||
$this->response->redirect($this->request->post['redirect']);
|
||||
} else {
|
||||
$this->response->redirect($this->url->link('common/home'));
|
||||
}
|
||||
}
|
||||
|
||||
private function seo_language() {
|
||||
if (isset($this->request->post['code'])) {
|
||||
$this->session->data['language'] = $this->request->post['code'];
|
||||
$languages = $this->model_localisation_language->getLanguages();
|
||||
if (isset($languages[$this->request->post['code']])) {
|
||||
$this->config->set('config_language_id', $languages[$this->request->post['code']]['language_id']);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->request->post['redirect'])) {
|
||||
$redirect = $this->request->post['redirect'];
|
||||
$redirect_data = json_decode(base64_decode($redirect), true);
|
||||
extract($redirect_data);
|
||||
if(isset($route)&& isset($url) && isset($protocol)) {
|
||||
$redirect_url = $this->url->link($route, $url, $protocol);
|
||||
} else {
|
||||
$redirect_url = $this->url->link('common/home');
|
||||
}
|
||||
$this->response->redirect($redirect_url);
|
||||
} else {
|
||||
$this->response->redirect($this->url->link('common/home'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
class ControllerCommonMaintenance extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/maintenance');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
if ($this->request->server['SERVER_PROTOCOL'] == 'HTTP/1.1') {
|
||||
$this->response->addHeader('HTTP/1.1 503 Service Unavailable');
|
||||
} else {
|
||||
$this->response->addHeader('HTTP/1.0 503 Service Unavailable');
|
||||
}
|
||||
|
||||
$this->response->addHeader('Retry-After: 3600');
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_maintenance'),
|
||||
'href' => $this->url->link('common/maintenance')
|
||||
);
|
||||
|
||||
$data['message'] = $this->language->get('text_message');
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
|
||||
$this->response->setOutput($this->load->view('common/maintenance', $data));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class ControllerCommonMenu extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/menu');
|
||||
|
||||
// Menu
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$data['categories'] = array();
|
||||
|
||||
$categories = $this->model_catalog_category->getCategories(0);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
if ($category['top']) {
|
||||
// Level 2
|
||||
$children_data = array();
|
||||
|
||||
$children = $this->model_catalog_category->getCategories($category['category_id']);
|
||||
|
||||
foreach ($children as $child) {
|
||||
$filter_data = array(
|
||||
'filter_category_id' => $child['category_id'],
|
||||
'filter_sub_category' => true
|
||||
);
|
||||
|
||||
$children_data[] = array(
|
||||
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
|
||||
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
// Level 1
|
||||
$data['categories'][] = array(
|
||||
'name' => $category['name'],
|
||||
'children' => $children_data,
|
||||
'column' => $category['column'] ? $category['column'] : 1,
|
||||
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load->view('common/menu', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
class ControllerCommonSearch extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('common/search');
|
||||
|
||||
$data['text_search'] = $this->language->get('text_search');
|
||||
|
||||
if (isset($this->request->get['search'])) {
|
||||
$data['search'] = $this->request->get['search'];
|
||||
} else {
|
||||
$data['search'] = '';
|
||||
}
|
||||
|
||||
return $this->load->view('common/search', $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user