Категории услуг и удаление latest из блога
This commit is contained in:
@@ -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']),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user