Jump to content

[résolu]Modification module Header Logo


Recommended Posts

  • 2 weeks later...

J'ai bien trouvé un module blockheaderlogo, mais impossible de truveer la ligne de code qui correspond à la redirection.

Copie du code PHP

 

 

if (!defined('_CAN_LOAD_FILES_'))

exit;

 

class BlockHeaderLogos extends Module

{

protected $maxImageSize = 307200;

 

public function __construct()

{

$this->name = 'blockheaderlogos';

$this->tab = 'front_office_features';

$this->version = 1.0;

 

parent::__construct();

 

$this->displayName = $this->l('Header logos');

$this->description = '';

}

 

public function install()

{

if (!Configuration::get('BHL_HOMEPAGE_LOGO_HEIGHT'))

Configuration::updateValue('BHL_HOMEPAGE_LOGO_HEIGHT', 71);

if (!Configuration::get('BHL_HOMEPAGE_LOGO_WIDTH'))

Configuration::updateValue('BHL_HOMEPAGE_LOGO_WIDTH', 215);

if (!Configuration::get('BHL_HOMEPAGE_LOGO'))

Configuration::updateValue('BHL_HOMEPAGE_LOGO', 'v2-logo.png');

if (!Configuration::get('BHL_HOMEPAGE_AD_HEIGHT'))

Configuration::updateValue('BHL_HOMEPAGE_AD_HEIGHT', 60);

if (!Configuration::get('BHL_HOMEPAGE_AD_WIDTH'))

Configuration::updateValue('BHL_HOMEPAGE_AD_WIDTH', 468);

if (!Configuration::get('BHL_HOMEPAGE_AD'))

Configuration::updateValue('BHL_HOMEPAGE_AD', 'v2-headerpub-en.gif');

return (parent::install() AND $this->registerHook('top'));

}

 

public function getContent()

{

if (Tools::isSubmit('submitUpdate'))

{

if (isset($_FILES['BHL_HOMEPAGE_LOGO']) AND isset($_FILES['BHL_HOMEPAGE_LOGO']['tmp_name']) AND !empty($_FILES['BHL_HOMEPAGE_LOGO']['tmp_name']))

if (checkImage($_FILES['BHL_HOMEPAGE_LOGO'], $this->maxImageSize) == false)

if (move_uploaded_file($_FILES['BHL_HOMEPAGE_LOGO']['tmp_name'], dirname(__FILE__).'/'.$_FILES['BHL_HOMEPAGE_LOGO']['name']))

Configuration::updateValue('BHL_HOMEPAGE_LOGO', $_FILES['BHL_HOMEPAGE_LOGO']['name']);

if (isset($_FILES['BHL_HOMEPAGE_AD']) AND isset($_FILES['BHL_HOMEPAGE_AD']['tmp_name']) AND !empty($_FILES['BHL_HOMEPAGE_AD']['tmp_name']))

if (checkImage($_FILES['BHL_HOMEPAGE_AD'], $this->maxImageSize) == false)

if (move_uploaded_file($_FILES['BHL_HOMEPAGE_AD']['tmp_name'], dirname(__FILE__).'/'.$_FILES['BHL_HOMEPAGE_AD']['name']))

Configuration::updateValue('BHL_HOMEPAGE_AD', $_FILES['BHL_HOMEPAGE_AD']['name']);

 

if (Configuration::get('BHL_HOMEPAGE_LOGO') AND file_exists(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_LOGO')))

{

list($width, $height, $type, $attr) = getimagesize(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_LOGO'));

Configuration::updateValue('BHL_HOMEPAGE_LOGO_WIDTH', (int)round($width));

Configuration::updateValue('BHL_HOMEPAGE_LOGO_HEIGHT', (int)round($height));

}

if (Configuration::get('BHL_HOMEPAGE_AD') AND file_exists(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_AD')))

{

list($width, $height, $type, $attr) = getimagesize(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_AD'));

Configuration::updateValue('BHL_HOMEPAGE_AD_WIDTH', (int)round($width));

Configuration::updateValue('BHL_HOMEPAGE_AD_HEIGHT', (int)round($height));

}

 

echo $this->displayConfirmation($this->l('Images updated successfully'));

}

 

$html = '

<form method="post" action="'.htmlentities($_SERVER['REQUEST_URI']).'" enctype="multipart/form-data">

<fieldset><legend>'.$this->displayName.'</legend>

<label>'.$this->l('Homepage logo').'</label>

<div class="margin-form">';

if (Configuration::get('BHL_HOMEPAGE_LOGO') AND file_exists(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_LOGO')))

$html .= '<div id="image" >

<img src="'.$this->_path.Configuration::get('BHL_HOMEPAGE_LOGO').'?t='.time().'" />

<p align="center">'.$this->l('Filesize').' '.(filesize(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_LOGO')) / 1000).'kb</p>

<a href="'.htmlentities($_SERVER['REQUEST_URI']).'&deleteHomepageLogo">

<img src="../img/admin/delete.gif" alt="'.$this->l('Delete').'" /> '.$this->l('Delete').'

</a>

</div>';

$html .= '<input type="file" name="BHL_HOMEPAGE_LOGO" />

<p style="clear: both">'.$this->l('Will appear on the top left of your shop').'</p>

</div>

<div class="clear"> </div>

<label>'.$this->l('Homepage ad').'</label>

<div class="margin-form">';

if (Configuration::get('BHL_HOMEPAGE_AD') AND file_exists(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_AD')))

$html .= '<div id="image" >

<img src="'.$this->_path.Configuration::get('BHL_HOMEPAGE_AD').'?t='.time().'" />

<p align="center">'.$this->l('Filesize').' '.(filesize(dirname(__FILE__).'/'.Configuration::get('BHL_HOMEPAGE_AD')) / 1000).'kb</p>

<a href="'.htmlentities($_SERVER['REQUEST_URI']).'&deleteHomepageAd">

<img src="../img/admin/delete.gif" alt="'.$this->l('Delete').'" /> '.$this->l('Delete').'

</a>

</div>';

$html .= '<input type="file" name="BHL_HOMEPAGE_AD" />

<p style="clear: both">'.$this->l('Will appear on the top right of your shop').'</p>

</div>

<div class="clear"></div>

<div class="margin-form clear"><input type="submit" name="submitUpdate" value="'.$this->l('Update images').'" class="button" /></div>

</fieldset>

</form>';

 

return $html;

}

 

public function hookTop($params)

{

global $smarty;

 

$smarty->assign(array(

'BHL_HOMEPAGE_LOGO' => __PS_BASE_URI__.'modules/'.$this->name.'/'.Configuration::get('BHL_HOMEPAGE_LOGO'),

'BHL_HOMEPAGE_LOGO_WIDTH' => (int)Configuration::get('BHL_HOMEPAGE_LOGO_WIDTH'),

'BHL_HOMEPAGE_LOGO_HEIGHT' => (int)Configuration::get('BHL_HOMEPAGE_LOGO_HEIGHT'),

'BHL_HOMEPAGE_AD' => __PS_BASE_URI__.'modules/'.$this->name.'/'.Configuration::get('BHL_HOMEPAGE_AD'),

'BHL_HOMEPAGE_AD_WIDTH' => (int)Configuration::get('BHL_HOMEPAGE_AD_WIDTH'),

'BHL_HOMEPAGE_AD_HEIGHT' => (int)Configuration::get('BHL_HOMEPAGE_AD_HEIGHT')

));

return $this->display(__FILE__, 'blockheaderlogos.tpl');

}

}

 

et du TPL

 

<div class="v2-headermargin">

<a href="{$base_dir}" style="float:left;display:block">

<img class="logo" src="{$BHL_HOMEPAGE_LOGO}" alt="{$shop_name|escape:'htmlall':'UTF-8'}" width="{$BHL_HOMEPAGE_LOGO_WIDTH}" height="{$BHL_HOMEPAGE_LOGO_HEIGHT}" />

</a>

<a href="{$base_dir}product.php?id_product=10" style="float:right;display:block;margin:10px 40px 0 0">

<img class="logo" src="{$BHL_HOMEPAGE_AD}" alt="" width="{$BHL_HOMEPAGE_AD_WIDTH}" height="{$BHL_HOMEPAGE_AD_HEIGHT}" />

</a>

<div class="flatclear"> </div>

</div>

<div class="flatclear"> </div>

Link to comment
Share on other sites

J'ai bien trouvé un module blockheaderlogo, mais impossible de truveer la ligne de code qui correspond à la redirection.

 

<a href="{$base_dir}product.php?id_product=10" style="float:right;display:block;margin:10px 40px 0 0">

Link to comment
Share on other sites

<div class="v2-headermargin">

<a href="{$base_dir}" style="float:left;display:block">

<img class="logo" src="{$BHL_HOMEPAGE_LOGO}" alt="{$shop_name|escape:'htmlall':'UTF-8'}" width="{$BHL_HOMEPAGE_LOGO_WIDTH}" height="{$BHL_HOMEPAGE_LOGO_HEIGHT}" />

</a>

<a href="{$base_dir}index.php" style="float:right;display:block;margin:10px 40px 0 0">

<img class="logo" src="{$BHL_HOMEPAGE_AD}" alt="" width="{$BHL_HOMEPAGE_AD_WIDTH}" height="{$BHL_HOMEPAGE_AD_HEIGHT}" />

</a>

<div class="flatclear"> </div>

</div>

<div class="flatclear"> </div>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...