[*] FO : Move header modules to new hook, first part 1/2

This commit is contained in:
gRoussac
2013-12-10 20:52:22 +01:00
parent 78df7f52f4
commit 1dcc5e288c
41 changed files with 306 additions and 311 deletions
+8 -8
View File
@@ -1,12 +1,12 @@
/* block top user information */
#header_right #header_user {
#header_user {
clear:both;
float: right;
margin-top:8px;
}
#header_right #header_user.header_user_catalog {
#header_user.header_user_catalog {
margin-top: 15px;
min-height: 60px;
}
@@ -36,26 +36,26 @@
#header_user #your_account a { background-image: url('img/icon/my-account.gif') }
/* user infos */
#header_user_info {
.header_user_info {
clear:both;
float:right;
margin-top:10px;
padding:0;
font-size:12px
}
#header_user_info a {
.header_user_info a {
display:inline-block;
margin:0 0 0 10px;
padding:3px 0 0 34px;
line-height: 11px;
border-left:1px solid #000
}
#header_user_info a.account {
.header_user_info a.account {
border: none;
display: inline;
margin: 0;
padding: 0;
}
*:first-child+html #header_user_info a {line-height:14px;}
#header_user_info a.login {background: url('img/icon/login.gif') no-repeat 10px 0}
#header_user_info a.logout {background: url('img/icon/logout.png') no-repeat 10px -1px}
*:first-child+html .header_user_info a {line-height:14px;}
.header_user_info a.login {background: url('img/icon/login.gif') no-repeat 10px 0}
.header_user_info a.logout {background: url('img/icon/logout.png') no-repeat 10px -1px}
+9 -6
View File
@@ -33,7 +33,7 @@ class BlockUserInfo extends Module
{
$this->name = 'blockuserinfo';
$this->tab = 'front_office_features';
$this->version = 0.1;
$this->version = 0.2;
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -45,7 +45,7 @@ class BlockUserInfo extends Module
public function install()
{
return (parent::install() AND $this->registerHook('top') AND $this->registerHook('header'));
return (parent::install() && $this->registerHook('displayNav') && $this->registerHook('displayNav') && $this->registerHook('displayHeader'));
}
/**
@@ -54,7 +54,7 @@ class BlockUserInfo extends Module
* @param array $params Parameters
* @return string Content
*/
public function hookTop($params)
public function hookDisplayTop($params)
{
if (!$this->active)
return;
@@ -71,10 +71,13 @@ class BlockUserInfo extends Module
return $this->display(__FILE__, 'blockuserinfo.tpl');
}
public function hookHeader($params)
public function hookDisplayHeader($params)
{
$this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all');
}
}
public function hookDisplayNav($params)
{
return $this->display(__FILE__, 'nav.tpl');
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blockuserinfo</name>
<displayName><![CDATA[User info block]]></displayName>
<version><![CDATA[0.1]]></version>
<version><![CDATA[0.2]]></version>
<description><![CDATA[Adds a block that displays information about the customer.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
+14
View File
@@ -0,0 +1,14 @@
<!-- Block user information module NAV -->
{if $logged}
<div class="header_user_info">
<a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" class="account" rel="nofollow"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
</div>
{/if}
<div class="header_user_info">
{if $logged}
<a class="logout" href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html'}" rel="nofollow" title="{l s='Log me out'}">{l s='Sign out'}</a>
{else}
<a class="login" href="{$link->getPageLink('my-account', true)|escape:'html'}" rel="nofollow" title="{l s='Login to your customer account'}">{l s='Sign in'}</a>
{/if}
</div>
<!-- /Block user information module NAV -->
@@ -0,0 +1,9 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_0_2($object)
{
return ($object->registerHook('displayNav'));
}