-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ad1bde
commit 484a183
Showing
9 changed files
with
395 additions
and
264 deletions.
There are no files selected for viewing
381 changes: 199 additions & 182 deletions
381
catalog/controller/extension/d_vuefront/blog/post.php
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
171 changes: 94 additions & 77 deletions
171
catalog/controller/extension/d_vuefront/common/page.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,94 @@ | ||
<?php | ||
|
||
class ControllerExtensionDVuefrontCommonPage extends Controller | ||
{ | ||
private $codename = "d_vuefront"; | ||
|
||
public function get($args) | ||
{ | ||
$this->load->model('extension/'.$this->codename.'/page'); | ||
$information_info = $this->model_extension_d_vuefront_page->getPage($args['id']); | ||
$category_keyword = $this->model_extension_d_vuefront_page->getPageKeyword($args['id']); | ||
|
||
if (!empty($category_keyword['keyword'])) { | ||
$keyword = $category_keyword['keyword']; | ||
} else { | ||
$keyword = ''; | ||
} | ||
|
||
return array( | ||
'id' => $information_info['information_id'], | ||
'title' => $information_info['title'], | ||
'name' => $information_info['title'], | ||
'description' => html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8'), | ||
'sort_order' => (int)$information_info['sort_order'], | ||
'meta' => array( | ||
'title' => html_entity_decode($information_info['meta_title'], ENT_QUOTES, 'UTF-8'), | ||
'description' => html_entity_decode($information_info['meta_description'], ENT_QUOTES, 'UTF-8'), | ||
'keyword' => html_entity_decode($information_info['meta_keyword'], ENT_QUOTES, 'UTF-8') | ||
), | ||
'keyword' => $keyword | ||
); | ||
} | ||
|
||
public function getList($args) | ||
{ | ||
$this->load->model('extension/'.$this->codename.'/page'); | ||
|
||
if (in_array($args['sort'], array('sort_order', 'title'))) { | ||
$args['sort'] = 'i.' . $args['sort']; | ||
} elseif (in_array($args['sort'], array('name'))) { | ||
$args['sort'] = 'id.' . $args['sort']; | ||
} | ||
|
||
$posts = array(); | ||
|
||
$filter_data = array( | ||
'sort' => $args['sort'], | ||
'order' => $args['order'], | ||
'start' => ($args['page'] - 1) * $args['size'], | ||
'limit' => $args['size'] | ||
); | ||
|
||
if (!empty($args['search'])) { | ||
$filter_data['filter_title'] = $args['search']; | ||
$filter_data['filter_description'] = $args['search']; | ||
} | ||
|
||
$page_total = $this->model_extension_d_vuefront_page->getTotalPages($filter_data); | ||
|
||
$results = $this->model_extension_d_vuefront_page->getPages($filter_data); | ||
|
||
foreach ($results as $result) { | ||
$posts[] = $this->get(array('id' => $result['information_id'])); | ||
} | ||
|
||
return array( | ||
'content' => $posts, | ||
'first' => $args['page'] === 1, | ||
'last' => $args['page'] === ceil($page_total / $args['size']), | ||
'number' => (int)$args['page'], | ||
'numberOfElements' => count($posts), | ||
'size' => (int)$args['size'], | ||
'totalPages' => (int)ceil($page_total / $args['size']), | ||
'totalElements' => (int)$page_total, | ||
); | ||
} | ||
} | ||
<?php | ||
|
||
class ControllerExtensionDVuefrontCommonPage extends Controller | ||
{ | ||
private $codename = "d_vuefront"; | ||
|
||
public function get($args) | ||
{ | ||
$this->load->model('extension/'.$this->codename.'/page'); | ||
$information_info = $this->model_extension_d_vuefront_page->getPage($args['id']); | ||
$category_keyword = $this->model_extension_d_vuefront_page->getPageKeyword($args['id']); | ||
|
||
if (!empty($category_keyword['keyword'])) { | ||
$keyword = $category_keyword['keyword']; | ||
} else { | ||
$keyword = ''; | ||
} | ||
|
||
return array( | ||
'id' => $information_info['information_id'], | ||
'title' => $information_info['title'], | ||
'name' => $information_info['title'], | ||
'description' => html_entity_decode($information_info['description'], ENT_QUOTES, 'UTF-8'), | ||
'sort_order' => (int)$information_info['sort_order'], | ||
'meta' => array( | ||
'title' => html_entity_decode($information_info['meta_title'], ENT_QUOTES, 'UTF-8'), | ||
'description' => html_entity_decode($information_info['meta_description'], ENT_QUOTES, 'UTF-8'), | ||
'keyword' => html_entity_decode($information_info['meta_keyword'], ENT_QUOTES, 'UTF-8') | ||
), | ||
'keyword' => $keyword, | ||
'url' => $this->vfload->resolver('common/page/url') | ||
); | ||
} | ||
|
||
public function getList($args) | ||
{ | ||
$this->load->model('extension/'.$this->codename.'/page'); | ||
|
||
if (in_array($args['sort'], array('sort_order', 'title'))) { | ||
$args['sort'] = 'i.' . $args['sort']; | ||
} elseif (in_array($args['sort'], array('name'))) { | ||
$args['sort'] = 'id.' . $args['sort']; | ||
} | ||
|
||
$posts = array(); | ||
|
||
$filter_data = array( | ||
'sort' => $args['sort'], | ||
'order' => $args['order'], | ||
'start' => ($args['page'] - 1) * $args['size'], | ||
'limit' => $args['size'] | ||
); | ||
|
||
if (!empty($args['search'])) { | ||
$filter_data['filter_title'] = $args['search']; | ||
$filter_data['filter_description'] = $args['search']; | ||
} | ||
|
||
$page_total = $this->model_extension_d_vuefront_page->getTotalPages($filter_data); | ||
|
||
$results = $this->model_extension_d_vuefront_page->getPages($filter_data); | ||
|
||
foreach ($results as $result) { | ||
$posts[] = $this->get(array('id' => $result['information_id'])); | ||
} | ||
|
||
return array( | ||
'content' => $posts, | ||
'first' => $args['page'] === 1, | ||
'last' => $args['page'] === ceil($page_total / $args['size']), | ||
'number' => (int)$args['page'], | ||
'numberOfElements' => count($posts), | ||
'size' => (int)$args['size'], | ||
'totalPages' => (int)ceil($page_total / $args['size']), | ||
'totalElements' => (int)$page_total, | ||
); | ||
} | ||
|
||
public function url($data) | ||
{ | ||
$page_info = $data['parent']; | ||
$result = $data['args']['url']; | ||
|
||
$result = str_replace("_id", $page_info['id'], $result); | ||
$result = str_replace("_name", $page_info['name'], $result); | ||
|
||
|
||
if ($page_info['keyword']) { | ||
$result = '/'.$page_info['keyword']; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
class ModelExtensionDVuefrontSeo extends Model | ||
{ | ||
public function searchKeyword($keyword) { | ||
$type = ''; | ||
$id = 0; | ||
if(VERSION >= '3.0.0.0') { | ||
$parts = explode('/', preg_replace("/^\//", "", $keyword)); | ||
|
||
// remove any empty arrays from trailing | ||
if (utf8_strlen(end($parts)) == 0) { | ||
array_pop($parts); | ||
} | ||
|
||
foreach ($parts as $part) { | ||
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE keyword = '" . $this->db->escape($part) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'"); | ||
|
||
if ($query->num_rows) { | ||
$url = explode('=', $query->row['query']); | ||
|
||
if ($url[0] == 'product_id') { | ||
$type = 'product'; | ||
$id = $url[1]; | ||
} | ||
|
||
if ($url[0] == 'category_id') { | ||
$type = 'category'; | ||
$id = $url[1]; | ||
} | ||
|
||
if ($url[0] == 'manufacturer_id') { | ||
$type = 'manufacturer'; | ||
$id = $url[1]; | ||
} | ||
|
||
if ($url[0] == 'information_id') { | ||
$type = 'page'; | ||
$id = $url[1]; | ||
} | ||
} else { | ||
break; | ||
} | ||
} | ||
} else { | ||
// $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` LIKE 'product_id=".(int)$product_id."'"); | ||
} | ||
|
||
return array( | ||
'type' => $type, | ||
'id' => $id, | ||
'url' => $keyword | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters