Категории услуг и удаление latest из блога
This commit is contained in:
@@ -442,6 +442,12 @@ class ControllerBlogArticle extends Controller {
|
||||
$data['error_keyword'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['category'])) {
|
||||
$data['error_category'] = $this->error['category'];
|
||||
} else {
|
||||
$data['error_category'] = '';
|
||||
}
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['filter_name'])) {
|
||||
@@ -596,8 +602,8 @@ class ControllerBlogArticle extends Controller {
|
||||
$data['main_blog_category_id'] = 0;
|
||||
}
|
||||
|
||||
if (isset($this->request->post['article_blog_category'])) {
|
||||
$categories = $this->request->post['article_blog_category'];
|
||||
if (isset($this->request->post['article_category'])) {
|
||||
$categories = $this->request->post['article_category'];
|
||||
} elseif (isset($this->request->get['article_id'])) {
|
||||
$categories = $this->model_blog_article->getArticleCategories($this->request->get['article_id']);
|
||||
} else {
|
||||
@@ -756,6 +762,10 @@ class ControllerBlogArticle extends Controller {
|
||||
$this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['article_category'])) {
|
||||
$this->error['category'] = $this->language->get('error_category');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['article_seo_url']) && is_array($this->request->post['article_seo_url'])) {
|
||||
foreach ($this->request->post['article_seo_url'] as $store_id => &$languages) {
|
||||
@@ -932,4 +942,4 @@ class ControllerBlogArticle extends Controller {
|
||||
$this->response->addHeader('Content-Type: application/json');
|
||||
$this->response->setOutput(json_encode($json));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,12 +41,6 @@ class ControllerBlogSetting extends Controller {
|
||||
$data['entry_image_related'] = $this->language->get('entry_image_related');
|
||||
$data['entry_width'] = $this->language->get('entry_width');
|
||||
$data['entry_height'] = $this->language->get('entry_height');
|
||||
$data['entry_name'] = $this->language->get('entry_name');
|
||||
$data['entry_html_h1'] = $this->language->get('entry_html_h1');
|
||||
$data['entry_meta_title'] = $this->language->get('entry_meta_title');
|
||||
$data['entry_meta_description'] = $this->language->get('entry_meta_description');
|
||||
$data['entry_meta_keyword'] = $this->language->get('entry_meta_keyword');
|
||||
|
||||
$data['help_comment'] = $this->language->get('help_comment');
|
||||
$data['help_article_limit'] = $this->language->get('help_article_limit');
|
||||
$data['help_article_description_length'] = $this->language->get('help_article_description_length');
|
||||
@@ -222,36 +216,6 @@ class ControllerBlogSetting extends Controller {
|
||||
$data['configblog_image_related_height'] = $this->config->get('configblog_image_related_height');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['configblog_name'])) {
|
||||
$data['configblog_name'] = $this->request->post['configblog_name'];
|
||||
} else {
|
||||
$data['configblog_name'] = $this->config->get('configblog_name');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['configblog_html_h1'])) {
|
||||
$data['configblog_html_h1'] = $this->request->post['configblog_html_h1'];
|
||||
} else {
|
||||
$data['configblog_html_h1'] = $this->config->get('configblog_html_h1');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['configblog_meta_title'])) {
|
||||
$data['configblog_meta_title'] = $this->request->post['configblog_meta_title'];
|
||||
} else {
|
||||
$data['configblog_meta_title'] = $this->config->get('configblog_meta_title');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['configblog_meta_description'])) {
|
||||
$data['configblog_meta_description'] = $this->request->post['configblog_meta_description'];
|
||||
} else {
|
||||
$data['configblog_meta_description'] = $this->config->get('configblog_meta_description');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['configblog_meta_keyword'])) {
|
||||
$data['configblog_meta_keyword'] = $this->request->post['configblog_meta_keyword'];
|
||||
} else {
|
||||
$data['configblog_meta_keyword'] = $this->config->get('configblog_meta_keyword');
|
||||
}
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
@@ -294,4 +258,4 @@ class ControllerBlogSetting extends Controller {
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,14 @@ class ControllerCommonColumnLeft extends Controller {
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->user->hasPermission('access', 'service/category')) {
|
||||
$service[] = array(
|
||||
'name' => $this->language->get('text_service_category'),
|
||||
'href' => $this->url->link('service/category', 'user_token=' . $this->session->data['user_token'], true),
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
if ($service) {
|
||||
$data['menus'][] = array(
|
||||
'id' => 'menu-service',
|
||||
|
||||
@@ -0,0 +1,683 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerServiceCategory extends Controller {
|
||||
private $error = array();
|
||||
private $service_category_id = 0;
|
||||
private $path = array();
|
||||
|
||||
public function index() {
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
$this->getList();
|
||||
}
|
||||
|
||||
public function add() {
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
|
||||
$this->model_service_category->addCategory($this->request->post);
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$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['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
$this->response->redirect($this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
|
||||
}
|
||||
|
||||
$this->getForm();
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
|
||||
$this->model_service_category->editCategory($this->request->get['service_category_id'], $this->request->post);
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$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['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
$this->response->redirect($this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
|
||||
}
|
||||
|
||||
$this->getForm();
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
if (isset($this->request->post['selected']) && $this->validateDelete()) {
|
||||
foreach ($this->request->post['selected'] as $service_category_id) {
|
||||
$this->model_service_category->deleteCategory($service_category_id);
|
||||
}
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$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['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
$this->response->redirect($this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
|
||||
}
|
||||
|
||||
$this->getList();
|
||||
}
|
||||
|
||||
public function repair() {
|
||||
$url = '';
|
||||
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
if ($this->validateRepair()) {
|
||||
$this->model_service_category->repairCategories();
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$this->response->redirect($this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
|
||||
}
|
||||
|
||||
$this->getList();
|
||||
}
|
||||
|
||||
protected function getList() {
|
||||
|
||||
$url = '';
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true)
|
||||
);
|
||||
|
||||
$data['add'] = $this->url->link('service/category/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
$data['delete'] = $this->url->link('service/category/delete', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
$data['repair'] = $this->url->link('service/category/repair', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
|
||||
$data['enabled'] = $this->url->link('service/category/enable', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
$data['disabled'] = $this->url->link('service/category/disable', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
|
||||
if (isset($this->request->get['path'])) {
|
||||
if ($this->request->get['path'] != '') {
|
||||
$this->path = explode('_', $this->request->get['path']);
|
||||
$this->service_category_id = end($this->path);
|
||||
$this->session->data['path'] = $this->request->get['path'];
|
||||
} else {
|
||||
unset($this->session->data['path']);
|
||||
}
|
||||
} elseif (isset($this->session->data['path'])) {
|
||||
$this->path = explode('_', $this->session->data['path']);
|
||||
$this->service_category_id = end($this->path);
|
||||
}
|
||||
|
||||
$data['categories'] = $this->getCategories(0);
|
||||
|
||||
if (isset($this->error['warning'])) {
|
||||
$data['error_warning'] = $this->error['warning'];
|
||||
} else {
|
||||
$data['error_warning'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->session->data['success'])) {
|
||||
$data['success'] = $this->session->data['success'];
|
||||
|
||||
unset($this->session->data['success']);
|
||||
} else {
|
||||
$data['success'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['selected'])) {
|
||||
$data['selected'] = (array)$this->request->post['selected'];
|
||||
} else {
|
||||
$data['selected'] = array();
|
||||
}
|
||||
|
||||
$url = '';
|
||||
$category_total = $this->model_service_category->getTotalCategories();
|
||||
|
||||
$data['results'] = $this->language->get('text_category_total') . ($category_total);
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
|
||||
$this->response->setOutput($this->load->view('service/category_list', $data));
|
||||
}
|
||||
|
||||
protected function getForm() {
|
||||
|
||||
if (isset($this->error['warning'])) {
|
||||
$data['error_warning'] = $this->error['warning'];
|
||||
} else {
|
||||
$data['error_warning'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['name'])) {
|
||||
$data['error_name'] = $this->error['name'];
|
||||
} else {
|
||||
$data['error_name'] = array();
|
||||
}
|
||||
|
||||
if (isset($this->error['meta_title'])) {
|
||||
$data['error_meta_title'] = $this->error['meta_title'];
|
||||
} else {
|
||||
$data['error_meta_title'] = array();
|
||||
}
|
||||
|
||||
if (isset($this->error['meta_h1'])) {
|
||||
$data['error_meta_h1'] = $this->error['meta_h1'];
|
||||
} else {
|
||||
$data['error_meta_h1'] = array();
|
||||
}
|
||||
|
||||
if (isset($this->error['keyword'])) {
|
||||
$data['error_keyword'] = $this->error['keyword'];
|
||||
} else {
|
||||
$data['error_keyword'] = '';
|
||||
}
|
||||
|
||||
$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['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true)
|
||||
);
|
||||
|
||||
if (!isset($this->request->get['service_category_id'])) {
|
||||
$data['action'] = $this->url->link('service/category/add', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
} else {
|
||||
$data['action'] = $this->url->link('service/category/edit', 'user_token=' . $this->session->data['user_token'] . '&service_category_id=' . $this->request->get['service_category_id'] . $url, true);
|
||||
}
|
||||
|
||||
$data['cancel'] = $this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true);
|
||||
|
||||
if (isset($this->request->get['service_category_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
|
||||
$category_info = $this->model_service_category->getCategory($this->request->get['service_category_id']);
|
||||
}
|
||||
|
||||
$data['user_token'] = $this->session->data['user_token'];
|
||||
|
||||
$this->load->model('localisation/language');
|
||||
|
||||
$data['languages'] = $this->model_localisation_language->getLanguages();
|
||||
|
||||
if (isset($this->request->post['category_description'])) {
|
||||
$data['category_description'] = $this->request->post['category_description'];
|
||||
} elseif (isset($this->request->get['service_category_id'])) {
|
||||
$data['category_description'] = $this->model_service_category->getCategoryDescriptions($this->request->get['service_category_id']);
|
||||
} else {
|
||||
$data['category_description'] = array();
|
||||
}
|
||||
|
||||
$language_id = $this->config->get('config_language_id');
|
||||
if (isset($data['category_description'][$language_id]['name'])) {
|
||||
$data['heading_title'] = $data['category_description'][$language_id]['name'];
|
||||
}
|
||||
|
||||
if (isset($this->request->post['path'])) {
|
||||
$data['path'] = $this->request->post['path'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['path'] = $category_info['path'];
|
||||
} else {
|
||||
$data['path'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->request->post['parent_id'])) {
|
||||
$data['parent_id'] = $this->request->post['parent_id'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['parent_id'] = $category_info['parent_id'];
|
||||
} else {
|
||||
$data['parent_id'] = 0;
|
||||
}
|
||||
|
||||
$this->load->model('setting/store');
|
||||
|
||||
$data['stores'] = array();
|
||||
|
||||
$data['stores'][] = array(
|
||||
'store_id' => 0,
|
||||
'name' => $this->language->get('text_default')
|
||||
);
|
||||
|
||||
$stores = $this->model_setting_store->getStores();
|
||||
|
||||
foreach ($stores as $store) {
|
||||
$data['stores'][] = array(
|
||||
'store_id' => $store['store_id'],
|
||||
'name' => $store['name']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($this->request->post['category_store'])) {
|
||||
$data['category_store'] = $this->request->post['category_store'];
|
||||
} elseif (isset($this->request->get['service_category_id'])) {
|
||||
$data['category_store'] = $this->model_service_category->getCategoryStores($this->request->get['service_category_id']);
|
||||
} else {
|
||||
$data['category_store'] = array(0);
|
||||
}
|
||||
|
||||
if (isset($this->request->post['image'])) {
|
||||
$data['image'] = $this->request->post['image'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['image'] = $category_info['image'];
|
||||
} else {
|
||||
$data['image'] = '';
|
||||
}
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
|
||||
$data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
|
||||
} elseif (!empty($category_info) && is_file(DIR_IMAGE . $category_info['image'])) {
|
||||
$data['thumb'] = $this->model_tool_image->resize($category_info['image'], 100, 100);
|
||||
} else {
|
||||
$data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
|
||||
}
|
||||
|
||||
$data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
|
||||
|
||||
if (isset($this->request->post['top'])) {
|
||||
$data['top'] = $this->request->post['top'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['top'] = $category_info['top'];
|
||||
} else {
|
||||
$data['top'] = 0;
|
||||
}
|
||||
|
||||
if (isset($this->request->post['column'])) {
|
||||
$data['column'] = $this->request->post['column'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['column'] = $category_info['column'];
|
||||
} else {
|
||||
$data['column'] = 1;
|
||||
}
|
||||
|
||||
if (isset($this->request->post['sort_order'])) {
|
||||
$data['sort_order'] = $this->request->post['sort_order'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['sort_order'] = $category_info['sort_order'];
|
||||
} else {
|
||||
$data['sort_order'] = 0;
|
||||
}
|
||||
|
||||
if (isset($this->request->post['category_seo_url'])) {
|
||||
$data['category_seo_url'] = $this->request->post['category_seo_url'];
|
||||
} elseif (isset($this->request->get['service_category_id'])) {
|
||||
$data['category_seo_url'] = $this->model_service_category->getCategorySeoUrls($this->request->get['service_category_id']);
|
||||
} else {
|
||||
$data['category_seo_url'] = array();
|
||||
}
|
||||
|
||||
if (isset($this->request->post['status'])) {
|
||||
$data['status'] = $this->request->post['status'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['status'] = $category_info['status'];
|
||||
} else {
|
||||
$data['status'] = true;
|
||||
}
|
||||
|
||||
if (isset($this->request->post['noindex'])) {
|
||||
$data['noindex'] = $this->request->post['noindex'];
|
||||
} elseif (!empty($category_info)) {
|
||||
$data['noindex'] = $category_info['noindex'];
|
||||
} else {
|
||||
$data['noindex'] = 1;
|
||||
}
|
||||
|
||||
if (isset($this->request->post['category_layout'])) {
|
||||
$data['category_layout'] = $this->request->post['category_layout'];
|
||||
} elseif (isset($this->request->get['service_category_id'])) {
|
||||
$data['category_layout'] = $this->model_service_category->getCategoryLayouts($this->request->get['service_category_id']);
|
||||
} else {
|
||||
$data['category_layout'] = array();
|
||||
}
|
||||
|
||||
$this->load->model('design/layout');
|
||||
|
||||
$data['layouts'] = $this->model_design_layout->getLayouts();
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
|
||||
$this->response->setOutput($this->load->view('service/category_form', $data));
|
||||
}
|
||||
|
||||
protected function validateForm() {
|
||||
if (!$this->user->hasPermission('modify', 'service/category')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
}
|
||||
|
||||
foreach ($this->request->post['category_description'] as $language_id => $value) {
|
||||
if ((utf8_strlen($value['name']) < 2) || (utf8_strlen($value['name']) > 255)) {
|
||||
$this->error['name'][$language_id] = $this->language->get('error_name');
|
||||
}
|
||||
|
||||
if ((utf8_strlen($value['meta_title']) < 0) || (utf8_strlen($value['meta_title']) > 255)) {
|
||||
$this->error['meta_title'][$language_id] = $this->language->get('error_meta_title');
|
||||
}
|
||||
|
||||
if ((utf8_strlen($value['meta_h1']) < 0) || (utf8_strlen($value['meta_h1']) > 255)) {
|
||||
$this->error['meta_h1'][$language_id] = $this->language->get('error_meta_h1');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->request->post['category_seo_url']) && is_array($this->request->post['category_seo_url'])) {
|
||||
foreach ($this->request->post['category_seo_url'] as $store_id => &$languages) {
|
||||
foreach ($languages as $language_id => &$keyword) {
|
||||
if (!empty($keyword)) {
|
||||
$keyword = translit($keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->request->post['category_description'])) {
|
||||
foreach ($this->request->post['category_description'] as $language_id => $value) {
|
||||
if (!empty($value['name'])) {
|
||||
if (!isset($this->request->post['category_seo_url'][0][$language_id]) || trim($this->request->post['category_seo_url'][0][$language_id]) === '') {
|
||||
$this->request->post['category_seo_url'][0][$language_id] = translit($value['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->request->post['category_seo_url']) {
|
||||
$this->load->model('design/seo_url');
|
||||
|
||||
foreach ($this->request->post['category_seo_url'] as $store_id => $language) {
|
||||
foreach ($language as $language_id => $keyword) {
|
||||
if (!empty($keyword)) {
|
||||
if (count(array_keys($language, $keyword)) > 1) {
|
||||
$this->error['keyword'][$store_id][$language_id] = $this->language->get('error_unique');
|
||||
}
|
||||
|
||||
$seo_urls = $this->model_design_seo_url->getSeoUrlsByKeyword($keyword);
|
||||
|
||||
foreach ($seo_urls as $seo_url) {
|
||||
if (($seo_url['store_id'] == $store_id) && (!isset($this->request->get['service_category_id']) || ($seo_url['query'] != 'service_category_id=' . $this->request->get['service_category_id']))) {
|
||||
$this->error['keyword'][$store_id][$language_id] = $this->language->get('error_keyword');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->error && !isset($this->error['warning'])) {
|
||||
$this->error['warning'] = $this->language->get('error_warning');
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
public function enable() {
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
if (isset($this->request->post['selected'])) {
|
||||
|
||||
foreach ($this->request->post['selected'] as $service_category_id) {
|
||||
$this->model_service_category->editCategoryStatus($service_category_id, 1);
|
||||
}
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['sort'])) {
|
||||
$url .= '&sort=' . $this->request->get['sort'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['order'])) {
|
||||
$url .= '&order=' . $this->request->get['order'];
|
||||
}
|
||||
|
||||
$this->response->redirect($this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
|
||||
}
|
||||
|
||||
$this->getList();
|
||||
}
|
||||
|
||||
public function disable() {
|
||||
$this->load->language('service/category');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
if (isset($this->request->post['selected'])) {
|
||||
|
||||
foreach ($this->request->post['selected'] as $service_category_id) {
|
||||
$this->model_service_category->editCategoryStatus($service_category_id, 0);
|
||||
}
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['sort'])) {
|
||||
$url .= '&sort=' . $this->request->get['sort'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['order'])) {
|
||||
$url .= '&order=' . $this->request->get['order'];
|
||||
}
|
||||
|
||||
$this->response->redirect($this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . $url, true));
|
||||
}
|
||||
|
||||
$this->getList();
|
||||
}
|
||||
|
||||
protected function validateDelete() {
|
||||
if (!$this->user->hasPermission('modify', 'service/category')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
}
|
||||
|
||||
foreach ($this->request->post['selected'] as $service_category_id) {
|
||||
if ($this->model_service_category->getTotalServicesByCategoryId($service_category_id)) {
|
||||
$this->error['warning'] = $this->language->get('error_service');
|
||||
}
|
||||
|
||||
if ($this->model_service_category->getCategoriesByParentId($service_category_id)) {
|
||||
$this->error['warning'] = $this->language->get('error_children');
|
||||
}
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
protected function validateRepair() {
|
||||
if (!$this->user->hasPermission('modify', 'service/category')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
|
||||
public function autocomplete() {
|
||||
$json = array();
|
||||
|
||||
if (isset($this->request->get['filter_name'])) {
|
||||
$this->load->model('service/category');
|
||||
|
||||
$filter_data = array(
|
||||
'filter_name' => $this->request->get['filter_name'],
|
||||
'sort' => 'name',
|
||||
'order' => 'ASC',
|
||||
'start' => 0,
|
||||
'limit' => $this->config->get('config_limit_autocomplete')
|
||||
);
|
||||
|
||||
$results = $this->model_service_category->getCategories($filter_data);
|
||||
|
||||
foreach ($results as $result) {
|
||||
$json[] = array(
|
||||
'service_category_id' => $result['service_category_id'],
|
||||
'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sort_order = array();
|
||||
|
||||
foreach ($json as $key => $value) {
|
||||
$sort_order[$key] = $value['name'];
|
||||
}
|
||||
|
||||
array_multisort($sort_order, SORT_ASC, $json);
|
||||
|
||||
$this->response->addHeader('Content-Type: application/json');
|
||||
$this->response->setOutput(json_encode($json));
|
||||
}
|
||||
|
||||
private function getCategories($parent_id, $parent_path = '', $indent = '') {
|
||||
$service_category_id = array_shift($this->path);
|
||||
$output = array();
|
||||
static $href_category = null;
|
||||
if ($href_category === null) {
|
||||
$href_category = $this->url->link('service/category', 'user_token=' . $this->session->data['user_token'] . '&path=', true);
|
||||
}
|
||||
$results = $this->model_service_category->getCategoriesByParentId($parent_id);
|
||||
foreach ($results as $result) {
|
||||
$path = $parent_path . $result['service_category_id'];
|
||||
$href = ($result['children']) ? $href_category . $path : '';
|
||||
$name = $result['name'];
|
||||
if ($service_category_id == $result['service_category_id']) {
|
||||
$name = '<b>' . $name . '</b>';
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $result['name'],
|
||||
'href' => $href,
|
||||
'separator' => ' :: '
|
||||
);
|
||||
$href = '';
|
||||
}
|
||||
$selected = isset($this->request->post['selected']) && in_array($result['service_category_id'], $this->request->post['selected']);
|
||||
$output[$result['service_category_id']] = array(
|
||||
'service_category_id' => $result['service_category_id'],
|
||||
'name' => $name,
|
||||
'sort_order' => $result['sort_order'],
|
||||
'noindex' => $result['noindex'],
|
||||
'edit' => $this->url->link('service/category/edit', 'user_token=' . $this->session->data['user_token'] . '&service_category_id=' . $result['service_category_id'], true),
|
||||
'selected' => $selected,
|
||||
'href' => $href,
|
||||
'href_shop' => HTTP_CATALOG . 'index.php?route=service/category&service_category_id=' . $path,
|
||||
'indent' => $indent
|
||||
);
|
||||
if ($service_category_id == $result['service_category_id']) {
|
||||
$output += $this->getCategories($result['service_category_id'], $path . '_', $indent . str_repeat(' ', 8));
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
private function getAllCategories($categories, $parent_id = 0, $parent_name = '') {
|
||||
$output = array();
|
||||
if (array_key_exists($parent_id, $categories)) {
|
||||
if ($parent_name != '') {
|
||||
$parent_name .= $this->language->get('text_separator');
|
||||
}
|
||||
foreach ($categories[$parent_id] as $category) {
|
||||
$output[$category['service_category_id']] = array(
|
||||
'service_category_id' => $category['service_category_id'],
|
||||
'name' => $parent_name . $category['name']
|
||||
);
|
||||
$output += $this->getAllCategories($categories, $category['service_category_id'], $parent_name . $category['name']);
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -439,6 +439,12 @@ class ControllerServiceService extends Controller {
|
||||
$data['error_keyword'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['category'])) {
|
||||
$data['error_category'] = $this->error['category'];
|
||||
} else {
|
||||
$data['error_category'] = '';
|
||||
}
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['filter_name'])) {
|
||||
@@ -578,6 +584,19 @@ class ControllerServiceService extends Controller {
|
||||
$data['noindex'] = 1;
|
||||
}
|
||||
|
||||
$this->load->model('service/category');
|
||||
|
||||
$categories = $this->model_service_category->getAllCategories();
|
||||
$data['categories'] = $this->model_service_category->getCategories($categories);
|
||||
|
||||
if (isset($this->request->post['service_category_id'])) {
|
||||
$data['service_category_id'] = (int)$this->request->post['service_category_id'];
|
||||
} elseif (isset($this->request->get['service_id'])) {
|
||||
$data['service_category_id'] = $this->model_service_service->getServiceCategoryId($this->request->get['service_id']);
|
||||
} else {
|
||||
$data['service_category_id'] = 0;
|
||||
}
|
||||
|
||||
// Images
|
||||
if (isset($this->request->post['service_image'])) {
|
||||
$service_images = $this->request->post['service_image'];
|
||||
@@ -718,6 +737,10 @@ class ControllerServiceService extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->request->post['service_category_id'])) {
|
||||
$this->error['category'] = $this->language->get('error_category');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['service_seo_url']) && is_array($this->request->post['service_seo_url'])) {
|
||||
foreach ($this->request->post['service_seo_url'] as $store_id => &$languages) {
|
||||
foreach ($languages as $language_id => &$keyword) {
|
||||
|
||||
@@ -55,4 +55,5 @@ $_['error_permission'] = 'У вас недостаточно прав дл
|
||||
$_['error_name'] = 'Название должно содержать от 3 до 255 символов!';
|
||||
$_['error_meta_title'] = 'Мета-тег Title должен содержать от 0 до 255 символов!';
|
||||
$_['error_meta_h1'] = 'HTML-тег H1 должен содержать от 0 до 255 символов!';
|
||||
$_['error_keyword'] = 'Выбранный SEO URL уже используется!';
|
||||
$_['error_category'] = 'Укажите хотя бы одну категорию статьи!';
|
||||
$_['error_keyword'] = 'Выбранный SEO URL уже используется!';
|
||||
|
||||
@@ -26,12 +26,6 @@ $_['entry_image_article'] = 'Размер изображения в
|
||||
$_['entry_image_related'] = 'Размер изображения аналогичных статей, товаров';
|
||||
$_['entry_width'] = 'Ширина';
|
||||
$_['entry_height'] = 'Высота';
|
||||
$_['entry_name'] = 'Название';
|
||||
$_['entry_meta_title'] = 'Мета-тег Title';
|
||||
$_['entry_html_h1'] = 'HTML-тег H1';
|
||||
$_['entry_meta_description'] = 'Мета-тег Description';
|
||||
$_['entry_meta_keyword'] = 'Мета-тег Keywords';
|
||||
|
||||
// Help
|
||||
$_['help_article_limit'] = 'Количество статей на странице Список статей';
|
||||
$_['help_article_description_length'] = 'Количество символов в кратком описании статьи на странице Список статей';
|
||||
@@ -48,4 +42,4 @@ $_['error_permission'] = 'У вас недостаточно п
|
||||
$_['error_limit'] = 'Укажите количество!';
|
||||
$_['error_image_article'] = 'Необходимо указать размер изображения в списке статей!';
|
||||
$_['error_image_category'] = 'Необходимо указать размер изображения в описании категории блога!';
|
||||
$_['error_image_related'] = 'Необходимо указать размер изображения аналогичных статей, товаров!';
|
||||
$_['error_image_related'] = 'Необходимо указать размер изображения аналогичных статей, товаров!';
|
||||
|
||||
@@ -137,6 +137,7 @@ $_['text_blog_review'] = 'Отзывы блога';
|
||||
$_['text_blog_setting'] = 'Настройки блога';
|
||||
$_['text_service_title'] = 'Услуги';
|
||||
$_['text_service'] = 'Список услуг';
|
||||
$_['text_complete_status'] = 'Завершенных заказов';
|
||||
$_['text_processing_status'] = 'Заказов в процессе';
|
||||
$_['text_other_status'] = 'Другие заказы';
|
||||
$_['text_service_category'] = 'Категории услуг';
|
||||
$_['text_complete_status'] = 'Завершенных заказов';
|
||||
$_['text_processing_status'] = 'Заказов в процессе';
|
||||
$_['text_other_status'] = 'Другие заказы';
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
// Heading
|
||||
$_['heading_title'] = 'Категории услуг';
|
||||
|
||||
// Text
|
||||
$_['text_success'] = 'Настройки успешно изменены!';
|
||||
$_['text_list'] = 'Категории';
|
||||
$_['text_add'] = 'Добавить';
|
||||
$_['text_edit'] = 'Редактирование категории услуг';
|
||||
$_['text_default'] = 'По умолчанию';
|
||||
$_['text_category_total'] = 'Всего категорий: ';
|
||||
|
||||
// Column
|
||||
$_['column_name'] = 'Категории';
|
||||
$_['column_sort_order'] = 'Порядок сортировки';
|
||||
$_['column_noindex'] = 'Индексация';
|
||||
$_['column_action'] = 'Действия';
|
||||
|
||||
// Entry
|
||||
$_['entry_name'] = 'Категория';
|
||||
$_['entry_description'] = 'Описание';
|
||||
$_['entry_meta_title'] = 'Мета-тег Title';
|
||||
$_['entry_meta_h1'] = 'HTML-тег H1';
|
||||
$_['entry_meta_keyword'] = 'Мета-тег Keywords';
|
||||
$_['entry_meta_description'] = 'Мета-тег Description';
|
||||
$_['entry_keyword'] = 'SEO URL';
|
||||
$_['entry_parent'] = 'Родительская категория';
|
||||
$_['entry_store'] = 'Магазины';
|
||||
$_['entry_image'] = 'Изображение категории';
|
||||
$_['entry_top'] = 'Главное меню';
|
||||
$_['entry_column'] = 'Столбцы';
|
||||
$_['entry_sort_order'] = 'Порядок сортировки';
|
||||
$_['entry_status'] = 'Статус';
|
||||
$_['entry_noindex'] = 'Индексация';
|
||||
$_['entry_layout'] = 'Выбрать макет';
|
||||
|
||||
// Help
|
||||
$_['help_keyword'] = 'Должен быть уникальным во всей системе, без пробелов и спецсимволов';
|
||||
$_['help_top'] = 'Показывать в главном меню (только для родительских категорий)';
|
||||
$_['help_column'] = 'Количество столбцов в выпадающем меню категории (только для родительских категорий)';
|
||||
$_['help_noindex'] = 'Индексация поисковыми системами Google, Yandex, Bing и др.';
|
||||
|
||||
// Error
|
||||
$_['error_warning'] = 'Внимательно проверьте форму на ошибки!';
|
||||
$_['error_permission'] = 'У вас недостаточно прав для внесения изменений!';
|
||||
$_['error_name'] = 'Название должно содержать от 2 до 32 символов!';
|
||||
$_['error_meta_title'] = 'Мета-тег Title должен содержать от 0 до 255 символов!';
|
||||
$_['error_meta_h1'] = 'HTML-тег H1 должен содержать от 0 до 255 символов!';
|
||||
$_['error_keyword'] = 'Выбранный SEO URL уже используется!';
|
||||
$_['error_service'] = 'Категорию нельзя удалить, пока в ней есть услуги!';
|
||||
$_['error_children'] = 'Категорию нельзя удалить, пока в ней есть подкатегории!';
|
||||
@@ -25,6 +25,7 @@ $_['entry_image'] = 'Изображение услуги';
|
||||
$_['entry_status'] = 'Статус';
|
||||
$_['entry_noindex'] = 'Индексация';
|
||||
$_['entry_sort_order'] = 'Порядок сортировки';
|
||||
$_['entry_category'] = 'Категория';
|
||||
$_['entry_download'] = 'Загрузки';
|
||||
$_['entry_related'] = 'Рекомендуемые услуги';
|
||||
$_['entry_related_product'] = 'Рекомендуемые товары';
|
||||
@@ -41,4 +42,5 @@ $_['error_permission'] = 'У вас недостаточно прав дл
|
||||
$_['error_name'] = 'Название должно содержать от 3 до 255 символов!';
|
||||
$_['error_meta_title'] = 'Мета-тег Title должен содержать от 0 до 255 символов!';
|
||||
$_['error_meta_h1'] = 'HTML-тег H1 должен содержать от 0 до 255 символов!';
|
||||
$_['error_category'] = 'Укажите категорию услуги!';
|
||||
$_['error_keyword'] = 'Выбранный SEO URL уже используется!';
|
||||
|
||||
@@ -47,6 +47,8 @@ class ModelDesignLayout extends Model {
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "product_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "information_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
|
||||
}
|
||||
|
||||
public function getLayout($layout_id) {
|
||||
@@ -106,4 +108,4 @@ class ModelDesignLayout extends Model {
|
||||
|
||||
return $query->row['total'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
class ModelServiceCategory extends Model {
|
||||
public function addCategory($data) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', date_modified = NOW(), date_added = NOW()");
|
||||
$service_category_id = $this->db->getLastId();
|
||||
if (isset($data['image'])) {
|
||||
$this->db->query("UPDATE " . DB_PREFIX . "service_category SET image = '" . $this->db->escape($data['image']) . "' WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
}
|
||||
foreach ($data['category_description'] as $language_id => $value) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category_description SET service_category_id = '" . (int)$service_category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
}
|
||||
// MySQL Hierarchical Data Closure Table Pattern
|
||||
$level = 0;
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$data['parent_id'] . "' ORDER BY `level` ASC");
|
||||
foreach ($query->rows as $result) {
|
||||
$this->db->query("INSERT INTO `" . DB_PREFIX . "service_category_path` SET `service_category_id` = '" . (int)$service_category_id . "', `path_id` = '" . (int)$result['path_id'] . "', `level` = '" . (int)$level . "'");
|
||||
$level++;
|
||||
}
|
||||
$this->db->query("INSERT INTO `" . DB_PREFIX . "service_category_path` SET `service_category_id` = '" . (int)$service_category_id . "', `path_id` = '" . (int)$service_category_id . "', `level` = '" . (int)$level . "'");
|
||||
if (isset($data['category_store'])) {
|
||||
foreach ($data['category_store'] as $store_id) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category_to_store SET service_category_id = '" . (int)$service_category_id . "', store_id = '" . (int)$store_id . "'");
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data['category_seo_url'])) {
|
||||
foreach ($data['category_seo_url'] as $store_id => $language) {
|
||||
foreach ($language as $language_id => $keyword) {
|
||||
if (!empty($keyword)) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'service_category_id=" . (int)$service_category_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set which layout to use with this category
|
||||
if (isset($data['category_layout'])) {
|
||||
foreach ($data['category_layout'] as $store_id => $layout_id) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category_to_layout SET service_category_id = '" . (int)$service_category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
|
||||
}
|
||||
}
|
||||
$this->cache->delete('service_category');
|
||||
|
||||
if($this->config->get('config_seo_pro')){
|
||||
$this->cache->delete('seopro');
|
||||
}
|
||||
return $service_category_id;
|
||||
}
|
||||
public function editCategory($service_category_id, $data) {
|
||||
$this->db->query("UPDATE " . DB_PREFIX . "service_category SET parent_id = '" . (int)$data['parent_id'] . "', `top` = '" . (isset($data['top']) ? (int)$data['top'] : 0) . "', sort_order = '" . (int)$data['sort_order'] . "', status = '" . (int)$data['status'] . "', noindex = '" . (int)$data['noindex'] . "', date_modified = NOW() WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
if (isset($data['image'])) {
|
||||
$this->db->query("UPDATE " . DB_PREFIX . "service_category SET image = '" . $this->db->escape($data['image']) . "' WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
}
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_description WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
foreach ($data['category_description'] as $language_id => $value) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category_description SET service_category_id = '" . (int)$service_category_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
}
|
||||
// MySQL Hierarchical Data Closure Table Pattern
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "service_category_path` WHERE path_id = '" . (int)$service_category_id . "' ORDER BY level ASC");
|
||||
if ($query->rows) {
|
||||
foreach ($query->rows as $category_path) {
|
||||
// Delete the path below the current one
|
||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$category_path['service_category_id'] . "' AND level < '" . (int)$category_path['level'] . "'");
|
||||
$path = array();
|
||||
// Get the nodes new parents
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
|
||||
foreach ($query->rows as $result) {
|
||||
$path[] = $result['path_id'];
|
||||
}
|
||||
// Get whats left of the nodes current path
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$category_path['service_category_id'] . "' ORDER BY level ASC");
|
||||
foreach ($query->rows as $result) {
|
||||
$path[] = $result['path_id'];
|
||||
}
|
||||
// Combine the paths with a new level
|
||||
$level = 0;
|
||||
foreach ($path as $path_id) {
|
||||
$this->db->query("REPLACE INTO `" . DB_PREFIX . "service_category_path` SET service_category_id = '" . (int)$category_path['service_category_id'] . "', `path_id` = '" . (int)$path_id . "', level = '" . (int)$level . "'");
|
||||
$level++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Delete the path below the current one
|
||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
// Fix for records with no paths
|
||||
$level = 0;
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$data['parent_id'] . "' ORDER BY level ASC");
|
||||
foreach ($query->rows as $result) {
|
||||
$this->db->query("INSERT INTO `" . DB_PREFIX . "service_category_path` SET service_category_id = '" . (int)$service_category_id . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
|
||||
$level++;
|
||||
}
|
||||
$this->db->query("REPLACE INTO `" . DB_PREFIX . "service_category_path` SET service_category_id = '" . (int)$service_category_id . "', `path_id` = '" . (int)$service_category_id . "', level = '" . (int)$level . "'");
|
||||
}
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_to_store WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
if (isset($data['category_store'])) {
|
||||
foreach ($data['category_store'] as $store_id) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category_to_store SET service_category_id = '" . (int)$service_category_id . "', store_id = '" . (int)$store_id . "'");
|
||||
}
|
||||
}
|
||||
|
||||
// SEO URL
|
||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'service_category_id=" . (int)$service_category_id . "'");
|
||||
if (isset($data['category_seo_url'])) {
|
||||
foreach ($data['category_seo_url'] as $store_id => $language) {
|
||||
foreach ($language as $language_id => $keyword) {
|
||||
if (!empty($keyword)) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET store_id = '" . (int)$store_id . "', language_id = '" . (int)$language_id . "', query = 'service_category_id=" . (int)$service_category_id . "', keyword = '" . $this->db->escape(trim($keyword)) . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_to_layout WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
if (isset($data['category_layout'])) {
|
||||
foreach ($data['category_layout'] as $store_id => $layout_id) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_category_to_layout SET service_category_id = '" . (int)$service_category_id . "', store_id = '" . (int)$store_id . "', layout_id = '" . (int)$layout_id . "'");
|
||||
}
|
||||
}
|
||||
$this->cache->delete('service_category');
|
||||
|
||||
if($this->config->get('config_seo_pro')){
|
||||
$this->cache->delete('seopro');
|
||||
}
|
||||
}
|
||||
|
||||
public function editCategoryStatus($service_category_id, $status) {
|
||||
$this->db->query("UPDATE " . DB_PREFIX . "service_category SET status = '" . (int)$status . "', date_modified = NOW() WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
|
||||
$this->cache->delete('service_category');
|
||||
}
|
||||
public function deleteCategory($service_category_id) {
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_path WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category_path WHERE path_id = '" . (int)$service_category_id . "'");
|
||||
foreach ($query->rows as $result) {
|
||||
$this->deleteCategory($result['service_category_id']);
|
||||
}
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_description WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_to_store WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_category_to_layout WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_category WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'service_category_id=" . (int)$service_category_id . "'");
|
||||
$this->cache->delete('service_category');
|
||||
|
||||
if($this->config->get('config_seo_pro')){
|
||||
$this->cache->delete('seopro');
|
||||
}
|
||||
}
|
||||
public function repairCategories($parent_id = 0) {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category WHERE parent_id = '" . (int)$parent_id . "'");
|
||||
foreach ($query->rows as $category) {
|
||||
// Delete the path below the current one
|
||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$category['service_category_id'] . "'");
|
||||
// Fix for records with no paths
|
||||
$level = 0;
|
||||
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "service_category_path` WHERE service_category_id = '" . (int)$parent_id . "' ORDER BY level ASC");
|
||||
foreach ($query->rows as $result) {
|
||||
$this->db->query("INSERT INTO `" . DB_PREFIX . "service_category_path` SET service_category_id = '" . (int)$category['service_category_id'] . "', `path_id` = '" . (int)$result['path_id'] . "', level = '" . (int)$level . "'");
|
||||
$level++;
|
||||
}
|
||||
$this->db->query("REPLACE INTO `" . DB_PREFIX . "service_category_path` SET service_category_id = '" . (int)$category['service_category_id'] . "', `path_id` = '" . (int)$category['service_category_id'] . "', level = '" . (int)$level . "'");
|
||||
$this->repairCategories($category['service_category_id']);
|
||||
}
|
||||
}
|
||||
public function getCategory($service_category_id) {
|
||||
$query = $this->db->query("SELECT DISTINCT *, (SELECT GROUP_CONCAT(cd1.name ORDER BY level SEPARATOR ' > ') FROM " . DB_PREFIX . "service_category_path cp LEFT JOIN " . DB_PREFIX . "service_category_description cd1 ON (cp.path_id = cd1.service_category_id AND cp.service_category_id != cp.path_id) WHERE cp.service_category_id = c.service_category_id AND cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' GROUP BY cp.service_category_id) AS path FROM " . DB_PREFIX . "service_category c LEFT JOIN " . DB_PREFIX . "service_category_description cd2 ON (c.service_category_id = cd2.service_category_id) WHERE c.service_category_id = '" . (int)$service_category_id . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'");
|
||||
return $query->row;
|
||||
}
|
||||
public function getCategories($data = array()) {
|
||||
$sql = "SELECT cp.service_category_id AS service_category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c1.parent_id, c1.sort_order, c1.noindex FROM " . DB_PREFIX . "service_category_path cp LEFT JOIN " . DB_PREFIX . "service_category c1 ON (cp.service_category_id = c1.service_category_id) LEFT JOIN " . DB_PREFIX . "service_category c2 ON (cp.path_id = c2.service_category_id) LEFT JOIN " . DB_PREFIX . "service_category_description cd1 ON (cp.path_id = cd1.service_category_id) LEFT JOIN " . DB_PREFIX . "service_category_description cd2 ON (cp.service_category_id = cd2.service_category_id) WHERE cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
|
||||
if (!empty($data['filter_name'])) {
|
||||
$sql .= " AND cd2.name LIKE '" . $this->db->escape($data['filter_name']) . "%'";
|
||||
}
|
||||
$sql .= " GROUP BY cp.service_category_id";
|
||||
$sort_data = array(
|
||||
'name',
|
||||
'sort_order',
|
||||
'noindex'
|
||||
);
|
||||
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
|
||||
$sql .= " ORDER BY " . $data['sort'];
|
||||
} else {
|
||||
$sql .= " ORDER BY sort_order";
|
||||
}
|
||||
if (isset($data['order']) && ($data['order'] == 'DESC')) {
|
||||
$sql .= " DESC";
|
||||
} else {
|
||||
$sql .= " ASC";
|
||||
}
|
||||
if (isset($data['start']) || isset($data['limit'])) {
|
||||
if ($data['start'] < 0) {
|
||||
$data['start'] = 0;
|
||||
}
|
||||
if ($data['limit'] < 1) {
|
||||
$data['limit'] = 20;
|
||||
}
|
||||
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
|
||||
}
|
||||
$query = $this->db->query($sql);
|
||||
return $query->rows;
|
||||
}
|
||||
public function getCategoryDescriptions($service_category_id) {
|
||||
$category_description_data = array();
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category_description WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
foreach ($query->rows as $result) {
|
||||
$category_description_data[$result['language_id']] = array(
|
||||
'name' => $result['name'],
|
||||
'meta_title' => $result['meta_title'],
|
||||
'meta_h1' => $result['meta_h1'],
|
||||
'meta_description' => $result['meta_description'],
|
||||
'meta_keyword' => $result['meta_keyword'],
|
||||
'description' => $result['description']
|
||||
);
|
||||
}
|
||||
return $category_description_data;
|
||||
}
|
||||
public function getCategoryStores($service_category_id) {
|
||||
$category_store_data = array();
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category_to_store WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
foreach ($query->rows as $result) {
|
||||
$category_store_data[] = $result['store_id'];
|
||||
}
|
||||
return $category_store_data;
|
||||
}
|
||||
|
||||
public function getCategorySeoUrls($service_category_id) {
|
||||
$category_seo_url_data = array();
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'service_category_id=" . (int)$service_category_id . "'");
|
||||
foreach ($query->rows as $result) {
|
||||
$category_seo_url_data[$result['store_id']][$result['language_id']] = $result['keyword'];
|
||||
}
|
||||
return $category_seo_url_data;
|
||||
}
|
||||
public function getCategoryLayouts($service_category_id) {
|
||||
$category_layout_data = array();
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category_to_layout WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
foreach ($query->rows as $result) {
|
||||
$category_layout_data[$result['store_id']] = $result['layout_id'];
|
||||
}
|
||||
return $category_layout_data;
|
||||
}
|
||||
public function getTotalCategories() {
|
||||
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "service_category");
|
||||
return $query->row['total'];
|
||||
}
|
||||
|
||||
public function getTotalCategoriesByLayoutId($layout_id) {
|
||||
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "service_category_to_layout WHERE layout_id = '" . (int)$layout_id . "'");
|
||||
return $query->row['total'];
|
||||
}
|
||||
|
||||
public function getTotalServicesByCategoryId($service_category_id) {
|
||||
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "service_to_category WHERE service_category_id = '" . (int)$service_category_id . "'");
|
||||
|
||||
return $query->row['total'];
|
||||
}
|
||||
|
||||
public function getCategoriesByParentId($parent_id = 0) {
|
||||
$query = $this->db->query("SELECT *, (SELECT COUNT(parent_id) FROM " . DB_PREFIX . "service_category WHERE parent_id = c.service_category_id) AS children FROM " . DB_PREFIX . "service_category c LEFT JOIN " . DB_PREFIX . "service_category_description cd ON (c.service_category_id = cd.service_category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY c.sort_order, cd.name");
|
||||
return $query->rows;
|
||||
}
|
||||
|
||||
public function getAllCategories() {
|
||||
$category_data = $this->cache->get('service_category.all.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'));
|
||||
if (!$category_data || !is_array($category_data)) {
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category c LEFT JOIN " . DB_PREFIX . "service_category_description cd ON (c.service_category_id = cd.service_category_id) LEFT JOIN " . DB_PREFIX . "service_category_to_store c2s ON (c.service_category_id = c2s.service_category_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' ORDER BY c.parent_id, c.sort_order, cd.name");
|
||||
$category_data = array();
|
||||
|
||||
foreach ($query->rows as $row) {
|
||||
$category_data[$row['parent_id']][$row['service_category_id']] = $row;
|
||||
}
|
||||
$this->cache->set('service_category.all.' . $this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id'), $category_data);
|
||||
}
|
||||
|
||||
return $category_data;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ class ModelServiceService extends Model {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_description SET service_id = '" . (int)$service_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
}
|
||||
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_to_category SET service_id = '" . (int)$service_id . "', service_category_id = '" . (int)$data['service_category_id'] . "'");
|
||||
|
||||
if (isset($data['service_store'])) {
|
||||
foreach ($data['service_store'] as $store_id) {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_to_store SET service_id = '" . (int)$service_id . "', store_id = '" . (int)$store_id . "'");
|
||||
@@ -86,6 +88,9 @@ class ModelServiceService extends Model {
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_description SET service_id = '" . (int)$service_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_h1 = '" . $this->db->escape($value['meta_h1']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
|
||||
}
|
||||
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_category WHERE service_id = '" . (int)$service_id . "'");
|
||||
$this->db->query("INSERT INTO " . DB_PREFIX . "service_to_category SET service_id = '" . (int)$service_id . "', service_category_id = '" . (int)$data['service_category_id'] . "'");
|
||||
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_store WHERE service_id = '" . (int)$service_id . "'");
|
||||
|
||||
if (isset($data['service_store'])) {
|
||||
@@ -185,6 +190,7 @@ class ModelServiceService extends Model {
|
||||
$data['service_download'] = $this->getServiceDownloads($service_id);
|
||||
$data['service_layout'] = $this->getServiceLayouts($service_id);
|
||||
$data['service_store'] = $this->getServiceStores($service_id);
|
||||
$data['service_category_id'] = $this->getServiceCategoryId($service_id);
|
||||
|
||||
$this->addService($data);
|
||||
}
|
||||
@@ -201,6 +207,7 @@ class ModelServiceService extends Model {
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_download WHERE service_id = '" . (int)$service_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_layout WHERE service_id = '" . (int)$service_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_store WHERE service_id = '" . (int)$service_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "service_to_category WHERE service_id = '" . (int)$service_id . "'");
|
||||
$this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'service_id=" . (int)$service_id . "'");
|
||||
|
||||
$this->cache->delete('service');
|
||||
@@ -315,6 +322,12 @@ class ModelServiceService extends Model {
|
||||
return $service_store_data;
|
||||
}
|
||||
|
||||
public function getServiceCategoryId($service_id) {
|
||||
$query = $this->db->query("SELECT service_category_id FROM " . DB_PREFIX . "service_to_category WHERE service_id = '" . (int)$service_id . "' LIMIT 1");
|
||||
|
||||
return $query->num_rows ? (int)$query->row['service_category_id'] : 0;
|
||||
}
|
||||
|
||||
public function getServiceSeoUrls($service_id) {
|
||||
$service_seo_url_data = array();
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
{% endfor %}</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab-data">
|
||||
<div class="form-group">
|
||||
<div class="form-group required">
|
||||
<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="status" id="input-status" class="form-control">
|
||||
@@ -126,6 +126,9 @@
|
||||
<input type="hidden" name="article_category[]" value="{{ article_category.blog_category_id }}" />
|
||||
</div>
|
||||
{% endfor %}</div>
|
||||
{% if error_category %}
|
||||
<div class="text-danger">{{ error_category }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -31,44 +31,11 @@
|
||||
<div class="panel-body">
|
||||
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-setting" class="form-horizontal">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tab-general" data-toggle="tab">{{ tab_general }}</a></li>
|
||||
<li><a href="#tab-option" data-toggle="tab">{{ tab_option }}</a></li>
|
||||
<li class="active"><a href="#tab-option" data-toggle="tab">{{ tab_option }}</a></li>
|
||||
<li><a href="#tab-image" data-toggle="tab">{{ tab_image }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab-general">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-name">{{ entry_name }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="configblog_name" value="{{ configblog_name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-h1">{{ entry_html_h1 }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="configblog_html_h1" value="{{ configblog_html_h1 }}" placeholder="{{ entry_html_h1 }}" id="input-h1" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-title">{{ entry_meta_title }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="configblog_meta_title" value="{{ configblog_meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-description">{{ entry_meta_description }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="configblog_meta_description" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description" class="form-control">{{ configblog_meta_description }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-keyword">{{ entry_meta_keyword }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="configblog_meta_keyword" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword" class="form-control">{{ configblog_meta_keyword }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab-option">
|
||||
<div class="tab-pane active" id="tab-option">
|
||||
<fieldset>
|
||||
<legend>{{ text_article }}</legend>
|
||||
<div class="form-group">
|
||||
@@ -296,4 +263,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ footer }}
|
||||
{{ footer }}
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
{{ header }}{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="pull-right">
|
||||
<button type="submit" form="form-category" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
|
||||
<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
{% if error_warning %}
|
||||
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_form }}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-category" class="form-horizontal">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tab-general" data-toggle="tab">{{ tab_general }}</a></li>
|
||||
<li><a href="#tab-data" data-toggle="tab">{{ tab_data }}</a></li>
|
||||
<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>
|
||||
<li><a href="#tab-design" data-toggle="tab">{{ tab_design }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab-general">
|
||||
<ul class="nav nav-tabs" id="language">
|
||||
{% for language in languages %}
|
||||
<li><a href="#language{{ language.language_id }}" data-toggle="tab"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> {{ language.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
{% for language in languages %}
|
||||
<div class="tab-pane" id="language{{ language.language_id }}">
|
||||
<div class="form-group required">
|
||||
<label class="col-sm-2 control-label" for="input-name{{ language.language_id }}">{{ entry_name }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="category_description[{{ language.language_id }}][name]" value="{{ category_description[language.language_id] ? category_description[language.language_id].name }}" placeholder="{{ entry_name }}" id="input-name{{ language.language_id }}" class="form-control" />
|
||||
{% if error_name[language.language_id] %}
|
||||
<div class="text-danger">{{ error_name[language.language_id] }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-h1{{ language.language_id }}">{{ entry_meta_h1 }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="category_description[{{ language.language_id }}][meta_h1]" value="{{ category_description[language.language_id] ? category_description[language.language_id].meta_h1 }}" placeholder="{{ entry_meta_h1 }}" id="input-meta-h1{{ language.language_id }}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-title{{ language.language_id }}">{{ entry_meta_title }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="category_description[{{ language.language_id }}][meta_title]" value="{{ category_description[language.language_id] ? category_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-description{{ language.language_id }}">{{ entry_meta_description }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="category_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].meta_description }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-meta-keyword{{ language.language_id }}">{{ entry_meta_keyword }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="category_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].meta_keyword }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-description{{ language.language_id }}">{{ entry_description }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="category_description[{{ language.language_id }}][description]" placeholder="{{ entry_description }}" id="input-description{{ language.language_id }}" data-toggle="summernote" data-lang="{{ summernote }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].description }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab-data">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-parent">{{ entry_parent }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="path" value="{{ path }}" placeholder="{{ entry_parent }}" id="input-parent" class="form-control" />
|
||||
<input type="hidden" name="parent_id" value="{{ parent_id }}" />
|
||||
{% if error_parent %}
|
||||
<div class="text-danger">{{ error_parent }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ entry_store }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="well well-sm" style="height: 150px; overflow: auto;">
|
||||
{% for store in stores %}
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{% if store.store_id in category_store %}
|
||||
<input type="checkbox" name="category_store[]" value="{{ store.store_id }}" checked="checked" />
|
||||
{{ store.name }}
|
||||
{% else %}
|
||||
<input type="checkbox" name="category_store[]" value="{{ store.store_id }}" />
|
||||
{{ store.name }}
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ entry_image }}</label>
|
||||
<div class="col-sm-10"><a href="" id="thumb-image" data-toggle="image" class="img-thumbnail"><img src="{{ thumb }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a>
|
||||
<input type="hidden" name="image" value="{{ image }}" id="input-image" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-top"><span data-toggle="tooltip" title="{{ help_top }}">{{ entry_top }}</span></label>
|
||||
<div class="col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{% if top %}
|
||||
<input type="checkbox" name="top" value="1" checked="checked" id="input-top" />
|
||||
{% else %}
|
||||
<input type="checkbox" name="top" value="1" id="input-top" />
|
||||
{% endif %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-sort-order">{{ entry_sort_order }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="sort_order" value="{{ sort_order }}" placeholder="{{ entry_sort_order }}" id="input-sort-order" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-column"><span data-toggle="tooltip" title="{{ help_column }}">{{ entry_column }}</span></label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="column" value="{{ column }}" placeholder="{{ entry_column }}" id="input-column" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="status" id="input-status" class="form-control">
|
||||
{% if status %}
|
||||
<option value="1" selected="selected">{{ text_enabled }}</option>
|
||||
<option value="0">{{ text_disabled }}</option>
|
||||
{% else %}
|
||||
<option value="1">{{ text_enabled }}</option>
|
||||
<option value="0" selected="selected">{{ text_disabled }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab-seo">
|
||||
<div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ text_keyword }}</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-left">{{ entry_store }}</td>
|
||||
<td class="text-left">{{ entry_keyword }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for store in stores %}
|
||||
<tr>
|
||||
<td class="text-left">{{ store.name }}</td>
|
||||
<td class="text-left">{% for language in languages %}
|
||||
<div class="input-group"><span class="input-group-addon"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /></span>
|
||||
<input type="text" name="category_seo_url[{{ store.store_id }}][{{ language.language_id }}]" value="{% if category_seo_url[store.store_id][language.language_id] %}{{ category_seo_url[store.store_id][language.language_id] }}{% endif %}" placeholder="{{ entry_keyword }}" class="form-control" />
|
||||
</div>
|
||||
{% if error_keyword[store.store_id][language.language_id] %}
|
||||
<div class="text-danger">{{ error_keyword[store.store_id][language.language_id] }}</div>
|
||||
{% endif %}
|
||||
{% endfor %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-noindex">{{ entry_noindex }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="noindex" id="input-noindex" class="form-control">
|
||||
{% if noindex %}
|
||||
<option value="1" selected="selected">{{ text_enabled }}</option>
|
||||
<option value="0">{{ text_disabled }}</option>
|
||||
{% else %}
|
||||
<option value="1">{{ text_enabled }}</option>
|
||||
<option value="0" selected="selected">{{ text_disabled }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab-design">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="text-left">{{ entry_store }}</td>
|
||||
<td class="text-left">{{ entry_layout }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{% for store in stores %}
|
||||
<tr>
|
||||
<td class="text-left">{{ store.name }}</td>
|
||||
<td class="text-left"><select name="category_layout[{{ store.store_id }}]" class="form-control">
|
||||
<option value=""></option>
|
||||
{% for layout in layouts %}
|
||||
{% if category_layout[store.store_id] and category_layout[store.store_id] == layout.layout_id %}
|
||||
<option value="{{ layout.layout_id }}" selected="selected">{{ layout.name }}</option>
|
||||
{% else %}
|
||||
<option value="{{ layout.layout_id }}">{{ layout.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<link href="view/javascript/codemirror/lib/codemirror.css" rel="stylesheet" />
|
||||
<link href="view/javascript/codemirror/theme/monokai.css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="view/javascript/codemirror/lib/codemirror.js"></script>
|
||||
<script type="text/javascript" src="view/javascript/codemirror/lib/xml.js"></script>
|
||||
<script type="text/javascript" src="view/javascript/codemirror/lib/formatting.js"></script>
|
||||
|
||||
<script type="text/javascript" src="view/javascript/summernote/summernote.js"></script>
|
||||
<link href="view/javascript/summernote/summernote.css" rel="stylesheet" />
|
||||
<script type="text/javascript" src="view/javascript/summernote/summernote-image-attributes.js"></script>
|
||||
<script type="text/javascript" src="view/javascript/summernote/opencart.js"></script>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
$('input[name=\'path\']').autocomplete({
|
||||
'source': function(request, response) {
|
||||
$.ajax({
|
||||
url: 'index.php?route=service/category/autocomplete&user_token={{ user_token }}&filter_name=' + encodeURIComponent(request),
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
json.unshift({
|
||||
service_category_id: 0,
|
||||
name: '{{ text_none }}'
|
||||
});
|
||||
|
||||
response($.map(json, function(item) {
|
||||
return {
|
||||
label: item['name'],
|
||||
value: item['service_category_id']
|
||||
}
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
'select': function(item) {
|
||||
$('input[name=\'path\']').val(item['label']);
|
||||
$('input[name=\'parent_id\']').val(item['value']);
|
||||
}
|
||||
});
|
||||
//--></script>
|
||||
<script type="text/javascript"><!--
|
||||
$('#language a:first').tab('show');
|
||||
//--></script></div>
|
||||
{{ footer }}
|
||||
@@ -0,0 +1,92 @@
|
||||
{{ header }}{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="pull-right"><a href="{{ add }}" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus"></i></a>
|
||||
<a href="{{ repair }}" data-toggle="tooltip" title="{{ button_rebuild }}" class="btn btn-default"><i class="fa fa-refresh"></i></a>
|
||||
<button type="submit" form="form-category" formaction="{{ enabled }}" data-toggle="tooltip" title="{{ button_enable }}" class="btn btn-default"><i class="fa fa-play"></i></button>
|
||||
<button type="submit" form="form-category" formaction="{{ disabled }}" data-toggle="tooltip" title="{{ button_disable }}" class="btn btn-default"><i class="fa fa-pause"></i></button>
|
||||
<button type="button" form="form-category" formaction="{{ delete }}" data-toggle="tooltip" title="{{ button_delete }}" class="btn btn-danger" onclick="confirm('{{ text_confirm }}') ? $('#form-category').submit() : false;"><i class="fa fa-trash-o"></i></button>
|
||||
</div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
{% if error_warning %}
|
||||
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if success %}
|
||||
<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><i class="fa fa-list"></i> {{ text_list }}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="{{ delete }}" method="post" enctype="multipart/form-data" id="form-category">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
|
||||
<td class="text-left">{{ column_name }}</td>
|
||||
<td class="text-right">{{ column_sort_order }}</td>
|
||||
<td class="text-right">{{ column_noindex }}</td>
|
||||
<td class="text-right">{{ column_action }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if categories %}
|
||||
{% for category in categories %}
|
||||
<tr>
|
||||
<td class="text-center">{% if category.service_category_id in selected %}
|
||||
<input type="checkbox" name="selected[]" value="{{ category.service_category_id }}" checked="checked" />
|
||||
{% else %}
|
||||
<input type="checkbox" name="selected[]" value="{{ category.service_category_id }}" />
|
||||
{% endif %}</td>
|
||||
{% if category.href %}
|
||||
<td class="left">{{ category.indent }}<a href="{{ category.href }}">{{ category.name }}</a> <i class="fa fa-sort-desc"></i></td>
|
||||
{% else %}
|
||||
<td class="left">{{ category.indent }}{{ category.name }}</td>
|
||||
{% endif %}
|
||||
<td class="text-right">{{ category.sort_order }}</td>
|
||||
<td class="text-right">{{ category.noindex }}</td>
|
||||
<td class="text-right">
|
||||
<a target="_blank" href="{{ category.href_shop }}" data-toggle="tooltip" title="{{ button_shop }}" class="btn btn-success"><i class="fa fa-eye"></i></a>
|
||||
<a href="{{ category.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary"><i class="fa fa-pencil"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td class="text-center" colspan="5">{{ text_no_results }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-right">{{ results }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
// IE and Edge fix!
|
||||
$('button[form=\'form-category\']').on('click', function(e) {
|
||||
$('#form-category').attr('action', $(this).attr('formaction'));
|
||||
});
|
||||
//--></script>
|
||||
</div>
|
||||
{{ footer }}
|
||||
@@ -105,6 +105,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="tab-links">
|
||||
<div class="form-group required">
|
||||
<label class="col-sm-2 control-label" for="input-category">{{ entry_category }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="service_category_id" id="input-category" class="form-control">
|
||||
<option value="0">{{ text_none }}</option>
|
||||
{% for category in categories %}
|
||||
{% if category.service_category_id == service_category_id %}
|
||||
<option value="{{ category.service_category_id }}" selected="selected">{{ category.name }}</option>
|
||||
{% else %}
|
||||
<option value="{{ category.service_category_id }}">{{ category.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% if error_category %}
|
||||
<div class="text-danger">{{ error_category }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{{ entry_store }}</label>
|
||||
<div class="col-sm-10">
|
||||
|
||||
@@ -16,14 +16,6 @@ class ControllerBlogArticle extends Controller {
|
||||
'separator' => false
|
||||
);
|
||||
|
||||
$configblog_name = $this->config->get('configblog_name');
|
||||
|
||||
if (!empty($configblog_name)) {
|
||||
$name = $this->config->get('configblog_name');
|
||||
} else {
|
||||
$name = $this->language->get('text_blog');
|
||||
}
|
||||
|
||||
$this->load->model('blog/category');
|
||||
|
||||
|
||||
@@ -511,4 +503,4 @@ class ControllerBlogArticle extends Controller {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -62,16 +62,6 @@ class ControllerBlogCategory extends Controller {
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
$configblog_name = $this->config->get('configblog_name');
|
||||
|
||||
if (!empty($configblog_name)) {
|
||||
$name = $this->config->get('configblog_name');
|
||||
} else {
|
||||
$name = $this->language->get('text_blog');
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($this->request->get['blog_category_id'])) {
|
||||
$url = '';
|
||||
|
||||
@@ -414,4 +404,4 @@ class ControllerBlogCategory extends Controller {
|
||||
$this->response->setOutput($this->load->view('error/not_found', $data));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,306 +0,0 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ControllerBlogLatest extends Controller {
|
||||
public function index() {
|
||||
|
||||
$this->load->language('blog/latest');
|
||||
|
||||
$this->load->model('blog/article');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
if ($this->config->get('config_noindex_disallow_params')) {
|
||||
$params = explode ("\r\n", $this->config->get('config_noindex_disallow_params'));
|
||||
if(!empty($params)) {
|
||||
$disallow_params = $params;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->request->get['sort'])) {
|
||||
$sort = $this->request->get['sort'];
|
||||
if (!in_array('sort', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$sort = 'p.date_added';
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->request->get['order'])) {
|
||||
$order = $this->request->get['order'];
|
||||
if (!in_array('order', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$order = 'DESC';
|
||||
}
|
||||
|
||||
if (isset($this->request->get['page'])) {
|
||||
$page = $this->request->get['page'];
|
||||
if (!in_array('page', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$limit = $this->request->get['limit'];
|
||||
if (!in_array('limit', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$limit = $this->config->get('configblog_article_limit');
|
||||
}
|
||||
|
||||
$configblog_html_h1 = $this->config->get('configblog_html_h1');
|
||||
|
||||
if (!empty($configblog_html_h1)) {
|
||||
$data['heading_title'] = $this->config->get('configblog_html_h1');
|
||||
} else {
|
||||
$data['heading_title'] = $this->language->get('heading_title');
|
||||
}
|
||||
|
||||
$configblog_meta_title = $this->config->get('configblog_meta_title');
|
||||
|
||||
if (!empty($configblog_meta_title)) {
|
||||
$this->document->setTitle($this->config->get('configblog_meta_title'));
|
||||
} else {
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
}
|
||||
|
||||
$this->document->setDescription($this->config->get('configblog_meta_description'));
|
||||
$this->document->setKeywords($this->config->get('configblog_meta_keyword'));
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
$configblog_name = $this->config->get('configblog_name');
|
||||
|
||||
if (!empty($configblog_name)) {
|
||||
$name = $this->config->get('configblog_name');
|
||||
} else {
|
||||
$name = $this->language->get('heading_title');
|
||||
}
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $name,
|
||||
'href' => $this->url->link('blog/latest')
|
||||
);
|
||||
|
||||
$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['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$url .= '&limit=' . $this->request->get['limit'];
|
||||
}
|
||||
|
||||
$data['text_refine'] = $this->language->get('text_refine');
|
||||
$data['text_views'] = $this->language->get('text_views');
|
||||
$data['text_empty'] = $this->language->get('text_empty');
|
||||
$data['text_display'] = $this->language->get('text_display');
|
||||
$data['text_list'] = $this->language->get('text_list');
|
||||
$data['text_grid'] = $this->language->get('text_grid');
|
||||
$data['text_sort'] = $this->language->get('text_sort');
|
||||
$data['text_limit'] = $this->language->get('text_limit');
|
||||
|
||||
$data['text_sort_by'] = $this->language->get('text_sort_by');
|
||||
$data['text_sort_name'] = $this->language->get('text_sort_name');
|
||||
$data['text_sort_date'] = $this->language->get('text_sort_date');
|
||||
$data['text_sort_rated'] = $this->language->get('text_sort_rated');
|
||||
$data['text_sort_viewed'] = $this->language->get('text_sort_viewed');
|
||||
|
||||
$data['button_more'] = $this->language->get('button_more');
|
||||
$data['button_continue'] = $this->language->get('button_continue');
|
||||
|
||||
$data['configblog_review_status'] = $this->config->get('configblog_review_status');
|
||||
|
||||
$data['articles'] = array();
|
||||
|
||||
$article_data = array(
|
||||
'sort' => $sort,
|
||||
'order' => $order,
|
||||
'start' => ($page - 1) * $limit,
|
||||
'limit' => $limit
|
||||
);
|
||||
|
||||
$article_total = $this->model_blog_article->getTotalArticles($article_data);
|
||||
|
||||
$results = $this->model_blog_article->getArticles($article_data);
|
||||
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $this->config->get('configblog_image_article_width'), $this->config->get('configblog_image_article_height'));
|
||||
} else {
|
||||
$image = false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->config->get('configblog_review_status')) {
|
||||
$rating = (int)$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'],
|
||||
'rating' => $rating,
|
||||
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
|
||||
'href' => $this->url->link('blog/article', '&article_id=' . $result['article_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$url .= '&limit=' . $this->request->get['limit'];
|
||||
}
|
||||
|
||||
$data['sorts'] = array();
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_default'),
|
||||
'value' => 'p.sort_order-ASC',
|
||||
'href' => $this->url->link('blog/latest', 'blog_category_id=' . '&sort=p.sort_order&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_name_asc'),
|
||||
'value' => 'pd.name-ASC',
|
||||
'href' => $this->url->link('blog/latest', 'blog_category_id=' . '&sort=pd.name&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_name_desc'),
|
||||
'value' => 'pd.name-DESC',
|
||||
'href' => $this->url->link('blog/latest', 'blog_category_id=' . '&sort=pd.name&order=DESC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_date_asc'),
|
||||
'value' => 'p.date_added-ASC',
|
||||
'href' => $this->url->link('blog/latest', '&sort=p.date_added&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_date_desc'),
|
||||
'value' => 'p.date_added-DESC',
|
||||
'href' => $this->url->link('blog/latest', '&sort=p.date_added&order=DESC' . $url)
|
||||
);
|
||||
|
||||
if ($this->config->get('configblog_review_status')) {
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_rating_desc'),
|
||||
'value' => 'rating-DESC',
|
||||
'href' => $this->url->link('blog/latest', '&sort=rating&order=DESC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_rating_asc'),
|
||||
'value' => 'rating-ASC',
|
||||
'href' => $this->url->link('blog/latest', '&sort=rating&order=ASC' . $url)
|
||||
);
|
||||
}
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_viewed_desc'),
|
||||
'value' => 'p.viewed-DESC',
|
||||
'href' => $this->url->link('blog/latest', '&sort=p.viewed&order=DESC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_viewed_asc'),
|
||||
'value' => 'p.viewed-ASC',
|
||||
'href' => $this->url->link('blog/latest', '&sort=p.viewed&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$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'];
|
||||
}
|
||||
|
||||
$data['limits'] = array();
|
||||
|
||||
$limits = array_unique(array($this->config->get('configblog_article_limit'), 25, 50, 75, 100));
|
||||
|
||||
sort($limits);
|
||||
|
||||
foreach($limits as $value){
|
||||
$data['limits'][] = array(
|
||||
'text' => $value,
|
||||
'value' => $value,
|
||||
'href' => $this->url->link('blog/latest', $url . '&limit=' . $value)
|
||||
);
|
||||
}
|
||||
|
||||
$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'];
|
||||
}
|
||||
|
||||
$pagination = new Pagination();
|
||||
$pagination->total = $article_total;
|
||||
$pagination->page = $page;
|
||||
$pagination->limit = $limit;
|
||||
$pagination->text = $this->language->get('text_pagination');
|
||||
$pagination->url = $this->url->link('blog/latest', $url . '&page={page}');
|
||||
|
||||
$data['pagination'] = $pagination->render();
|
||||
|
||||
$data['article_total'] = $article_total;
|
||||
|
||||
$data['continue'] = $this->url->link('common/home');
|
||||
|
||||
$data['sort'] = $sort;
|
||||
$data['order'] = $order;
|
||||
$data['limit'] = $limit;
|
||||
|
||||
$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('blog/latest', $data));
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -7,18 +7,6 @@ class ControllerBlogMenu extends Controller {
|
||||
|
||||
$this->load->language('blog/menu');
|
||||
|
||||
$configblog_name = $this->config->get('configblog_name');
|
||||
|
||||
if (!empty($configblog_name)) {
|
||||
$data['text_blog'] = $this->config->get('configblog_name');
|
||||
} else {
|
||||
$data['text_blog'] = $this->language->get('text_blog');
|
||||
}
|
||||
|
||||
$data['text_all'] = $this->language->get('text_all');
|
||||
|
||||
$data['blog'] = $this->url->link('blog/latest');
|
||||
|
||||
// Menu
|
||||
$this->load->model('blog/category');
|
||||
|
||||
|
||||
@@ -40,6 +40,20 @@ class ControllerCommonColumnLeft extends Controller {
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if ($route == 'service/category' && isset($this->request->get['service_category_id'])) {
|
||||
$this->load->model('service/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['service_category_id']);
|
||||
|
||||
$layout_id = $this->model_service_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'service/service/info' && isset($this->request->get['service_id'])) {
|
||||
$this->load->model('service/service');
|
||||
|
||||
$layout_id = $this->model_service_service->getServiceLayoutId($this->request->get['service_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,20 @@ class ControllerCommonColumnRight extends Controller {
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if ($route == 'service/category' && isset($this->request->get['service_category_id'])) {
|
||||
$this->load->model('service/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['service_category_id']);
|
||||
|
||||
$layout_id = $this->model_service_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'service/service/info' && isset($this->request->get['service_id'])) {
|
||||
$this->load->model('service/service');
|
||||
|
||||
$layout_id = $this->model_service_service->getServiceLayoutId($this->request->get['service_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,20 @@ class ControllerCommonContentBottom extends Controller {
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if ($route == 'service/category' && isset($this->request->get['service_category_id'])) {
|
||||
$this->load->model('service/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['service_category_id']);
|
||||
|
||||
$layout_id = $this->model_service_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'service/service/info' && isset($this->request->get['service_id'])) {
|
||||
$this->load->model('service/service');
|
||||
|
||||
$layout_id = $this->model_service_service->getServiceLayoutId($this->request->get['service_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,20 @@ class ControllerCommonContentTop extends Controller {
|
||||
$layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
|
||||
}
|
||||
|
||||
if ($route == 'service/category' && isset($this->request->get['service_category_id'])) {
|
||||
$this->load->model('service/category');
|
||||
|
||||
$path = explode('_', (string)$this->request->get['service_category_id']);
|
||||
|
||||
$layout_id = $this->model_service_category->getCategoryLayoutId(end($path));
|
||||
}
|
||||
|
||||
if ($route == 'service/service/info' && isset($this->request->get['service_id'])) {
|
||||
$this->load->model('service/service');
|
||||
|
||||
$layout_id = $this->model_service_service->getServiceLayoutId($this->request->get['service_id']);
|
||||
}
|
||||
|
||||
if (!$layout_id) {
|
||||
$layout_id = $this->model_design_layout->getLayout($route);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
class ControllerServiceCategory extends Controller {
|
||||
public function index() {
|
||||
$this->load->language('service/category');
|
||||
$this->load->model('service/category');
|
||||
$this->load->model('service/service');
|
||||
$this->load->model('tool/image');
|
||||
|
||||
$sort = isset($this->request->get['sort']) ? $this->request->get['sort'] : 'p.date_added';
|
||||
$order = isset($this->request->get['order']) ? $this->request->get['order'] : 'DESC';
|
||||
$page = isset($this->request->get['page']) ? (int)$this->request->get['page'] : 1;
|
||||
$limit = isset($this->request->get['limit']) ? (int)$this->request->get['limit'] : (int)$this->config->get('configblog_article_limit');
|
||||
$service_category_path = isset($this->request->get['service_category_id']) ? (string)$this->request->get['service_category_id'] : '';
|
||||
|
||||
if ($page < 1) {
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
if ($limit < 1) {
|
||||
$limit = 20;
|
||||
}
|
||||
|
||||
$data['breadcrumbs'] = array(
|
||||
array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
)
|
||||
);
|
||||
|
||||
$service_category_id = 0;
|
||||
$path = '';
|
||||
|
||||
foreach (explode('_', $service_category_path) as $path_id) {
|
||||
$path_id = (int)$path_id;
|
||||
|
||||
if (!$path_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$category_info = $this->model_service_category->getCategory($path_id);
|
||||
|
||||
if ($category_info) {
|
||||
$path = $path ? $path . '_' . $path_id : $path_id;
|
||||
$service_category_id = $path_id;
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $category_info['name'],
|
||||
'href' => $this->url->link('service/category', 'service_category_id=' . $path)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$category_info = $this->model_service_category->getCategory($service_category_id);
|
||||
|
||||
if (!$category_info) {
|
||||
return $this->renderNotFound($data);
|
||||
}
|
||||
|
||||
$this->document->setTitle($category_info['meta_title'] ? $category_info['meta_title'] : $category_info['name']);
|
||||
$this->document->setDescription($category_info['meta_description']);
|
||||
$this->document->setKeywords($category_info['meta_keyword']);
|
||||
$this->document->addLink($this->url->link('service/category', 'service_category_id=' . $path), 'canonical');
|
||||
|
||||
if ($category_info['noindex'] <= 0 && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
|
||||
$data['heading_title'] = $category_info['meta_h1'] ? $category_info['meta_h1'] : $category_info['name'];
|
||||
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
|
||||
$data['button_more'] = $this->language->get('button_more');
|
||||
$data['text_empty'] = $this->language->get('text_empty');
|
||||
$data['text_refine'] = $this->language->get('text_refine');
|
||||
|
||||
if ($category_info['image']) {
|
||||
$data['thumb'] = $this->model_tool_image->resize($category_info['image'], $this->config->get('configblog_image_category_width'), $this->config->get('configblog_image_category_height'));
|
||||
} else {
|
||||
$data['thumb'] = '';
|
||||
}
|
||||
|
||||
$data['categories'] = array();
|
||||
|
||||
foreach ($this->model_service_category->getCategories($service_category_id) as $category) {
|
||||
$data['categories'][] = array(
|
||||
'name' => $category['name'],
|
||||
'href' => $this->url->link('service/category', 'service_category_id=' . $path . '_' . $category['service_category_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$filter_data = array(
|
||||
'filter_service_category_id' => $service_category_id,
|
||||
'sort' => $sort,
|
||||
'order' => $order,
|
||||
'start' => ($page - 1) * $limit,
|
||||
'limit' => $limit
|
||||
);
|
||||
|
||||
$service_total = $this->model_service_service->getTotalServices($filter_data);
|
||||
$data['services'] = array();
|
||||
|
||||
foreach ($this->model_service_service->getServices($filter_data) as $service) {
|
||||
if ($service['image']) {
|
||||
$image = $this->model_tool_image->resize($service['image'], $this->config->get('configblog_image_article_width'), $this->config->get('configblog_image_article_height'));
|
||||
} else {
|
||||
$image = false;
|
||||
}
|
||||
|
||||
$data['services'][] = array(
|
||||
'service_id' => $service['service_id'],
|
||||
'thumb' => $image,
|
||||
'name' => $service['name'],
|
||||
'description' => utf8_substr(strip_tags(html_entity_decode($service['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('configblog_article_description_length')) . '..',
|
||||
'href' => $this->url->link('service/service/info', 'service_category_id=' . $path . '&service_id=' . $service['service_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$url = '&service_category_id=' . $path;
|
||||
|
||||
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'];
|
||||
}
|
||||
|
||||
$pagination = new Pagination();
|
||||
$pagination->total = $service_total;
|
||||
$pagination->page = $page;
|
||||
$pagination->limit = $limit;
|
||||
$pagination->url = $this->url->link('service/category', $url . '&page={page}');
|
||||
|
||||
$data['pagination'] = $pagination->render();
|
||||
$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('service/category', $data));
|
||||
}
|
||||
|
||||
private function renderNotFound($data) {
|
||||
$this->document->setTitle($this->language->get('text_error'));
|
||||
$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
|
||||
|
||||
$data['heading_title'] = $this->language->get('text_error');
|
||||
$data['text_error'] = $this->language->get('text_error');
|
||||
$data['button_continue'] = $this->language->get('button_continue');
|
||||
$data['continue'] = $this->url->link('common/home');
|
||||
$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('error/not_found', $data));
|
||||
}
|
||||
}
|
||||
@@ -1,256 +1,6 @@
|
||||
<?php
|
||||
class ControllerServiceService extends Controller {
|
||||
|
||||
public function index() {
|
||||
|
||||
$this->load->language('service/service');
|
||||
|
||||
$this->load->model('service/service');
|
||||
|
||||
$this->load->model('tool/image');
|
||||
|
||||
if ($this->config->get('config_noindex_disallow_params')) {
|
||||
$params = explode ("\r\n", $this->config->get('config_noindex_disallow_params'));
|
||||
if(!empty($params)) {
|
||||
$disallow_params = $params;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->request->get['sort'])) {
|
||||
$sort = $this->request->get['sort'];
|
||||
if (!in_array('sort', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$sort = 'p.date_added';
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->request->get['order'])) {
|
||||
$order = $this->request->get['order'];
|
||||
if (!in_array('order', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$order = 'DESC';
|
||||
}
|
||||
|
||||
if (isset($this->request->get['page'])) {
|
||||
$page = $this->request->get['page'];
|
||||
if (!in_array('page', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$limit = $this->request->get['limit'];
|
||||
if (!in_array('limit', $disallow_params, true) && $this->config->get('config_noindex_status')) {
|
||||
$this->document->setRobots('noindex,follow');
|
||||
}
|
||||
} else {
|
||||
$limit = $this->config->get('configblog_article_limit');
|
||||
}
|
||||
|
||||
$data['heading_title'] = $this->language->get('heading_title');
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/home')
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('service/service')
|
||||
);
|
||||
|
||||
$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['page'])) {
|
||||
$url .= '&page=' . $this->request->get['page'];
|
||||
}
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$url .= '&limit=' . $this->request->get['limit'];
|
||||
}
|
||||
|
||||
$data['text_refine'] = $this->language->get('text_refine');
|
||||
$data['text_views'] = $this->language->get('text_views');
|
||||
$data['text_empty'] = $this->language->get('text_empty');
|
||||
$data['text_display'] = $this->language->get('text_display');
|
||||
$data['text_list'] = $this->language->get('text_list');
|
||||
$data['text_grid'] = $this->language->get('text_grid');
|
||||
$data['text_sort'] = $this->language->get('text_sort');
|
||||
$data['text_limit'] = $this->language->get('text_limit');
|
||||
|
||||
$data['text_sort_by'] = $this->language->get('text_sort_by');
|
||||
$data['text_sort_name'] = $this->language->get('text_sort_name');
|
||||
$data['text_sort_date'] = $this->language->get('text_sort_date');
|
||||
$data['text_sort_viewed'] = $this->language->get('text_sort_viewed');
|
||||
|
||||
$data['button_more'] = $this->language->get('button_more');
|
||||
$data['button_continue'] = $this->language->get('button_continue');
|
||||
|
||||
$data['services'] = array();
|
||||
|
||||
$service_data = array(
|
||||
'sort' => $sort,
|
||||
'order' => $order,
|
||||
'start' => ($page - 1) * $limit,
|
||||
'limit' => $limit
|
||||
);
|
||||
|
||||
$service_total = $this->model_service_service->getTotalServices($service_data);
|
||||
|
||||
$results = $this->model_service_service->getServices($service_data);
|
||||
|
||||
|
||||
foreach ($results as $result) {
|
||||
if ($result['image']) {
|
||||
$image = $this->model_tool_image->resize($result['image'], $this->config->get('configblog_image_article_width'), $this->config->get('configblog_image_article_height'));
|
||||
} else {
|
||||
$image = false;
|
||||
}
|
||||
|
||||
$data['services'][] = array(
|
||||
'service_id' => $result['service_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'],
|
||||
'href' => $this->url->link('service/service/info', '&service_id=' . $result['service_id'])
|
||||
);
|
||||
}
|
||||
|
||||
$url = '';
|
||||
|
||||
if (isset($this->request->get['limit'])) {
|
||||
$url .= '&limit=' . $this->request->get['limit'];
|
||||
}
|
||||
|
||||
$data['sorts'] = array();
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_default'),
|
||||
'value' => 'p.sort_order-ASC',
|
||||
'href' => $this->url->link('service/service', '&sort=p.sort_order&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_name_asc'),
|
||||
'value' => 'pd.name-ASC',
|
||||
'href' => $this->url->link('service/service', '&sort=pd.name&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_name_desc'),
|
||||
'value' => 'pd.name-DESC',
|
||||
'href' => $this->url->link('service/service', '&sort=pd.name&order=DESC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_date_asc'),
|
||||
'value' => 'p.date_added-ASC',
|
||||
'href' => $this->url->link('service/service', '&sort=p.date_added&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_date_desc'),
|
||||
'value' => 'p.date_added-DESC',
|
||||
'href' => $this->url->link('service/service', '&sort=p.date_added&order=DESC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_viewed_desc'),
|
||||
'value' => 'p.viewed-DESC',
|
||||
'href' => $this->url->link('service/service', '&sort=p.viewed&order=DESC' . $url)
|
||||
);
|
||||
|
||||
$data['sorts'][] = array(
|
||||
'text' => $this->language->get('text_viewed_asc'),
|
||||
'value' => 'p.viewed-ASC',
|
||||
'href' => $this->url->link('service/service', '&sort=p.viewed&order=ASC' . $url)
|
||||
);
|
||||
|
||||
$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'];
|
||||
}
|
||||
|
||||
$data['limits'] = array();
|
||||
|
||||
$limits = array_unique(array($this->config->get('configblog_article_limit'), 25, 50, 75, 100));
|
||||
|
||||
sort($limits);
|
||||
|
||||
foreach($limits as $value){
|
||||
$data['limits'][] = array(
|
||||
'text' => $value,
|
||||
'value' => $value,
|
||||
'href' => $this->url->link('service/service', $url . '&limit=' . $value)
|
||||
);
|
||||
}
|
||||
|
||||
$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'];
|
||||
}
|
||||
|
||||
$pagination = new Pagination();
|
||||
$pagination->total = $service_total;
|
||||
$pagination->page = $page;
|
||||
$pagination->limit = $limit;
|
||||
$pagination->text = $this->language->get('text_pagination');
|
||||
$pagination->url = $this->url->link('service/service', $url . '&page={page}');
|
||||
|
||||
$data['pagination'] = $pagination->render();
|
||||
|
||||
$data['service_total'] = $service_total;
|
||||
|
||||
$data['continue'] = $this->url->link('common/home');
|
||||
|
||||
$data['sort'] = $sort;
|
||||
$data['order'] = $order;
|
||||
$data['limit'] = $limit;
|
||||
|
||||
$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('service/service_list', $data));
|
||||
|
||||
}
|
||||
|
||||
public function info() {
|
||||
$this->load->language('service/service');
|
||||
|
||||
@@ -262,11 +12,6 @@ class ControllerServiceService extends Controller {
|
||||
'separator' => false
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('service/service')
|
||||
);
|
||||
|
||||
if (isset($this->request->get['service_id'])) {
|
||||
$service_id = (int)$this->request->get['service_id'];
|
||||
} else {
|
||||
@@ -274,13 +19,31 @@ class ControllerServiceService extends Controller {
|
||||
}
|
||||
|
||||
$this->load->model('service/service');
|
||||
$this->load->model('service/category');
|
||||
|
||||
$service_info = $this->model_service_service->getService($service_id);
|
||||
|
||||
if ($service_info) {
|
||||
$service_category_path = $this->model_service_category->getPathByService($service_id);
|
||||
$path = '';
|
||||
|
||||
foreach (explode('_', $service_category_path) as $service_category_id) {
|
||||
$service_category_id = (int)$service_category_id;
|
||||
$category_info = $this->model_service_category->getCategory($service_category_id);
|
||||
|
||||
if ($category_info) {
|
||||
$path = $path ? $path . '_' . $service_category_id : $service_category_id;
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $category_info['name'],
|
||||
'href' => $this->url->link('service/category', 'service_category_id=' . $path)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $service_info['name'],
|
||||
'href' => $this->url->link('service/service/info', 'service_id=' . $this->request->get['service_id'])
|
||||
'href' => $this->url->link('service/service/info', 'service_category_id=' . $service_category_path . '&service_id=' . $this->request->get['service_id'])
|
||||
);
|
||||
|
||||
if ($service_info['meta_title']) {
|
||||
@@ -295,7 +58,7 @@ class ControllerServiceService extends Controller {
|
||||
|
||||
$this->document->setDescription($service_info['meta_description']);
|
||||
$this->document->setKeywords($service_info['meta_keyword']);
|
||||
$this->document->addLink($this->url->link('service/service/info', 'service_id=' . $this->request->get['service_id']), 'canonical');
|
||||
$this->document->addLink($this->url->link('service/service/info', 'service_category_id=' . $service_category_path . '&service_id=' . $this->request->get['service_id']), 'canonical');
|
||||
|
||||
if ($service_info['meta_h1']) {
|
||||
$data['heading_title'] = $service_info['meta_h1'];
|
||||
@@ -329,7 +92,7 @@ class ControllerServiceService extends Controller {
|
||||
'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'],
|
||||
'href' => $this->url->link('service/service/info', 'service_id=' . $result['service_id']),
|
||||
'href' => $this->url->link('service/service/info', 'service_category_id=' . $this->model_service_category->getPathByService($result['service_id']) . '&service_id=' . $result['service_id']),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,3 @@
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
// Text
|
||||
$_['text_blog'] = 'Блог';
|
||||
$_['text_all'] = 'Смотреть Весь';
|
||||
+5
-7
@@ -2,17 +2,16 @@
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
// Heading
|
||||
$_['heading_title'] = 'Блог';
|
||||
|
||||
// Text
|
||||
$_['text_product'] = 'Статьи';
|
||||
$_['text_service'] = 'Услуги';
|
||||
$_['text_refine'] = 'Выберите подкатегорию';
|
||||
$_['text_product'] = 'Услуги';
|
||||
$_['text_error'] = 'Категория не найдена!';
|
||||
$_['text_empty'] = 'В этой категории нет услуг.';
|
||||
$_['text_display'] = 'Вид:';
|
||||
$_['text_sort'] = 'Сортировка:';
|
||||
$_['text_limit'] = 'На странице:';
|
||||
$_['text_sort_date'] = 'дате';
|
||||
$_['text_list'] = 'списком';
|
||||
$_['text_grid'] = 'таблицей';
|
||||
$_['text_sort_by'] = 'Сортировать по:';
|
||||
$_['text_sort_name'] = 'названию';
|
||||
$_['text_sort_rated'] = 'рейтингу';
|
||||
@@ -27,7 +26,6 @@ $_['text_rating_desc'] = 'Рейтингу (по убыванию)';
|
||||
$_['text_name_asc'] = 'Названию (по возрастанию)';
|
||||
$_['text_name_desc'] = 'Названию (по убыванию)';
|
||||
$_['text_default'] = 'По умолчанию';
|
||||
$_['text_empty'] = 'В блоге нет записей.';
|
||||
|
||||
$_['button_more'] = 'подробнее';
|
||||
?>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
class ModelServiceCategory extends Model {
|
||||
public function getCategory($service_category_id) {
|
||||
return $this->getCategories((int)$service_category_id, 'by_id');
|
||||
}
|
||||
|
||||
public function getCategories($id = 0, $type = 'by_parent') {
|
||||
static $data = null;
|
||||
|
||||
if ($data === null) {
|
||||
$data = array();
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category c LEFT JOIN " . DB_PREFIX . "service_category_description cd ON (c.service_category_id = cd.service_category_id) LEFT JOIN " . DB_PREFIX . "service_category_to_store c2s ON (c.service_category_id = c2s.service_category_id) WHERE cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND c.status = '1' ORDER BY c.parent_id, c.sort_order, cd.name");
|
||||
|
||||
foreach ($query->rows as $row) {
|
||||
$data['by_id'][$row['service_category_id']] = $row;
|
||||
$data['by_parent'][$row['parent_id']][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return ((isset($data[$type]) && isset($data[$type][$id])) ? $data[$type][$id] : array());
|
||||
}
|
||||
|
||||
public function getCategoriesByParentId($service_category_id) {
|
||||
$category_data = array();
|
||||
|
||||
$categories = $this->getCategories((int)$service_category_id);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$category_data[] = $category['service_category_id'];
|
||||
|
||||
$children = $this->getCategoriesByParentId($category['service_category_id']);
|
||||
|
||||
if ($children) {
|
||||
$category_data = array_merge($children, $category_data);
|
||||
}
|
||||
}
|
||||
|
||||
return $category_data;
|
||||
}
|
||||
|
||||
public function getCategoryLayoutId($service_category_id) {
|
||||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "service_category_to_layout WHERE service_category_id = '" . (int)$service_category_id . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
|
||||
|
||||
if ($query->num_rows) {
|
||||
return $query->row['layout_id'];
|
||||
} else {
|
||||
return $this->config->get('config_layout_category');
|
||||
}
|
||||
}
|
||||
|
||||
public function getPathByService($service_id) {
|
||||
$query = $this->db->query("SELECT GROUP_CONCAT(cp.path_id ORDER BY cp.level SEPARATOR '_') AS path FROM " . DB_PREFIX . "service_to_category s2c LEFT JOIN " . DB_PREFIX . "service_category_path cp ON (s2c.service_category_id = cp.service_category_id) WHERE s2c.service_id = '" . (int)$service_id . "'");
|
||||
|
||||
return $query->num_rows ? $query->row['path'] : '';
|
||||
}
|
||||
|
||||
public function getTotalCategoriesByCategoryId($parent_id = 0) {
|
||||
return count($this->getCategories((int)$parent_id));
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -49,8 +49,16 @@ class ModelServiceService extends Model {
|
||||
if (!$service_data) {
|
||||
$sql = "SELECT p.service_id FROM " . DB_PREFIX . "service p LEFT JOIN " . DB_PREFIX . "service_description pd ON (p.service_id = pd.service_id) LEFT JOIN " . DB_PREFIX . "service_to_store p2s ON (p.service_id = p2s.service_id)";
|
||||
|
||||
if (!empty($data['filter_service_category_id'])) {
|
||||
$sql .= " LEFT JOIN " . DB_PREFIX . "service_to_category s2c ON (p.service_id = s2c.service_id)";
|
||||
}
|
||||
|
||||
$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
|
||||
|
||||
if (!empty($data['filter_service_category_id'])) {
|
||||
$sql .= " AND s2c.service_category_id = '" . (int)$data['filter_service_category_id'] . "'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY p.service_id";
|
||||
|
||||
$sort_data = array(
|
||||
@@ -208,8 +216,16 @@ class ModelServiceService extends Model {
|
||||
if (!$service_data) {
|
||||
$sql = "SELECT COUNT(DISTINCT p.service_id) AS total FROM " . DB_PREFIX . "service p LEFT JOIN " . DB_PREFIX . "service_description pd ON (p.service_id = pd.service_id) LEFT JOIN " . DB_PREFIX . "service_to_store p2s ON (p.service_id = p2s.service_id)";
|
||||
|
||||
if (!empty($data['filter_service_category_id'])) {
|
||||
$sql .= " LEFT JOIN " . DB_PREFIX . "service_to_category s2c ON (p.service_id = s2c.service_id)";
|
||||
}
|
||||
|
||||
$sql .= " WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";
|
||||
|
||||
if (!empty($data['filter_service_category_id'])) {
|
||||
$sql .= " AND s2c.service_category_id = '" . (int)$data['filter_service_category_id'] . "'";
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
$service_data = $query->row['total'];
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
{{ header }}
|
||||
<div class="container">
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="row">{{ column_left }}
|
||||
{% if column_left and column_right %}
|
||||
{% set class = 'col-sm-6' %}
|
||||
{% elseif column_left or column_right %}
|
||||
{% set class = 'col-sm-9' %}
|
||||
{% else %}
|
||||
{% set class = 'col-sm-12' %}
|
||||
{% endif %}
|
||||
<div id="content" class="{{ class }} showcase-list">{{ content_top }}
|
||||
<h1>{{ heading_title }}</h1>
|
||||
{% if articles %}
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="btn-group">
|
||||
<button type="button" id="list-view" class="btn btn-default" data-toggle="tooltip" title="{{ text_list }}"><i class="fa fa-th-list"></i></button>
|
||||
<button type="button" id="grid-view" class="btn btn-default" data-toggle="tooltip" title="{{ text_grid }}"><i class="fa fa-th"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1 col-sm-offset-2 text-right">
|
||||
<label class="control-label" for="input-sort">{{ text_sort }}</label>
|
||||
</div>
|
||||
<div class="col-sm-3 text-right">
|
||||
<select id="input-sort" class="form-control" onchange="location = this.value;">
|
||||
{% for sorts in sorts %}
|
||||
{% if sorts.value == '%s-%s'|format(sort, order) %}
|
||||
<option value="{{ sorts.href }}" selected="selected">{{ sorts.text }}</option>
|
||||
{% else %}
|
||||
<option value="{{ sorts.href }}">{{ sorts.text }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1 text-right">
|
||||
<label class="control-label" for="input-limit">{{ text_limit }}</label>
|
||||
</div>
|
||||
<div class="col-sm-2 text-right">
|
||||
<select id="input-limit" class="form-control" onchange="location = this.value;">
|
||||
{% for limits in limits %}
|
||||
{% if limits.value == limit %}
|
||||
<option value="{{ limits.href }}" selected="selected">{{ limits.text }}</option>
|
||||
{% else %}
|
||||
<option value="{{ limits.href }}">{{ limits.text }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
{% for article in articles %}
|
||||
<div class="product-layout product-list col-xs-12">
|
||||
<div class="product-thumb">
|
||||
<div class="image"><a href="{{ article['href'] }}"><img src="{{ article['thumb'] }}" alt="{{ article['name'] }}" title="{{ article['name'] }}" class="img-responsive" /></a></div>
|
||||
<div class="caption">
|
||||
<h4><a href="{{ article['href'] }}">{{ article['name'] }}</a></h4>
|
||||
<p class="description">{{ article['description'] }}</p>
|
||||
{% if configblog_review_status %}
|
||||
{% if article.rating %}
|
||||
<div class="rating"> {% for i in 1..5 %}
|
||||
{% if article.rating < i %} <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span> {% else %} <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>{% endif %}
|
||||
{% endfor %} </div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="button-group">
|
||||
<button type="button" onclick="location.href = ('{{ article.href }}');"><i class="fa fa-share"></i> <span class="hidden-xs hidden-sm hidden-md">{{ button_more }}</span></button>
|
||||
<button type="button" data-toggle="tooltip" title="{{ article.date_added }}" "><i class="fa fa-clock-o"></i></button>
|
||||
<button type="button" data-toggle="tooltip" title="{{ text_views }} {{ article.viewed }}" "><i class="fa fa-eye"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 text-left">{{ pagination }}</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{{ text_empty }}</p>
|
||||
<div class="buttons">
|
||||
<div class="pull-right"><a href="{{ continue }}" class="btn btn-primary">{{ button_continue }}</a></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ content_bottom }}</div>
|
||||
{{ column_right }}</div>
|
||||
</div>
|
||||
{{ footer }}
|
||||
@@ -0,0 +1,56 @@
|
||||
{{ header }}
|
||||
{{ content_top }}
|
||||
<section class="section py-5">
|
||||
<div class="container-fluid">
|
||||
<ul class="breadcrumb">
|
||||
{% for key,breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a>{% if key + 1 < breadcrumbs|length %}<span class="mx-2">•</span>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<div class="content">
|
||||
{% if thumb or description %}
|
||||
<div class="row">
|
||||
{% if thumb %}
|
||||
<div class="col-sm-2"><img src="{{ thumb }}" alt="{{ heading_title }}" title="{{ heading_title }}" class="img-thumbnail" /></div>
|
||||
{% endif %}
|
||||
{% if description %}
|
||||
<div class="col-sm-10">{{ description }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<hr>
|
||||
{% endif %}
|
||||
{% if categories %}
|
||||
<h3>{{ text_refine }}</h3>
|
||||
<ul>
|
||||
{% for category in categories %}
|
||||
<li><a href="{{ category.href }}">{{ category.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if services %}
|
||||
<div class="row g-3">
|
||||
{% for service in services %}
|
||||
<div class="col-md-4 col-lg-3 col-sm-6">
|
||||
<div class="product-thumb">
|
||||
{% if service.thumb %}
|
||||
<div class="image"><a href="{{ service.href }}"><img src="{{ service.thumb }}" alt="{{ service.name }}" title="{{ service.name }}" class="img-responsive" /></a></div>
|
||||
{% endif %}
|
||||
<div class="caption">
|
||||
<h4><a href="{{ service.href }}">{{ service.name }}</a></h4>
|
||||
<p class="description">{{ service.description }}</p>
|
||||
</div>
|
||||
<div><a href="{{ service.href }}" class="btn btn-dark">{{ button_more }}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% elseif not categories %}
|
||||
<p>{{ text_empty }}</p>
|
||||
{% endif %}
|
||||
{{ pagination }}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{ content_bottom }}
|
||||
{{ footer }}
|
||||
@@ -1,38 +0,0 @@
|
||||
{{ header }}
|
||||
{{ content_top }}
|
||||
<section class="section py-5">
|
||||
<div class="container-fluid">
|
||||
<ul class="breadcrumb">
|
||||
{% for key,breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a>{% if key + 1 < breadcrumbs|length %}<span class="mx-2">•</span>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<div class="content">
|
||||
{% if services %}
|
||||
<div class="row g-3">
|
||||
{% for service in services %}
|
||||
<div class="col-md-4 col-lg-3 col-sm-6">
|
||||
<div class="product-thumb">
|
||||
<div class="image"><a href="{{ service.href }}"><img src="{{ service.thumb }}" alt="{{ service.name }}" title="{{ service.name }}" class="img-responsive" /></a></div>
|
||||
<div class="caption">
|
||||
<h4><a href="{{ service.href }}">{{ service.name }}</a></h4>
|
||||
<p class="description">{{ service['description'] }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<a href="{{ service.href }}" class="btn btn-dark">{{ button_more }}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{{ text_empty }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{ content_bottom }}
|
||||
{{ footer }}
|
||||
@@ -67,7 +67,7 @@ class SeoPro {
|
||||
|
||||
if(!empty($url[0])) {
|
||||
|
||||
if(!in_array($url[0], ['category_id', 'product_id', 'manufacturer_id', 'information_id', 'article_id', 'blog_category_id', 'service_id'])) {
|
||||
if(!in_array($url[0], ['category_id', 'product_id', 'manufacturer_id', 'information_id', 'article_id', 'blog_category_id', 'service_category_id', 'service_id'])) {
|
||||
return $parts;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,12 @@ class SeoPro {
|
||||
} else {
|
||||
$this->request->get['blog_category_id'] .= '_' . $url[1];
|
||||
}
|
||||
} elseif ($url[0] == 'service_category_id') {
|
||||
if (!isset($this->request->get['service_category_id'])) {
|
||||
$this->request->get['service_category_id'] = $url[1];
|
||||
} else {
|
||||
$this->request->get['service_category_id'] .= '_' . $url[1];
|
||||
}
|
||||
} elseif (count($url) > 1) {
|
||||
$this->request->get[$url[0]] = $url[1];
|
||||
}
|
||||
@@ -128,7 +134,14 @@ class SeoPro {
|
||||
|
||||
//services
|
||||
if (isset($this->request->get['service_id'])) {
|
||||
if(isset($this->request->get['service_category_id'])) {
|
||||
unset($this->request->get['service_category_id']);
|
||||
};
|
||||
$service_category_path = $this->getServicePathByService($this->request->get['service_id']);
|
||||
if ($service_category_path) $this->request->get['service_category_id'] = $service_category_path;
|
||||
$this->request->get['route'] = 'service/service/info';
|
||||
} elseif (isset($this->request->get['service_category_id'])) {
|
||||
$this->request->get['route'] = 'service/category';
|
||||
}
|
||||
//end services
|
||||
|
||||
@@ -225,14 +238,32 @@ class SeoPro {
|
||||
case 'service/service/info':
|
||||
if (isset($data['service_id'])) {
|
||||
$route = 'service/service/info';
|
||||
$service_path = '';
|
||||
$service_id = $data['service_id'];
|
||||
|
||||
if (isset($data['service_category_id']) || $this->config->get('config_seo_url_include_path')) {
|
||||
$service_path = $this->getServicePathByService($service_id);
|
||||
}
|
||||
|
||||
unset($data);
|
||||
$data['route'] = $route;
|
||||
|
||||
if ($service_path && $this->config->get('config_seo_url_include_path')) {
|
||||
$data['service_category_id'] = $service_path;
|
||||
}
|
||||
|
||||
$data['service_id'] = $service_id;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'service/category':
|
||||
if (isset($data['service_category_id'])) {
|
||||
$service_category = explode('_', $data['service_category_id']);
|
||||
$service_category = end($service_category);
|
||||
$data['service_category_id'] = $this->getServicePathByCategory($service_category);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'product/category':
|
||||
if (isset($data['path'])) {
|
||||
$category = explode('_', $data['path']);
|
||||
@@ -314,6 +345,13 @@ class SeoPro {
|
||||
$postfix = true;
|
||||
unset($data[$key]);
|
||||
break;
|
||||
case 'service_category_id':
|
||||
$service_categories = explode('_', $value);
|
||||
foreach ($service_categories as $service_category_id) {
|
||||
$queries[] = 'service_category_id=' . (int)$service_category_id;
|
||||
}
|
||||
unset($data[$key]);
|
||||
break;
|
||||
//end services
|
||||
case 'path':
|
||||
$categories = explode('_', $value);
|
||||
@@ -695,6 +733,52 @@ class SeoPro {
|
||||
return $blog_path[$blog_category_id];
|
||||
}
|
||||
|
||||
private function getServicePathByService($service_id) {
|
||||
|
||||
if ($service_id < 1)
|
||||
return false;
|
||||
|
||||
$query = $this->db->query("SELECT service_category_id FROM " . DB_PREFIX . "service_to_category WHERE service_id = '" . (int)$service_id . "' LIMIT 1");
|
||||
|
||||
return $this->getServicePathByCategory($query->num_rows ? (int)$query->row['service_category_id'] : 0);
|
||||
}
|
||||
|
||||
private function getServicePathByCategory($service_category_id) {
|
||||
$service_category_id = (int)$service_category_id;
|
||||
if ($service_category_id < 1)
|
||||
return false;
|
||||
|
||||
static $service_path = [];
|
||||
$cache = 'seopro.service_category.seopath';
|
||||
|
||||
if (!is_array($service_path)) {
|
||||
if ($this->config->get('config_seo_url_cache'))
|
||||
$service_path = $this->cache->get($cache);
|
||||
if (!is_array($service_path))
|
||||
$service_path = [];
|
||||
}
|
||||
|
||||
if (!isset($service_path[$service_category_id])) {
|
||||
$max_level = 10;
|
||||
$sql = "SELECT CONCAT_WS('_'";
|
||||
for ($i = $max_level-1; $i >= 0; --$i) {
|
||||
$sql .= ",t$i.service_category_id";
|
||||
}
|
||||
$sql .= ") AS path FROM " . DB_PREFIX . "service_category t0";
|
||||
for ($i = 1; $i < $max_level; ++$i) {
|
||||
$sql .= " LEFT JOIN " . DB_PREFIX . "service_category t$i ON (t$i.service_category_id = t" . ($i-1) . ".parent_id)";
|
||||
}
|
||||
$sql .= " WHERE t0.service_category_id = '" . $service_category_id . "'";
|
||||
$query = $this->db->query($sql);
|
||||
$service_path[$service_category_id] = $query->num_rows ? $query->row['path'] : false;
|
||||
|
||||
if ($this->config->get('config_seo_url_cache'))
|
||||
$this->cache->set($cache, $service_path);
|
||||
}
|
||||
|
||||
return $service_path[$service_category_id];
|
||||
}
|
||||
|
||||
private function strpos_offset($needle, $haystack, $occurrence) {
|
||||
// explode the haystack
|
||||
$arr = explode($needle, $haystack);
|
||||
@@ -728,4 +812,4 @@ class SeoPro {
|
||||
$this->cache->set('seopro.product_categories', $this->product_categories);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user