addition of module ant_promobanner
This commit is contained in:
parent
0dc183b5a8
commit
b87d25038f
@ -528,6 +528,7 @@ class HelperFormBootstrap{
|
||||
//$this->_html .= '
|
||||
$this->_js .= '
|
||||
<script>
|
||||
id_language = '.(int)$defaultLanguage.';
|
||||
$(function() {';
|
||||
|
||||
foreach ($p['languages'] as $language) {
|
||||
@ -549,6 +550,9 @@ class HelperFormBootstrap{
|
||||
if(isset($p['url_to_check']) && !empty($p['url_to_check']) && file_exists($p['url_to_check'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
|
||||
$this->_html .='<p><a href="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" onclick="window.open(this.href); return false;"><span class="anticon anticon-image"></span> Image '.$language['iso_code'].'</a></p>';
|
||||
}
|
||||
if(isset($p['url_to_show']) && !empty($p['url_to_show']) && file_exists($p['url_to_show'].$p['name_img'].'_'.$language['id_lang'].'.jpg')) {
|
||||
$this->_html .='<p><img src="'.$p['url_imgs'].$p['name_img'].'_'.$language['id_lang'].'.jpg" /></p>';
|
||||
}
|
||||
$this->_html .='</div>';
|
||||
$this->_js .= '
|
||||
$(document).on(\'click\', \'#close-preview_'.$p['id'].'_'.$language['id_lang'].'\', function(){
|
||||
|
128
modules/ant_promobanner/AdminAntPromobanner.php
Normal file
128
modules/ant_promobanner/AdminAntPromobanner.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
if(!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
|
||||
|
||||
class AdminAntPromobanner extends AdminTab
|
||||
{
|
||||
public function __construct() {
|
||||
$this->lang = TRUE;
|
||||
parent::__construct();
|
||||
$this->imagelist = array(
|
||||
'bmobile' => array($this->l('Bannière Mobile'), '500x178'),
|
||||
//'bsite' => array($this->l('Bannière Site'), '800x300'),
|
||||
);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
|
||||
if(Tools::isSubmit('submitBanners')) {
|
||||
foreach(Language::getLanguages(false) as $language) {
|
||||
Configuration::updateValue('ANT_PROMO_BANNER_2',Tools::getValue('enabled_fr', 0));
|
||||
Configuration::updateValue('ANT_PROMO_BANNER_3',Tools::getValue('enabled_es', 0));
|
||||
foreach(array_keys($this->imagelist) as $img) {
|
||||
if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') {
|
||||
if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_'.$language['id_lang'].'.jpg')) {
|
||||
HelperFormBootstrap::displayErrors($this->l('An error occured during the image upload.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
HelperFormBootstrap::displaySuccess('Mise à jour réussie');
|
||||
}
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$languages = Language::getLanguages(false);
|
||||
$images = array();
|
||||
foreach(array_keys($this->imagelist) as $img) {
|
||||
$images[] = 'img_'.$img;
|
||||
}
|
||||
$divLangImgName = 'img_bmobile';
|
||||
|
||||
$helper = new HelperFormBootstrap();
|
||||
$helper->_select2 = true;
|
||||
$helper->_inputSwitch = true;
|
||||
$html = $helper->renderStyle();
|
||||
$html .= '
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel">
|
||||
<div class="panel-title">
|
||||
<h2 style="font-size:24px;"><span class="anticon anticon-images" style="font-size:24px;"></span> Bannière Promotionnelle</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<div class="row">
|
||||
<form action="'.$currentIndex.'&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
<div class="col-sm-6 col-sm-offset-3">
|
||||
<div class="row">
|
||||
<label class="text-left col-md-12">Activation</label>
|
||||
</div>';
|
||||
$input = array(
|
||||
'type' => 'switch',
|
||||
'name' => 'enabled_fr',
|
||||
'title' => $this->l('Version FR'),
|
||||
'class-group' => 'col-md-6',
|
||||
'default' => (int)Configuration::get('ANT_PROMO_BANNER_2'),
|
||||
'checked' => (int)Configuration::get('ANT_PROMO_BANNER_2'),
|
||||
'required' => true,
|
||||
);
|
||||
$html.= $helper->generateInput($input);
|
||||
|
||||
$input = array(
|
||||
'type' => 'switch',
|
||||
'name' => 'enabled_es',
|
||||
'title' => $this->l('Version ES'),
|
||||
'class-group' => 'col-md-6',
|
||||
'default' => (int)Configuration::get('ANT_PROMO_BANNER_3'),
|
||||
'checked' => (int)Configuration::get('ANT_PROMO_BANNER_3'),
|
||||
'required' => true,
|
||||
);
|
||||
$html.= $helper->generateInput($input);
|
||||
$html.= '<div class="clearfix"></div>';
|
||||
|
||||
foreach($this->imagelist as $k => $v) {
|
||||
$input = array(
|
||||
'type' => 'uploadImage',
|
||||
'lang' => true,
|
||||
'label' => $v[0],
|
||||
'name' => 'img_'.$k,
|
||||
'name_img' => 'img_'.$k,
|
||||
'id' => $k,
|
||||
'help' => 'L\'image sera la même sur tous les écrans (évitez de charger un image trop lourde)',
|
||||
'languages' => $languages,
|
||||
'default_language' => 2,
|
||||
'input-class' => '',
|
||||
'id_langs' => $divLangImgName,
|
||||
'link_flag_img' => '../img/l/',
|
||||
'url_imgs' => __PS_BASE_URI__.'modules/ant_promobanner/img/',
|
||||
'url_to_show' => _PS_ROOT_DIR_.'/modules/ant_promobanner/img/',
|
||||
);
|
||||
$html .= $helper->generateInput($input);
|
||||
$html .= '<div class="clearfix"></div>';
|
||||
}
|
||||
$html .='
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="ln_solid-small"></div>
|
||||
<div class="text-right">
|
||||
<input type="submit" class="btn btn-primary" name="submitBanners" value="Engregistrer" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
$html .= $helper->renderScript();
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
}
|
40
modules/ant_promobanner/ant_promobanner.php
Normal file
40
modules/ant_promobanner/ant_promobanner.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class Ant_Promobanner extends Module
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'ant_promobanner';
|
||||
$this->tab = 'administration';
|
||||
$this->author = 'Antadis';
|
||||
$this->version = '1.0';
|
||||
$this->need_instance = 0;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Bannière promotionnelle');
|
||||
$this->description = $this->l('Permet d\'ajouter une bannière promotionnelle sur la home');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
|
||||
if(!(parent::install())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall() {
|
||||
|
||||
if(parent::uninstall() == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
BIN
modules/ant_promobanner/img/img_bmobile_2.jpg
Normal file
BIN
modules/ant_promobanner/img/img_bmobile_2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
modules/ant_promobanner/img/img_bmobile_3.jpg
Normal file
BIN
modules/ant_promobanner/img/img_bmobile_3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
@ -415,6 +415,8 @@ class PrivateSales extends Module {
|
||||
|
||||
$smarty->assign(array(
|
||||
'path' => __PS_BASE_URI__.'modules/privatesales/',
|
||||
'is_banner_enable' => (int)Configuration::get('ANT_PROMO_BANNER_'.$cookie->id_lang),
|
||||
'banner_url' => __PS_BASE_URI__.'modules/ant_promobanner/img/',
|
||||
'sales' => $sales,
|
||||
'HOOK_PRIVATESALES_LISTING' => Module::hookExec('privatesales_listing', array('sales' => $sales, 'futuresales' => $futuresales)),
|
||||
'HOOK_PRIVATESALES_BLOCK' => Module::hookExec('privatesales_block'),
|
||||
|
@ -5319,3 +5319,9 @@ h3.gift_title {
|
||||
background-size: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Module : Ant_promobanner ****/
|
||||
.ant_promo_banner_img{
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
@ -72,10 +72,8 @@
|
||||
<div id="privatesales_block">
|
||||
<div id="block_sales_home">
|
||||
<div class="content clearfix">
|
||||
{if $cookie->id_lang == 3}
|
||||
<div class="promo_bandeau_es"></div>
|
||||
{else}
|
||||
<div class="promo_bandeau"></div>
|
||||
{if $is_banner_enable}
|
||||
<img class="ant_promo_banner_img" src="{$banner_url}img_bmobile_{$cookie->id_lang}.jpg"/>
|
||||
{/if}
|
||||
|
||||
{if count($sales) > 0}
|
||||
|
Loading…
Reference in New Issue
Block a user