[*] 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
+14 -3
View File
@@ -33,7 +33,7 @@ class BlockBanner extends Module
{
$this->name = 'blockbanner';
$this->tab = 'other';
$this->version = 1.0;
$this->version = 1.1;
$this->author = 'PrestaShop';
$this->need_instance = 0;
@@ -49,7 +49,7 @@ class BlockBanner extends Module
Configuration::updateValue('BLOCKBANNER_IMG', 'sale70.gif');
Configuration::updateValue('BLOCKBANNER_LINK', '');
Configuration::updateValue('BLOCKBANNER_DESC', '');
return parent::install() && $this->registerHook('displayTop') && $this->registerHook('header');
return parent::install() && $this->registerHook('displayBanner') && $this->registerHook('displayHeader');
}
public function uninstall()
@@ -76,10 +76,21 @@ class BlockBanner extends Module
if ($total <= 0)
return;
}
return $this->display(__FILE__, 'blockbanner.tpl', $this->getCacheId());
}
public function hookHeader($params)
public function hookDisplayBanner($params)
{
return $this->hookDisplayTop($params);
}
public function hookDisplayFooter($params)
{
return $this->hookDisplayTop($params);
}
public function hookDisplayHeader($params)
{
$this->context->controller->addCSS($this->_path.'blockbanner.css', 'all');
}
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>blockbanner</name>
<displayName><![CDATA[Banner block]]></displayName>
<version><![CDATA[1]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Displays banner at the top of the store.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[other]]></tab>
@@ -0,0 +1,9 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_1($object)
{
return ($object->registerHook('displayBanner') && $object->unregisterHook('displayTop'));
}
+3 -3
View File
@@ -1,5 +1,5 @@
/* block top currencies */
#header_right #currencies_block_top {
#currencies_block_top {
float:right;
margin: 0 6px 0 0;
padding: 2px 6px;
@@ -11,7 +11,7 @@
border-bottom-left-radius: 3px;
background: none repeat scroll 0 0 #000;
}
#header_right #currencies_block_top p {
#currencies_block_top p {
clear: left;
padding-right:16px;
font: 11px Arial,Verdana,sans-serif;
@@ -57,4 +57,4 @@
width: auto;
background:#000000;
}
#setCurrency .currencies_ul_hover a {color:#fff;}
#setCurrency .currencies_ul_hover a {color:#fff;}
+2 -2
View File
@@ -1,5 +1,5 @@
/* block top languages */
#header_right #languages_block_top {
#languages_block_top {
float:right;
margin: 0;
padding:2px 6px 1px 6px;
@@ -11,7 +11,7 @@
border-bottom-left-radius: 3px;
background: none repeat scroll 0 0 #000;
}
#header_right #languages_block_top p {
#languages_block_top p {
clear: left;
padding-right:20px;
font: 11px Arial,Verdana,sans-serif;
+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'));
}
+14 -5
View File
@@ -60,7 +60,7 @@ class HomeSlider extends Module
public function install()
{
/* Adds Module */
if (parent::install() && $this->registerHook('displayTopColumn') && $this->registerHook('actionShopDataDuplication'))
if (parent::install() && $this->registerHook('displayHeader') && $this->registerHook('displayTopColumn') && $this->registerHook('actionShopDataDuplication'))
{
/* Sets up configuration */
$res = Configuration::updateValue('HOMESLIDER_WIDTH', '779');
@@ -660,16 +660,25 @@ class HomeSlider extends Module
return true;
}
public function hookdisplayTopColumn()
public function hookdisplayHeader($params)
{
$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
$this->context->controller->addCSS($this->_path.'bx_styles.css');
$this->context->controller->addJS($this->_path.'js/homeslider.js');
}
public function hookdisplayTop($params)
{
return $this->hookdisplayTopColumn();
}
public function hookdisplayTopColumn($params)
{
if ($this->context->smarty->tpl_vars['page_name'] != 'index' || $this->context->getMobileDevice() != false)
return false;
if(!$this->_prepareHook())
return false;
$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
$this->context->controller->addCSS($this->_path.'bx_styles.css');
$this->context->controller->addJS($this->_path.'js/homeslider.js');
return $this->display(__FILE__, 'homeslider.tpl', $this->getCacheId());
}
+1 -1
View File
@@ -5,5 +5,5 @@ if (!defined('_PS_VERSION_'))
function upgrade_module_1_2_3($object)
{
return ($object->unregisterHook('displayHome') && $object->registerHook('displayTopColumn'));
return ($object->unregisterHook('displayHome') && $object->registerHook('displayHeader') && $object->registerHook('displayTopColumn'));
}
@@ -24,13 +24,13 @@ body{background:#282828}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#c6c6c6;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -74,7 +74,7 @@ body{background:#282828}
background:$color1-style1}
}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
&:after{color:white}
@@ -25,13 +25,13 @@ body{background:#232323}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#656565;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:white;
&:hover, &.active {
@@ -84,7 +84,7 @@ body{background:#232323}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
&:after{color:white}
@@ -23,13 +23,13 @@ body{background:$color1-style1}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:white;
&:hover, &.active {
@@ -86,7 +86,7 @@ body{background:$color1-style1}
#search_block_top #search_query_top{color:#686666}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
text-shadow:0 1px #567931;
@@ -26,13 +26,13 @@ body{background:#282828}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -76,7 +76,7 @@ body{background:#282828}
background:$color2-style1}
}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
&:after{color:white}
+3 -3
View File
@@ -24,13 +24,13 @@ body{background:#282828}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#c6c6c6;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -74,7 +74,7 @@ body{background:#282828}
background:$color1-style1}
}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
&:after{color:white}
+3 -3
View File
@@ -28,13 +28,13 @@ body{background:#3c281c}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#656565;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:#fff;
&:hover, &.active {
@@ -94,7 +94,7 @@ body{background:#3c281c}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color1-style1;
color:white;
&:after{color:white}
+3 -3
View File
@@ -29,13 +29,13 @@ body{background:#1b1b1b}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#656565;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -100,7 +100,7 @@ body{background:#1b1b1b}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
&:after{color:white}
+3 -3
View File
@@ -28,13 +28,13 @@ body{background:#181212}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -100,7 +100,7 @@ body{background:#181212}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
text-shadow:$color-shadow;
+3 -3
View File
@@ -25,13 +25,13 @@ $color-shadow: 0 1px #567931;
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:white;
&:hover, &.active {
@@ -87,7 +87,7 @@ $color-shadow: 0 1px #567931;
#search_block_top #search_query_top{color:#686666}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
text-shadow:$color-shadow;
+3 -3
View File
@@ -28,13 +28,13 @@ body{background:#282828}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -95,7 +95,7 @@ body{background:#282828}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
text-shadow:$color-shadow;
+3 -3
View File
@@ -28,14 +28,14 @@ body{background:#282828}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -101,7 +101,7 @@ body{background:#282828}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
text-shadow:$color-shadow;
+3 -3
View File
@@ -28,14 +28,14 @@ body{background:#282828}
}
#currencies-block-top,
#languages-block-top,
.header-row #header_user_info{
.header-row .header_user_info{
border-color:#515151;
}
#currencies-block-top div.current,
#languages-block-top div.current,
.header-row #header_user_info a
.header-row .header_user_info a
{
color:$color1-style1;
&:hover, &.active {
@@ -101,7 +101,7 @@ body{background:#282828}
#header_right #header_user #shopping_cart a{
#header_user #shopping_cart a{
background:$color-style1;
color:white;
text-shadow:$color-shadow;
@@ -203,7 +203,12 @@ class ThemeConfigurator extends Module
}
}
public function hookdisplayTopColumn()
public function hookdisplayTopColumn($params)
{
return $this->hookdisplayTop($params);
}
public function hookdisplayTop($params)
{
if ((int)Tools::getValue('live_configurator', 0) == 1)
{