Rewrite
This commit is contained in:
parent
006edad609
commit
49cd82d3df
@ -340,7 +340,7 @@ class GuideCategory extends ObjectModel
|
||||
foreach ($result as $c) {
|
||||
$rewrite = 'guide/';
|
||||
if ($c['id_parent'] != 0) {
|
||||
$parent = $this->getParent($c['id_guide_category'], $id_lang);
|
||||
$parent = $this->getParent($c['id_parent'], $id_lang);
|
||||
$rewrite.= $parent['link_rewrite'].'/';
|
||||
}
|
||||
$rewrite.= $c['id_guide_category'].'-'.$c['link_rewrite'];
|
||||
@ -358,6 +358,12 @@ class GuideCategory extends ObjectModel
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Parent category
|
||||
* @param int $id_category
|
||||
* @param int $id_lang
|
||||
* @return array
|
||||
*/
|
||||
public function getParent($id_category, $id_lang)
|
||||
{
|
||||
$sql = "SELECT gc.*, gcl.name, gcl.link_rewrite
|
||||
@ -369,6 +375,11 @@ class GuideCategory extends ObjectModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gest All main categories
|
||||
* @param int $id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getRoot($id_lang)
|
||||
{
|
||||
$sql = "SELECT gc.id_guide_category, gcl.name, gcl.link_rewrite, gcl.meta_title,
|
||||
|
@ -4,16 +4,6 @@ require_once(__DIR__.'/../../classes/GuidePost.php');
|
||||
|
||||
class PostController extends FrontController
|
||||
{
|
||||
private function getPath()
|
||||
{
|
||||
$pipe = Configuration::get('PS_NAVIGATION_PIPE');
|
||||
if (empty($pipe)) {
|
||||
$pipe = '>';
|
||||
}
|
||||
|
||||
return "Guide > ";
|
||||
}
|
||||
|
||||
public function canonicalRedirection() {}
|
||||
|
||||
public function preProcess()
|
||||
@ -131,6 +121,8 @@ class PostController extends FrontController
|
||||
'postTitle' => $content['meta_title'],
|
||||
'postContent' => $content['content'],
|
||||
'postLink' => '',
|
||||
|
||||
'id_guide_post_select' => $id_post,
|
||||
));
|
||||
|
||||
$metaTags = Tools::completeMetaTags(array(
|
||||
|
@ -255,7 +255,7 @@ class PurchaseGuide extends Module
|
||||
$rewrite = $category->getLinkRewrite($cookie->id_lang);
|
||||
|
||||
$smarty->assign(array(
|
||||
'link_rewrite' => $rewrite,
|
||||
'link_rewrite' => '/guide/'.$rewrite,
|
||||
));
|
||||
|
||||
return $this->display(dirname(__FILE__), '/views/templates/hook/topmenulink.tpl');
|
||||
@ -265,19 +265,18 @@ class PurchaseGuide extends Module
|
||||
{
|
||||
global $cookie, $smarty;
|
||||
|
||||
// id_category, id_subcategory
|
||||
// id_category
|
||||
$id_category = Tools::getValue('cid', 0);
|
||||
$id_subcategory = Tools::getValue('sid', 0);
|
||||
|
||||
/*if ($id_category == 0) {
|
||||
return '';
|
||||
}*/
|
||||
// @todo : id_category2
|
||||
|
||||
// Récup de l'arbre en fonction des catégories
|
||||
$model = new GuideCategory();
|
||||
$tree = $model->getTree($cookie->id_lang);
|
||||
|
||||
// @todo : id_guide_category_select, id_guide_post_select
|
||||
$smarty->assign(array(
|
||||
'id_guide_category_select_main' => $id_category,
|
||||
'id_guide_category_select_second' => $id_category,
|
||||
'menu' => $tree,
|
||||
));
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
<div style="width:24%;float:left;">
|
||||
<ul>
|
||||
{foreach from=$postList item=p}
|
||||
<li><a href="{$base_dir_ssl}guide/{$categoryRewrite}/{$subcategoryRewrite}/{$p.id_guide_post}-{$p.link_rewrite}">{$p.meta_title}</a></li>
|
||||
<li{if $p.id_guide_post==$id_guide_post_select} class="enabled"{/if}>
|
||||
<a href="{$base_dir_ssl}guide/{$categoryRewrite}/{$subcategoryRewrite}/{$p.id_guide_post}-{$p.link_rewrite}">{$p.meta_title}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -1,6 +1,17 @@
|
||||
<div class="block-cms informations_block_left">
|
||||
{foreach from=$menu item=c}
|
||||
<h4><a href="{$base_dir_ssl}{$c.rewrite}">{$c.name}</a></h4>
|
||||
{assign var="isSelected" value="0"}
|
||||
{if $c.id_guide_category}
|
||||
{assign var="isSelected" value="1"}
|
||||
{/if}
|
||||
<h4><a{if $isSelected==0} class="selected"{/if} href="{$base_dir_ssl}{$c.rewrite}">{$c.name}</a></h4>
|
||||
|
||||
{if $c.children|@count > 0 && $isSelected==0}
|
||||
{foreach from=$c.children item=children}
|
||||
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{if $c.children|@count > 0}
|
||||
<ul class="block_content">
|
||||
{foreach from=$c.children item=children}
|
||||
|
@ -1,2 +1,2 @@
|
||||
<span>Besoin d'aide ?</span><br/>
|
||||
<span>Consultez notre <a href="{$link_rewrite}">Guide d'achat</a></span>
|
||||
<span>Consultez notre <a href="{$base_dir_ssl}{$link_rewrite}">Guide d'achat</a></span>
|
Loading…
Reference in New Issue
Block a user