first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleAccount extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('extension/module/account');
|
||||
|
||||
$data['logged'] = $this->customer->isLogged();
|
||||
$data['register'] = $this->url->link('account/register', '', true);
|
||||
$data['login'] = $this->url->link('account/login', '', true);
|
||||
$data['logout'] = $this->url->link('account/logout', '', true);
|
||||
$data['forgotten'] = $this->url->link('account/forgotten', '', true);
|
||||
$data['account'] = $this->url->link('account/account', '', true);
|
||||
$data['edit'] = $this->url->link('account/edit', '', true);
|
||||
$data['password'] = $this->url->link('account/password', '', true);
|
||||
$data['address'] = $this->url->link('account/address', '', true);
|
||||
$data['wishlist'] = $this->url->link('account/wishlist');
|
||||
$data['order'] = $this->url->link('account/order', '', true);
|
||||
$data['download'] = $this->url->link('account/download', '', true);
|
||||
$data['reward'] = $this->url->link('account/reward', '', true);
|
||||
$data['return'] = $this->url->link('account/return', '', true);
|
||||
$data['transaction'] = $this->url->link('account/transaction', '', true);
|
||||
$data['newsletter'] = $this->url->link('account/newsletter', '', true);
|
||||
$data['recurring'] = $this->url->link('account/recurring', '', true);
|
||||
|
||||
return $this->load->view('extension/module/account', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleBanner extends Controller {
|
||||
public function index($setting) {
|
||||
static $module = 0;
|
||||
|
||||
$this->load->model('design/banner');
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$this->document->addStyle('store/view/javascript/jquery/swiper/css/swiper.min.css');
|
||||
$this->document->addStyle('store/view/javascript/jquery/swiper/css/opencart.css');
|
||||
$this->document->addScript('store/view/javascript/jquery/swiper/js/swiper.jquery.js');
|
||||
|
||||
$data['banners'] = array();
|
||||
|
||||
$results = $this->model_design_banner->getBanner($setting['banner_id']);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if (is_file(DIR_IMAGE . $result['image'])) {
|
||||
$data['banners'][] = array(
|
||||
'title' => $result['title'],
|
||||
'link' => $result['link'],
|
||||
'description' => $result['description'],
|
||||
'button_text' => $result['button_text'],
|
||||
'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']),
|
||||
'image_mobile' => $result['image_mobile'] && is_file(DIR_IMAGE . $result['image_mobile']) ? $this->model_tool_image->resize($result['image_mobile'], $setting['width'], $setting['height']) : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['module'] = $module++;
|
||||
|
||||
return $this->load->view('extension/module/banner', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleBestSeller extends Controller {
|
||||
public function index($setting) {
|
||||
$this->load->language('extension/module/bestseller');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['products'] = array();
|
||||
$data['module_name'] = $setting['name'];
|
||||
|
||||
$results = $this->model_catalog_product->getBestSellerProducts($setting['limit']);
|
||||
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
}
|
||||
|
||||
if (!is_null($result['special']) && (float)$result['special'] >= 0) {
|
||||
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
$tax_price = (float)$result['special'];
|
||||
} else {
|
||||
$special = false;
|
||||
$tax_price = (float)$result['price'];
|
||||
}
|
||||
|
||||
if ($this->config->get('config_tax')) {
|
||||
$tax = $this->currency->format($tax_price, $this->session->data['currency']);
|
||||
} else {
|
||||
$tax = false;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_review_status')) {
|
||||
$rating = $result['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$results = $this->model_catalog_product->getProductImages($product_id);
|
||||
if($results){
|
||||
$additional_image = $this->model_tool_image->resize($results[0]['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$additional_image = false;
|
||||
}
|
||||
$data['products'][] = array(
|
||||
'product_id' => $result['product_id'],
|
||||
'thumb' => $image,
|
||||
'additional_thumb' => $additional_image,
|
||||
'price_n' => $product_info['price'],
|
||||
'price_2' => $this->currency->format($this->tax->calculate($product_info['price_2'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'price_2_n' => $product_info['price_2'],
|
||||
'price_3' => $this->currency->format($this->tax->calculate($product_info['price_3'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'price_3_n' => $product_info['price_3'],
|
||||
'min_price' => $this->currency->format($this->tax->calculate(min([$product_info['price'],$product_info['price_2']]), $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'name' => $result['name'],
|
||||
'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
|
||||
'price' => $price,
|
||||
'special' => $special,
|
||||
'tax' => $tax,
|
||||
'rating' => $rating,
|
||||
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'])
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/bestseller', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerExtensionModuleBlogCategory extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('extension/module/blog_category');
|
||||
|
||||
$data['heading_title'] = $this->language->get('heading_title');
|
||||
|
||||
if (isset($this->request->get['blog_category_id'])) {
|
||||
$parts = explode('_', (string)$this->request->get['blog_category_id']);
|
||||
} else {
|
||||
$parts = array();
|
||||
}
|
||||
|
||||
if (isset($parts[0])) {
|
||||
$data['blog_category_id'] = $parts[0];
|
||||
} else {
|
||||
$data['blog_category_id'] = 0;
|
||||
}
|
||||
|
||||
if (isset($parts[1])) {
|
||||
$data['child_id'] = $parts[1];
|
||||
} else {
|
||||
$data['child_id'] = 0;
|
||||
}
|
||||
|
||||
$this->load->model('blog/category');
|
||||
|
||||
$this->load->model('blog/article');
|
||||
|
||||
$data['categories'] = array();
|
||||
|
||||
$categories = $this->model_blog_category->getCategories(0);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$children_data = array();
|
||||
|
||||
if ($category['blog_category_id'] == $data['blog_category_id']) {
|
||||
$children = $this->model_blog_category->getCategories($category['blog_category_id']);
|
||||
|
||||
foreach($children as $child) {
|
||||
$filter_data = array('filter_blog_category_id' => $child['blog_category_id'], 'filter_sub_category' => true);
|
||||
|
||||
$children_data[] = array(
|
||||
'blog_category_id' => $child['blog_category_id'],
|
||||
'name' => $child['name'] . ($this->config->get('configblog_article_count') ? ' (' . $this->model_blog_article->getTotalArticles($filter_data) . ')' : ''),
|
||||
'href' => $this->url->link('blog/category', 'blog_category_id=' . $category['blog_category_id'] . '_' . $child['blog_category_id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$filter_data = array(
|
||||
'filter_blog_category_id' => $category['blog_category_id'],
|
||||
);
|
||||
|
||||
$data['categories'][] = array(
|
||||
'blog_category_id' => $category['blog_category_id'],
|
||||
'name' => $category['name'] . ($this->config->get('configblog_article_count') ? ' (' . $this->model_blog_article->getTotalArticles($filter_data) . ')' : ''),
|
||||
'children' => $children_data,
|
||||
'href' => $this->url->link('blog/category', 'blog_category_id=' . $category['blog_category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/blog_category', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerExtensionModuleBlogFeatured extends Controller {
|
||||
public function index($setting) {
|
||||
$this->load->language('extension/module/blog_featured');
|
||||
|
||||
$this->load->model('blog/article');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['articles'] = array();
|
||||
|
||||
if (!$setting['limit']) {
|
||||
$setting['limit'] = 4;
|
||||
}
|
||||
|
||||
if (!empty($setting['article'])) {
|
||||
$articles = array_slice($setting['article'], 0, (int)$setting['limit']);
|
||||
|
||||
foreach ($articles as $article_id) {
|
||||
$article_info = $this->model_blog_article->getArticle($article_id);
|
||||
|
||||
if ($article_info) {
|
||||
if ($article_info['image']) {
|
||||
$image = $this->model_tool_image->resize($article_info['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->config->get('configblog_review_status')) {
|
||||
$rating = $article_info['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$data['articles'][] = array(
|
||||
'article_id' => $article_info['article_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $article_info['name'],
|
||||
'description' => utf8_substr(strip_tags(html_entity_decode($article_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('configblog_article_description_length')) . '..',
|
||||
'rating' => $rating,
|
||||
'date_added' => date($this->language->get('date_format_short'), strtotime($article_info['date_added'])),
|
||||
'viewed' => $article_info['viewed'],
|
||||
'href' => $this->url->link('blog/article', 'article_id=' . $article_info['article_id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['articles']) {
|
||||
return $this->load->view('extension/module/blog_featured', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerExtensionModuleBlogLatest extends Controller {
|
||||
public function index($setting) {
|
||||
$this->load->language('extension/module/blog_latest');
|
||||
|
||||
$this->load->model('blog/article');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['articles'] = array();
|
||||
|
||||
$filter_data = array(
|
||||
'sort' => 'p.date_added',
|
||||
'order' => 'DESC',
|
||||
'start' => 0,
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_blog_article->getArticles($filter_data);
|
||||
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->config->get('configblog_review_status')) {
|
||||
$rating = $result['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$data['articles'][] = array(
|
||||
'article_id' => $result['article_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $result['name'],
|
||||
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('configblog_article_description_length')) . '..',
|
||||
'rating' => $rating,
|
||||
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
|
||||
'viewed' => $result['viewed'],
|
||||
'href' => $this->url->link('blog/article', 'article_id=' . $result['article_id'])
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/blog_latest', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleCallback extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index() {
|
||||
$this->language->load('extension/module/callback');
|
||||
$json = array();
|
||||
|
||||
// $this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
|
||||
// $data['heading_title'] = $this->language->get('heading_title');
|
||||
|
||||
if ($this->request->server['REQUEST_METHOD'] == 'POST' && isset($this->request->post['action'])) {
|
||||
if ($this->validate()) {
|
||||
$data = array();
|
||||
if (isset($this->request->post['name'])) {
|
||||
$data['name'] = $this->request->post['name'];
|
||||
} else {
|
||||
$data['name'] = '';
|
||||
}
|
||||
if (isset($this->request->post['phone'])) {
|
||||
$data['phone'] = $this->request->post['phone'];
|
||||
} else {
|
||||
$data['phone'] = '';
|
||||
}
|
||||
if (isset($this->request->post['comment'])) {
|
||||
$data['comment'] = $this->request->post['comment'];
|
||||
} else {
|
||||
$data['comment'] = '';
|
||||
}
|
||||
$this->load->model('extension/module/callback');
|
||||
$results = $this->model_extension_module_callback->addCallback($data);
|
||||
|
||||
if ($this->config->get('theme_lightshop_callback_email_alert')) {
|
||||
$this->sendMail($data);
|
||||
}
|
||||
|
||||
$json['success'] = $this->language->get('ok');
|
||||
}else{
|
||||
$json['warning'] = $this->error;
|
||||
}
|
||||
|
||||
return $this->response->setOutput(json_encode($json));
|
||||
}
|
||||
|
||||
// Captcha
|
||||
if ($this->config->get('theme_lightshop_config_captcha_cb')) {
|
||||
$data['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('theme_lightshop_config_captcha_cb'));
|
||||
|
||||
} else {
|
||||
$data['captcha'] = '';
|
||||
}
|
||||
|
||||
$data['sendthis'] = $this->language->get('sendthis');
|
||||
$data['namew'] = $this->language->get('namew');
|
||||
$data['phonew'] = $this->language->get('phonew');
|
||||
$data['sendw'] = $this->language->get('sendw');
|
||||
$data['cancel'] = $this->language->get('cancel');
|
||||
$data['comment'] = $this->language->get('comment');
|
||||
|
||||
if ($this->config->get('theme_lightshop_callback_pdata')) {
|
||||
$this->load->language('extension/theme/lightshop');
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$information_info = $this->model_catalog_information->getInformation($this->config->get('theme_lightshop_callback_pdata'));
|
||||
|
||||
if ($information_info) {
|
||||
$data['text_lightshop_pdata'] = sprintf($this->language->get('text_lightshop_pdata'), $this->language->get('sendw'), $this->url->link('information/information/agree', 'information_id=' . $this->config->get('theme_lightshop_callback_pdata'), true), $information_info['title'], $information_info['title']);
|
||||
} else {
|
||||
$data['text_lightshop_pdata'] = '';
|
||||
}
|
||||
} else {
|
||||
$data['text_lightshop_pdata'] = '';
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/callback', $data);
|
||||
// $this->response->setOutput($this->load->view('extension/module/callback', $data));
|
||||
|
||||
}
|
||||
|
||||
private function validate() {
|
||||
$this->language->load('extension/module/callback');
|
||||
if ((strlen(utf8_decode($this->request->post['name'])) < 1) || (strlen(utf8_decode($this->request->post['name'])) > 32)) {
|
||||
$this->error['name'] = $this->language->get('mister');
|
||||
}
|
||||
if ((strlen(utf8_decode($this->request->post['phone'])) < 3) || (strlen(utf8_decode($this->request->post['phone'])) > 32)) {
|
||||
$this->error['phone'] = $this->language->get('wrongnumber');
|
||||
}
|
||||
|
||||
// Captcha
|
||||
if ($this->config->get('captcha_' . $this->config->get('theme_lightshop_config_captcha_cb') . '_status')) {
|
||||
$captcha = $this->load->controller('extension/captcha/' . $this->config->get('theme_lightshop_config_captcha_cb') . '/validate');
|
||||
|
||||
if ($captcha) {
|
||||
$this->error['captcha'] = $captcha;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private function sendMail($data) {
|
||||
$subject = $this->language->get('subject');
|
||||
$text = $this->language->get('text_1');
|
||||
$text .= $this->language->get('subject') . ":\n";
|
||||
$text .= $this->language->get('name') . $data['name'] . "\n";
|
||||
$text .= $this->language->get('phone') . $data['phone'] . "\n";
|
||||
$text .= $this->language->get('comment') . $data['comment'] . "\n";
|
||||
|
||||
$mail = new Mail();
|
||||
$mail->protocol = $this->config->get('config_mail_protocol');
|
||||
$mail->parameter = $this->config->get('config_mail_parameter');
|
||||
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
|
||||
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
|
||||
$mail->smtp_password = $this->config->get('config_mail_smtp_password');
|
||||
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
|
||||
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
|
||||
$mail->setTo($this->config->get('config_email'));
|
||||
$mail->setFrom($this->config->get('config_email'));
|
||||
$mail->setSender($this->config->get('config_name'));
|
||||
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
|
||||
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
|
||||
$mail->send();
|
||||
|
||||
// Send to additional alert emails
|
||||
$emails = explode(',', $this->config->get('config_alert_email'));
|
||||
|
||||
foreach ($emails as $email) {
|
||||
if ($email && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) {
|
||||
$mail->setTo($email);
|
||||
$mail->send();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleCarousel extends Controller {
|
||||
public function index($setting) {
|
||||
static $module = 0;
|
||||
|
||||
$this->load->model('design/banner');
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$this->document->addStyle('store/view/javascript/jquery/swiper/css/swiper.min.css');
|
||||
$this->document->addStyle('store/view/javascript/jquery/swiper/css/opencart.css');
|
||||
$this->document->addScript('store/view/javascript/jquery/swiper/js/swiper.jquery.js');
|
||||
|
||||
$data['banners'] = array();
|
||||
|
||||
$results = $this->model_design_banner->getBanner($setting['banner_id']);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if (is_file(DIR_IMAGE . $result['image'])) {
|
||||
$data['banners'][] = array(
|
||||
'title' => $result['title'],
|
||||
'link' => $result['link'],
|
||||
'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['module'] = $module++;
|
||||
|
||||
return $this->load->view('extension/module/carousel', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleCategory extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('extension/module/category');
|
||||
|
||||
if (isset($this->request->get['path'])) {
|
||||
$parts = explode('_', (string)$this->request->get['path']);
|
||||
} else {
|
||||
$parts = array();
|
||||
}
|
||||
|
||||
if (isset($parts[0])) {
|
||||
$data['category_id'] = $parts[0];
|
||||
} else {
|
||||
$data['category_id'] = 0;
|
||||
}
|
||||
|
||||
if (isset($parts[1])) {
|
||||
$data['child_id'] = $parts[1];
|
||||
} else {
|
||||
$data['child_id'] = 0;
|
||||
}
|
||||
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$data['categories'] = array();
|
||||
|
||||
$categories = $this->model_catalog_category->getCategories(0);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$children_data = array();
|
||||
|
||||
if ($category['category_id'] == $data['category_id']) {
|
||||
$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(
|
||||
'category_id' => $child['category_id'],
|
||||
'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'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$filter_data = array(
|
||||
'filter_category_id' => $category['category_id'],
|
||||
'filter_sub_category' => true
|
||||
);
|
||||
|
||||
$data['categories'][] = array(
|
||||
'category_id' => $category['category_id'],
|
||||
'name' => $category['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
|
||||
'children' => $children_data,
|
||||
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/category', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleFeatured extends Controller {
|
||||
public function index($setting) {
|
||||
$this->load->language('extension/module/featured');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['products'] = array();
|
||||
$data['module_name'] = $setting['name'];
|
||||
|
||||
if (!$setting['limit']) {
|
||||
$setting['limit'] = 4;
|
||||
}
|
||||
|
||||
if (!empty($setting['product'])) {
|
||||
$products = array_slice($setting['product'], 0, (int)$setting['limit']);
|
||||
|
||||
foreach ($products as $product_id) {
|
||||
$product_info = $this->model_catalog_product->getProduct($product_id);
|
||||
|
||||
if ($product_info) {
|
||||
if ($product_info['image']) {
|
||||
$image = $this->model_tool_image->resize($product_info['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
}
|
||||
|
||||
if (!is_null($product_info['special']) && (float)$product_info['special'] >= 0) {
|
||||
$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
$tax_price = (float)$product_info['special'];
|
||||
} else {
|
||||
$special = false;
|
||||
$tax_price = (float)$product_info['price'];
|
||||
}
|
||||
|
||||
if ($this->config->get('config_tax')) {
|
||||
$tax = $this->currency->format($tax_price, $this->session->data['currency']);
|
||||
} else {
|
||||
$tax = false;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_review_status')) {
|
||||
$rating = $product_info['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$results = $this->model_catalog_product->getProductImages($product_id);
|
||||
if($results){
|
||||
$additional_image = $this->model_tool_image->resize($results[0]['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$additional_image = false;
|
||||
}
|
||||
$data['products'][] = array(
|
||||
'product_id' => $product_info['product_id'],
|
||||
'thumb' => $image,
|
||||
'additional_thumb' => $additional_image,
|
||||
'price_n' => $product_info['price'],
|
||||
'price_2' => $this->currency->format($this->tax->calculate($product_info['price_2'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'price_2_n' => $product_info['price_2'],
|
||||
'price_3' => $this->currency->format($this->tax->calculate($product_info['price_3'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'price_3_n' => $product_info['price_3'],
|
||||
'min_price' => $this->currency->format($this->tax->calculate(min([$product_info['price'],$product_info['price_2']]), $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'name' => $product_info['name'],
|
||||
'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
|
||||
'price' => $price,
|
||||
'special' => $special,
|
||||
'tax' => $tax,
|
||||
'rating' => $rating,
|
||||
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['products']) {
|
||||
return $this->load->view('extension/module/featured', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerExtensionModuleFeaturedArticle extends Controller {
|
||||
public function index($setting) {
|
||||
|
||||
if (isset($this->request->get['product_id']) || isset($this->request->get['manufacturer_id']) || isset($this->request->get['path'])) {
|
||||
$this->load->language('extension/module/featured_article');
|
||||
|
||||
$this->load->model('blog/article');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['articles'] = array();
|
||||
|
||||
$results = array();
|
||||
|
||||
if (isset($this->request->get['product_id'])) {
|
||||
|
||||
$filter_data = array(
|
||||
'product_id' => $this->request->get['product_id'],
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_blog_article->getArticleRelatedByProduct($filter_data);
|
||||
|
||||
} elseif (isset($this->request->get['manufacturer_id'])) {
|
||||
|
||||
$filter_data = array(
|
||||
'manufacturer_id' => $this->request->get['manufacturer_id'],
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_blog_article->getArticleRelatedByManufacturer($filter_data);
|
||||
|
||||
} else {
|
||||
|
||||
$parts = explode('_', (string)$this->request->get['path']);
|
||||
|
||||
if(!empty($parts) && is_array($parts)) {
|
||||
|
||||
$filter_data = array(
|
||||
'category_id' => array_pop($parts),
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_blog_article->getArticleRelatedByCategory($filter_data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
$data['configblog_review_status'] = $this->config->get('configblog_review_status');
|
||||
|
||||
if ($this->config->get('configblog_review_status')) {
|
||||
$rating = $result['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$data['articles'][] = array(
|
||||
'article_id' => $result['article_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $result['name'],
|
||||
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('configblog_article_description_length')) . '..',
|
||||
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
|
||||
'viewed' => $result['viewed'],
|
||||
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
|
||||
'rating' => $rating,
|
||||
'href' => $this->url->link('blog/article', 'article_id=' . $result['article_id']),
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/featured_article', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerExtensionModuleFeaturedProduct extends Controller {
|
||||
public function index($setting) {
|
||||
|
||||
|
||||
if (!$setting['limit']) {
|
||||
$setting['limit'] = 4;
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
$this->load->model('catalog/cms');
|
||||
|
||||
if (isset($this->request->get['manufacturer_id'])) {
|
||||
|
||||
$filter_data = array(
|
||||
'manufacturer_id' => $this->request->get['manufacturer_id'],
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_catalog_cms->getProductRelatedByManufacturer($filter_data);
|
||||
|
||||
} else {
|
||||
|
||||
$parts = explode('_', (string)$this->request->get['path']);
|
||||
|
||||
if(!empty($parts) && is_array($parts)) {
|
||||
|
||||
$filter_data = array(
|
||||
'category_id' => array_pop($parts),
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_catalog_cms->getProductRelatedByCategory($filter_data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->language('extension/module/featured_product');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['products'] = array();
|
||||
|
||||
if (!empty($results)) {
|
||||
|
||||
foreach ($results as $product) {
|
||||
|
||||
if ($product) {
|
||||
if ($product['image']) {
|
||||
$image = $this->model_tool_image->resize($product['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
}
|
||||
|
||||
if ((float)$product['special']) {
|
||||
$special = $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
} else {
|
||||
$special = false;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_tax')) {
|
||||
$tax = $this->currency->format((float)$product['special'] ? $product['special'] : $product['price'], $this->session->data['currency']);
|
||||
} else {
|
||||
$tax = false;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_review_status')) {
|
||||
$rating = $product['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
|
||||
$data['products'][] = array(
|
||||
'product_id' => $product['product_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $product['name'],
|
||||
'description' => utf8_substr(strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
|
||||
'price' => $price,
|
||||
'special' => $special,
|
||||
'tax' => $tax,
|
||||
'rating' => $rating,
|
||||
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/featured_product', $data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleFilter extends Controller {
|
||||
public function index() {
|
||||
if (isset($this->request->get['path'])) {
|
||||
$parts = explode('_', (string)$this->request->get['path']);
|
||||
} else {
|
||||
$parts = array();
|
||||
}
|
||||
|
||||
$category_id = end($parts);
|
||||
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$category_info = $this->model_catalog_category->getCategory($category_id);
|
||||
|
||||
if ($category_info) {
|
||||
$this->load->language('extension/module/filter');
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['sort'])) {
|
||||
$url .= '&sort=' . $this->request->get['sort'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['order'])) {
|
||||
$url .= '&order=' . $this->request->get['order'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$url .= '&limit=' . $this->request->get['limit'];
|
||||
}
|
||||
|
||||
$data['action'] = str_replace('&', '&', $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url));
|
||||
|
||||
if (isset($this->request->get['filter'])) {
|
||||
$data['filter_category'] = explode(',', $this->request->get['filter']);
|
||||
} else {
|
||||
$data['filter_category'] = array();
|
||||
}
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$data['filter_groups'] = array();
|
||||
|
||||
$filter_groups = $this->model_catalog_category->getCategoryFilters($category_id);
|
||||
|
||||
if ($filter_groups) {
|
||||
foreach ($filter_groups as $filter_group) {
|
||||
$childen_data = array();
|
||||
|
||||
foreach ($filter_group['filter'] as $filter) {
|
||||
$filter_data = array(
|
||||
'filter_category_id' => $category_id,
|
||||
'filter_filter' => $filter['filter_id']
|
||||
);
|
||||
|
||||
$childen_data[] = array(
|
||||
'filter_id' => $filter['filter_id'],
|
||||
'name' => $filter['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : '')
|
||||
);
|
||||
}
|
||||
|
||||
$data['filter_groups'][] = array(
|
||||
'filter_group_id' => $filter_group['filter_group_id'],
|
||||
'name' => $filter_group['name'],
|
||||
'filter' => $childen_data
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/filter', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleHTML extends Controller {
|
||||
public function index($setting) {
|
||||
if (isset($setting['module_description'][$this->config->get('config_language_id')])) {
|
||||
$data['heading_title'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['title'], ENT_QUOTES, 'UTF-8');
|
||||
$data['html'] = html_entity_decode($setting['module_description'][$this->config->get('config_language_id')]['description'], ENT_QUOTES, 'UTF-8');
|
||||
|
||||
return $this->load->view('extension/module/html', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleInformation extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('extension/module/information');
|
||||
|
||||
$this->load->model('catalog/information');
|
||||
|
||||
$data['informations'] = array();
|
||||
|
||||
foreach ($this->model_catalog_information->getInformations() as $result) {
|
||||
$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['sitemap'] = $this->url->link('information/sitemap');
|
||||
|
||||
return $this->load->view('extension/module/information', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleLatest extends Controller {
|
||||
public function index($setting) {
|
||||
$this->load->language('extension/module/latest');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['products'] = array();
|
||||
$data['module_name'] = $setting['name'];
|
||||
|
||||
$results = $this->model_catalog_product->getLatestProducts($setting['limit']);
|
||||
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
}
|
||||
|
||||
if (!is_null($result['special']) && (float)$result['special'] >= 0) {
|
||||
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
$tax_price = (float)$result['special'];
|
||||
} else {
|
||||
$special = false;
|
||||
$tax_price = (float)$result['price'];
|
||||
}
|
||||
|
||||
if ($this->config->get('config_tax')) {
|
||||
$tax = $this->currency->format($tax_price, $this->session->data['currency']);
|
||||
} else {
|
||||
$tax = false;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_review_status')) {
|
||||
$rating = $result['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$results = $this->model_catalog_product->getProductImages($product_id);
|
||||
if($results){
|
||||
$additional_image = $this->model_tool_image->resize($results[0]['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$additional_image = false;
|
||||
}
|
||||
$data['products'][] = array(
|
||||
'product_id' => $result['product_id'],
|
||||
'thumb' => $image,
|
||||
'additional_thumb' => $additional_image,
|
||||
'price_n' => $product_info['price'],
|
||||
'price_2' => $this->currency->format($this->tax->calculate($product_info['price_2'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'price_2_n' => $product_info['price_2'],
|
||||
'price_3' => $this->currency->format($this->tax->calculate($product_info['price_3'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'price_3_n' => $product_info['price_3'],
|
||||
'min_price' => $this->currency->format($this->tax->calculate(min([$product_info['price'],$product_info['price_2']]), $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']),
|
||||
'name' => $result['name'],
|
||||
'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
|
||||
'price' => $price,
|
||||
'special' => $special,
|
||||
'tax' => $tax,
|
||||
'rating' => $rating,
|
||||
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'])
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/latest', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleSlideshow extends Controller {
|
||||
public function index($setting) {
|
||||
static $module = 0;
|
||||
|
||||
$this->load->model('design/banner');
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$this->document->addStyle('store/view/javascript/jquery/swiper/css/swiper.min.css');
|
||||
$this->document->addStyle('store/view/javascript/jquery/swiper/css/opencart.css');
|
||||
$this->document->addScript('store/view/javascript/jquery/swiper/js/swiper.jquery.js');
|
||||
|
||||
$data['banners'] = array();
|
||||
|
||||
$results = $this->model_design_banner->getBanner($setting['banner_id']);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if (is_file(DIR_IMAGE . $result['image'])) {
|
||||
$data['banners'][] = array(
|
||||
'title' => $result['title'],
|
||||
'link' => $result['link'],
|
||||
'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['module'] = $module++;
|
||||
|
||||
return $this->load->view('extension/module/slideshow', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleSpecial extends Controller {
|
||||
public function index($setting) {
|
||||
$this->load->language('extension/module/special');
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$data['products'] = array();
|
||||
|
||||
$filter_data = array(
|
||||
'sort' => 'pd.name',
|
||||
'order' => 'ASC',
|
||||
'start' => 0,
|
||||
'limit' => $setting['limit']
|
||||
);
|
||||
|
||||
$results = $this->model_catalog_product->getProductSpecials($filter_data);
|
||||
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']);
|
||||
} else {
|
||||
$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
|
||||
}
|
||||
|
||||
if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
|
||||
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
} else {
|
||||
$price = false;
|
||||
}
|
||||
|
||||
if (!is_null($result['special']) && (float)$result['special'] >= 0) {
|
||||
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
|
||||
$tax_price = (float)$result['special'];
|
||||
} else {
|
||||
$special = false;
|
||||
$tax_price = (float)$result['price'];
|
||||
}
|
||||
|
||||
if ($this->config->get('config_tax')) {
|
||||
$tax = $this->currency->format($tax_price, $this->session->data['currency']);
|
||||
} else {
|
||||
$tax = false;
|
||||
}
|
||||
|
||||
if ($this->config->get('config_review_status')) {
|
||||
$rating = $result['rating'];
|
||||
} else {
|
||||
$rating = false;
|
||||
}
|
||||
|
||||
$data['products'][] = array(
|
||||
'product_id' => $result['product_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $result['name'],
|
||||
'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
|
||||
'price' => $price,
|
||||
'special' => $special,
|
||||
'tax' => $tax,
|
||||
'rating' => $rating,
|
||||
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'])
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/special', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleStore extends Controller {
|
||||
public function index() {
|
||||
$status = true;
|
||||
|
||||
if ($this->config->get('module_store_admin')) {
|
||||
$this->user = new Cart\User($this->registry);
|
||||
|
||||
$status = $this->user->isLogged();
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
$this->load->language('extension/module/store');
|
||||
|
||||
$data['store_id'] = $this->config->get('config_store_id');
|
||||
|
||||
$data['stores'] = array();
|
||||
|
||||
$data['stores'][] = array(
|
||||
'store_id' => 0,
|
||||
'name' => $this->language->get('text_default'),
|
||||
'url' => HTTP_SERVER . 'index.php?route=common/home&session_id=' . $this->session->getId()
|
||||
);
|
||||
|
||||
$this->load->model('setting/store');
|
||||
|
||||
$results = $this->model_setting_store->getStores();
|
||||
|
||||
foreach ($results as $result) {
|
||||
$data['stores'][] = array(
|
||||
'store_id' => $result['store_id'],
|
||||
'name' => $result['name'],
|
||||
'url' => $result['url'] . 'index.php?route=common/home&session_id=' . $this->session->getId()
|
||||
);
|
||||
}
|
||||
|
||||
return $this->load->view('extension/module/store', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleSubcategory extends Controller {
|
||||
public function index($setting) {
|
||||
static $module = 0;
|
||||
$lang_id = $this->config->get('config_language_id');
|
||||
$this->load->model('tool/image');
|
||||
|
||||
|
||||
$data['random'] = token(32);
|
||||
$data['module_name'] = $setting['name'];
|
||||
|
||||
|
||||
$this->load->model('catalog/category');
|
||||
|
||||
$data['categories'] = [];
|
||||
|
||||
foreach($setting['category_ids'] as $category_id){
|
||||
$category_info = $this->model_catalog_category->getCategory($category_id);
|
||||
if($category_info){
|
||||
|
||||
$category_info['href'] = $this->url->link('product/category', 'path=' . $category_info['category_id']);
|
||||
|
||||
$category_info['thumb'] = $this->model_tool_image->resize($category_info['image'] ? $category_info['image'] : 'placeholder.png', $setting['sizes']['desktop']['width'], $setting['sizes']['desktop']['height']);
|
||||
|
||||
|
||||
$data['categories'][] = $category_info;
|
||||
}
|
||||
}
|
||||
|
||||
$data['sizes'] = $setting['sizes']['desktop'];
|
||||
|
||||
$data['module'] = $module++;
|
||||
if($data['categories']){
|
||||
|
||||
$this->document->addStyle('store/view/theme/dominik/assets/css/swiper-bundle.min.css');
|
||||
$this->document->addScript('store/view/theme/dominik/assets/js/swiper-bundle.js');
|
||||
|
||||
return $this->load->view('extension/module/subcategory', $data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class ControllerExtensionModuleWDBanners extends Controller {
|
||||
public function index($setting) {
|
||||
static $module = 0;
|
||||
|
||||
$this->load->model('tool/image');
|
||||
$this->load->model('design/banner');
|
||||
|
||||
if (isset($setting['include'])) {
|
||||
|
||||
$includes = explode("\r\n", $setting['include']);
|
||||
|
||||
foreach ($includes as $include) {
|
||||
$include = trim($include, "/");
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $include)) {
|
||||
$path_parts = pathinfo($_SERVER['DOCUMENT_ROOT'] . '/' . $include);
|
||||
switch ($path_parts['extension']) {
|
||||
case "css":
|
||||
$this->document->addStyle($include);
|
||||
break;
|
||||
case "js":
|
||||
$this->document->addScript($include);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data['random'] = token(32);
|
||||
$data['title'] = isset($setting['hide']) ? $setting['name'] : false;
|
||||
|
||||
$data['sizes'] = $setting['sizes'];
|
||||
|
||||
$data['favicon'] = $this->model_tool_image->resize($this->config->get("config_icon"), 114, 114, true);
|
||||
|
||||
$data['banners'] = array();
|
||||
|
||||
if (!empty($setting['banner_id'])) {
|
||||
$results = $this->model_design_banner->getBanner($setting['banner_id']);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if (is_file(DIR_IMAGE . $result['image'])) {
|
||||
$data['banners'][] = array(
|
||||
'image' => $this->model_tool_image->resize($result['image'], $setting['sizes']['desktop']['width'], $setting['sizes']['desktop']['height']),
|
||||
'image_mob' => $result['image_mobile'] && is_file(DIR_IMAGE . $result['image_mobile']) ? $this->model_tool_image->resize($result['image_mobile'], $setting['sizes']['mob']['width'], $setting['sizes']['mob']['height']) : '',
|
||||
'image_orig' => HTTPS_SERVER . 'image/' . $result['image'],
|
||||
'title' => html_entity_decode($result['title'], ENT_QUOTES, 'UTF-8'),
|
||||
'text' => html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'),
|
||||
'link' => $result['link'],
|
||||
'button' => $result['button_text'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data['module'] = $module++;
|
||||
|
||||
return $this->load->view('extension/module/' . ((isset($setting['twig']) && $setting['twig'] != "") ? trim($setting['twig']) : "wd_banners"), $data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user