Don't display link when empty

This commit is contained in:
Michael RICOIS 2017-11-20 14:37:28 +01:00
parent 1c5205a2a8
commit 5b8353fa4d
2 changed files with 14 additions and 9 deletions

View File

@ -26,14 +26,14 @@ class PurchaseGuide extends Module
|| !$this->installTabs()
|| !$this->createTables()
|| !$this->installImageAddon()
) {
$this->uninstall();
return FALSE;
) {
return false;
}
$this->registerHook('leftColumn');
$this->registerHook('TopMenuLink');
return TRUE;
return true;
}
@ -248,14 +248,17 @@ class PurchaseGuide extends Module
global $cookie, $smarty;
$id_category_family = $params['id_category_family'];
$rewrite = '';
$loadedCategory = GuideCategory::findByCategoryFamily($id_category_family, $cookie->id_lang);
$category = new GuideCategory($loadedCategory['id_guide_category']);
$rewrite = $category->getLinkRewrite($cookie->id_lang);
if (!empty($loadedCategory)) {
$link_rewrite = '';
$category = new GuideCategory($loadedCategory['id_guide_category']);
$rewrite = 'guide/'.$category->getLinkRewrite($cookie->id_lang);
}
$smarty->assign(array(
'link_rewrite' => 'guide/'.$rewrite,
'link_rewrite' => $rewrite,
));
return $this->display(dirname(__FILE__), '/views/templates/hook/topmenulink.tpl');

View File

@ -1,2 +1,4 @@
{if $link_rewrite != ''}
<span>Besoin d'aide ?</span><br/>
<span>Consultez notre <a href="{$base_dir_ssl}{$link_rewrite}">Guide d'achat</a></span>
<span>Consultez notre <a href="{$base_dir_ssl}{$link_rewrite}">Guide d'achat</a></span>
{/if}