Integrate on front
This commit is contained in:
parent
3a9ea5aab1
commit
3cf9de8772
@ -18,6 +18,11 @@ class AdminGuide extends AdminTab
|
|||||||
|
|
||||||
$str_rewrite_rules = 'RewriteRule ^%s/([0-9]+)\-[a-zA-Z0-9-]*$ '.__PS_BASE_URI__.'modules/'.$module_name.'/page.php?id_guide_post=$1 [QSA,L]'."\n";
|
$str_rewrite_rules = 'RewriteRule ^%s/([0-9]+)\-[a-zA-Z0-9-]*$ '.__PS_BASE_URI__.'modules/'.$module_name.'/page.php?id_guide_post=$1 [QSA,L]'."\n";
|
||||||
|
|
||||||
|
$str_rewrite_rules =
|
||||||
|
'RewriteRule ^guide$ '.__PS_BASE_URI__.'modules/purchaseguide/rubrique.php [QSA,L]'.
|
||||||
|
'RewriteRule ^guide/([0-9]+)\-([a-zA-Z0-9-]*)$ '.__PS_BASE_URI__.'modules/purchaseguide/rubrique.php?cid=$1 [QSA,L]'.
|
||||||
|
'RewriteRule ^guide/([0-9]+)\-([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)$ '.__PS_BASE_URI__.'modules/purchaseguide/rubrique.php?cid=$1&sid=$3 [QSA,L]'.
|
||||||
|
'RewriteRule ^guide/([0-9]+)\-([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)$ '.__PS_BASE_URI__.'modules/purchaseguide/post.php?cid=$1&sid=$3&id=$5 [QSA,L]';
|
||||||
|
|
||||||
if(count($langs) > 1) {
|
if(count($langs) > 1) {
|
||||||
$rewrite_rules = '';
|
$rewrite_rules = '';
|
||||||
|
@ -5,8 +5,69 @@ class CategoryController extends FrontController
|
|||||||
//public function init(){}
|
//public function init(){}
|
||||||
//public function preProcess(){}
|
//public function preProcess(){}
|
||||||
//public function displayHeader(){}
|
//public function displayHeader(){}
|
||||||
//public function process(){}
|
public function process()
|
||||||
|
{
|
||||||
|
parent::process();
|
||||||
|
|
||||||
|
$id_lang = self::$cookie->id_lang;
|
||||||
|
|
||||||
|
$id_category = Tools::getValue('cid', 0);
|
||||||
|
$id_subcategory = Tools::getValue('subcid', 0);
|
||||||
|
|
||||||
|
$categories = array();
|
||||||
|
|
||||||
|
// Get parent categories
|
||||||
|
if ($id_category == 0) {
|
||||||
|
$sql = "SELECT gc.id_guide_category, gcl.name, gcl.link_rewrite, gcl.meta_title,
|
||||||
|
gcl.meta_description, gcl.meta_keywords
|
||||||
|
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=0 AND gcl.id_lang=".$id_lang;
|
||||||
|
$catResult = Db::getInstance()->ExecuteS($sql);
|
||||||
|
if (count($catResult) > 0) {
|
||||||
|
foreach ($catResult as $c) {
|
||||||
|
// Name
|
||||||
|
// Link link_rewrite
|
||||||
|
// Image getImageFilePath
|
||||||
|
$categories[] = $c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Get main category, subcategory, content
|
||||||
|
else {
|
||||||
|
// Main category
|
||||||
|
$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 gcl.id_lang=".$id_lang;
|
||||||
|
$categories = Db::getInstance()->ExecuteS($sql);
|
||||||
|
|
||||||
|
// Select the subcategory
|
||||||
|
if ($id_subcategory == 0) {
|
||||||
|
$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;
|
||||||
|
$subcategories = Db::getInstance()->ExecuteS($sql);
|
||||||
|
}
|
||||||
|
// Auto Select the subcategory
|
||||||
|
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 gcl.id_lang=".$id_lang.
|
||||||
|
" ORDER BY position DESC LIMIT 1";
|
||||||
|
$subcategories = Db::getInstance()->ExecuteS($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$smarty->assign(array(
|
||||||
|
'id_category' => $id_category,
|
||||||
|
'categories' => $categories,
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// displayContent
|
||||||
public function displayContent()
|
public function displayContent()
|
||||||
{
|
{
|
||||||
parent::displayContent();
|
parent::displayContent();
|
||||||
|
@ -1,6 +1,66 @@
|
|||||||
<?php
|
<?php
|
||||||
class ContentController extends FrontController
|
class ContentController extends FrontController
|
||||||
{
|
{
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
|
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_post = Tools::getValue('id', 0);
|
||||||
|
|
||||||
|
// Main category
|
||||||
|
$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_guide_category=".$id_category." AND gcl.id_lang=".$id_lang;
|
||||||
|
$categories = Db::getInstance()->getRow($sql);
|
||||||
|
|
||||||
|
// Auto Select the subcategory
|
||||||
|
if ($id_subcategory == 0) {
|
||||||
|
$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 gcl.id_lang=".$id_lang.
|
||||||
|
" ORDER BY gc.position ASC";
|
||||||
|
$subcategories = Db::getInstance()->getRow($sql);
|
||||||
|
}
|
||||||
|
// Select the subcategory
|
||||||
|
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;
|
||||||
|
$subcategories = Db::getInstance()->getRow($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto select post
|
||||||
|
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 gpl.id_lang=".$id_lang." ORDER BY position ASC";
|
||||||
|
$content = Db::getInstance()->getRow($sql);
|
||||||
|
}
|
||||||
|
// Select post
|
||||||
|
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 gpl.id_lang=".$id_lang;
|
||||||
|
$content = Db::getInstance()->getRow($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$smarty->assign(array(
|
||||||
|
'id_category' => $id_category,
|
||||||
|
'categoryTitle' => $categories['name'],
|
||||||
|
'subcategoryTitle' => $subcategories['name'],
|
||||||
|
'subcategoryContent' => $subcategories['description'],
|
||||||
|
'postTitle' => $content['meta_title'],
|
||||||
|
'postContent' => $content['content'],
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function displayContent()
|
public function displayContent()
|
||||||
{
|
{
|
||||||
parent::displayContent();
|
parent::displayContent();
|
||||||
|
@ -249,8 +249,19 @@ class PurchaseGuide extends Module
|
|||||||
|
|
||||||
public function hookRightColumn(){}
|
public function hookRightColumn(){}
|
||||||
|
|
||||||
public function hookLeftColumn()
|
public function hookLeftColumn($params)
|
||||||
{
|
{
|
||||||
|
// id_category, id_subcategory
|
||||||
|
$id_category = Tools::getValue('cid', 0);
|
||||||
|
$id_subcategory = Tools::getValue('sid', 0);
|
||||||
|
|
||||||
|
/*if ($id_category == 0) {
|
||||||
|
return '';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Récup de l'arbre en fonction des catégories
|
||||||
|
|
||||||
|
|
||||||
return $this->display(__FILE__, '/views/templates/front/leftcolumn.tpl');
|
return $this->display(__FILE__, '/views/templates/front/leftcolumn.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
{include file="$tpl_dir./breadcrumb.tpl"}
|
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||||
|
|
||||||
<h1>TITLE</h1>
|
<h1>Guide d'achat</h1>
|
||||||
<div class="rte{if $content_only} content_only{/if}">
|
<div class="rte{if $content_only} content_only{/if}">
|
||||||
CONTENT
|
|
||||||
|
<ul>
|
||||||
|
{foreach from=$categories item=c}
|
||||||
|
<li>
|
||||||
|
<a href="{$c.link_rewrite}">
|
||||||
|
<img alt="{$c.name}" src="">
|
||||||
|
<span>{$c.name}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
|
{include file="$tpl_dir./breadcrumb.tpl"}
|
||||||
|
|
||||||
LEFT
|
<h1>Guide d'achat - {$categoryTitle}</h1>
|
||||||
HOOK_EXEC
|
<div class="rte{if $content_only} content_only{/if}">
|
||||||
Blockcms
|
|
||||||
Liste des catégories
|
|
||||||
|
|
||||||
|
<h2>{$subcategoryTitle}</h2>
|
||||||
|
<div>
|
||||||
|
<p>{$subcategoryContent}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
RIGHT
|
<div>
|
||||||
Affichage du contenu categorie
|
Liste des sous-parties
|
||||||
Titre + Texte + image
|
</div>
|
||||||
Affichage menu des sous rubriques
|
|
||||||
Affichage du contenu de la sous rubrique
|
<div>
|
||||||
|
<h3>{$postTitle}</h3>
|
||||||
|
<p>{$postContent}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@ -396,8 +396,8 @@ class FrontController extends FrontControllerCore {
|
|||||||
'module-ant_support_form-support',
|
'module-ant_support_form-support',
|
||||||
'module-paypal-express_checkout-payment',
|
'module-paypal-express_checkout-payment',
|
||||||
'module-paymentinfo-manage',
|
'module-paymentinfo-manage',
|
||||||
'module-purchaseguide-category',
|
'module-purchaseguide-category', 'rubrique',
|
||||||
'module-purchaseguide-content',
|
'module-purchaseguide-content', 'post',
|
||||||
);
|
);
|
||||||
|
|
||||||
$displayRight = array(
|
$displayRight = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user