opti front

This commit is contained in:
ToutPratique 2016-12-20 10:32:01 +01:00
parent 8f778fc0c0
commit 04ea7159ac
4 changed files with 9 additions and 7 deletions

View File

@ -21,6 +21,7 @@ class CategoryCmsControllerCore extends FrontController
$id_category_cms = Tools::getValue('id_category_cms', 0); $id_category_cms = Tools::getValue('id_category_cms', 0);
$this->categorycms = new CmsPsCategory($id_category_cms, $this->context->language->id); $this->categorycms = new CmsPsCategory($id_category_cms, $this->context->language->id);
if (!Validate::isLoadedObject($this->categorycms) if (!Validate::isLoadedObject($this->categorycms)
|| !$this->categorycms->active) { || !$this->categorycms->active) {
header('HTTP/1.1 404 Not Found'); header('HTTP/1.1 404 Not Found');
@ -37,6 +38,7 @@ class CategoryCmsControllerCore extends FrontController
$this->page = Tools::getValue('page', 1); $this->page = Tools::getValue('page', 1);
// Filter et orderBy // Filter et orderBy
$filter_by = Tools::getValue('filter_by', ''); $filter_by = Tools::getValue('filter_by', '');
$this->order_by = Tools::getValue('order_by'); $this->order_by = Tools::getValue('order_by');
@ -71,9 +73,10 @@ class CategoryCmsControllerCore extends FrontController
$rootCategory = CmsPsCategory::getRootCategory($this->categorycms->id); $rootCategory = CmsPsCategory::getRootCategory($this->categorycms->id);
$bestsTips = $rootCategory->getArticles($id_lang, 4, 1, FALSE, 'note'); // $bestsTips = $rootCategory->getArticles($id_lang, 4, 1, FALSE, 'note');
// get all and exclude bestTips // get all and exclude bestTips
$all_articles = $rootCategory->getArticles($id_lang, 999999, 1, FALSE, 'note'); $all_articles = $rootCategory->getArticles($id_lang, 999999, 1, FALSE, 'note', '', false);
$bestsTips = array_slice($all_articles, 0, 4);
$all_articles = array_slice($all_articles, 4, sizeof($all_articles)); $all_articles = array_slice($all_articles, 4, sizeof($all_articles));
$child_categories = $this->categorycms->getChildren($id_lang); $child_categories = $this->categorycms->getChildren($id_lang);

View File

@ -32,7 +32,6 @@ class PostEditoControllerCore extends FrontController
$product_relation = $this->postedito->getProductRelation($id_lang); $product_relation = $this->postedito->getProductRelation($id_lang);
$last_editos = CmsPsEdito::getAllEditos($id_lang, 10, 1); $last_editos = CmsPsEdito::getAllEditos($id_lang, 10, 1);
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'product_relation' => $product_relation, 'product_relation' => $product_relation,
'last_editos' => $last_editos, 'last_editos' => $last_editos,

View File

@ -163,7 +163,7 @@ class CmsPsCategory extends ObjectModel {
return array(); return array();
} }
public function getArticles($id_lang, $limit = 10, $num_page, $total = FALSE, $order_by = 'date_add', $filter_word = '') public function getArticles($id_lang, $limit = 10, $num_page, $total = FALSE, $order_by = 'date_add', $filter_word = '', $injects = true)
{ {
$collection_post = new Collection('CmsPsPost', $id_lang); $collection_post = new Collection('CmsPsPost', $id_lang);
$collection_post->where('id_category', '=', $this->id_category); $collection_post->where('id_category', '=', $this->id_category);
@ -181,7 +181,8 @@ class CmsPsCategory extends ObjectModel {
} }
$articles = $collection_post->getResults(); $articles = $collection_post->getResults();
return CmsPsPost::injectsData($articles, TRUE);
return CmsPsPost::injectsData($articles, $injects);
} }

View File

@ -122,7 +122,6 @@ class CmsPsPost extends ObjectModel {
if(!$array) { if(!$array) {
return $articles[0]; return $articles[0];
} }
return $articles; return $articles;
} }