Select content

This commit is contained in:
Michael RICOIS 2017-11-08 09:50:45 +01:00
parent 4573467338
commit 5b6adf98f0
2 changed files with 9 additions and 10 deletions

View File

@ -12,7 +12,7 @@ class CategoryController extends FrontController
$id_lang = self::$cookie->id_lang;
$id_category = Tools::getValue('cid', 0);
$id_subcategory = Tools::getValue('subcid', 0);
$id_subcategory = Tools::getValue('sid', 0);
$categories = array();
@ -57,14 +57,13 @@ class CategoryController extends FrontController
" ORDER BY position DESC LIMIT 1";
$subcategories = Db::getInstance()->ExecuteS($sql);
}
}
self::$smarty->assign(array(
'path' => 'Guide',
'id_category' => $id_category,
'categories' => $categories,
));
}
// displayContent

View File

@ -6,8 +6,8 @@ class ContentController extends FrontController
parent::process();
$id_lang = self::$cookie->id_lang;
$id_category = Tools::getValue('cid', 0); //@todo : Aller chercher la category
$id_subcategory = Tools::getValue('subcid', 0); // @todo : Aller chercher la category
$id_category = Tools::getValue('cid', 0);
$id_subcategory = Tools::getValue('sid', 0);
$id_post = Tools::getValue('id', 0);
// Main category
@ -28,8 +28,7 @@ class ContentController extends FrontController
else {
$sql = "SELECT * FROM ps_guide_category gc, ps_guide_category_lang gcl
WHERE gc.active=1 AND gc.id_guide_category=gcl.id_guide_category
AND gc.id_parent=".$id_category." AND gc.id_guide_category=".$id_category.
" AND gcl.id_lang=".$id_lang;
AND gc.id_guide_category=".$id_subcategory." AND gcl.id_lang=".$id_lang;
$subcategories = Db::getInstance()->getRow($sql);
}
@ -37,7 +36,7 @@ class ContentController extends FrontController
if ($id_post == 0) {
$sql = "SELECT * FROM ps_guide_post gp, ps_guide_post_lang gpl
WHERE gp.active=1 AND gp.id_guide_post=gpl.id_guide_post
AND gp.id_guide_category=".$id_category.
AND gp.id_guide_category=".$subcategories['id_guide_category'].
" AND gpl.id_lang=".$id_lang." ORDER BY position ASC";
$content = Db::getInstance()->getRow($sql);
}
@ -45,12 +44,13 @@ class ContentController extends FrontController
else {
$sql = "SELECT * FROM ps_guide_post gp, ps_guide_post_lang gpl
WHERE gp.active=1 AND gp.id_guide_post=gpl.id_guide_post
AND gp.id_guide_category=".$id_category." AND gp.id_guide_post=".$id_post.
AND gp.id_guide_category=".$subcategories['id_guide_category']." AND gp.id_guide_post=".$id_post.
" AND gpl.id_lang=".$id_lang;
$content = Db::getInstance()->getRow($sql);
}
self::$smarty->assign(array(
'path' => 'Guide > TODO',
'id_category' => $id_category,
'categoryTitle' => $categories['name'],
'subcategoryTitle' => $subcategories['name'],