add link to banner

This commit is contained in:
Marion Muszynski 2017-07-24 11:49:58 +02:00
parent e19e7cfae3
commit 61cf5b99de
4 changed files with 33 additions and 8 deletions

View File

@ -23,6 +23,8 @@ class AdminAntPromobanner extends AdminTab
foreach(Language::getLanguages(false) as $language) { foreach(Language::getLanguages(false) as $language) {
Configuration::updateValue('ANT_PROMO_BANNER_2',Tools::getValue('enabled_fr', 0)); Configuration::updateValue('ANT_PROMO_BANNER_2',Tools::getValue('enabled_fr', 0));
Configuration::updateValue('ANT_PROMO_BANNER_3',Tools::getValue('enabled_es', 0)); Configuration::updateValue('ANT_PROMO_BANNER_3',Tools::getValue('enabled_es', 0));
Configuration::updateValue('ANT_PROMO_BANNERURL_2',Tools::getValue('url_2', ''));
Configuration::updateValue('ANT_PROMO_BANNERURL_3',Tools::getValue('url_3', ''));
foreach(array_keys($this->imagelist) as $img) { foreach(array_keys($this->imagelist) as $img) {
if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { 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')) { if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_'.$language['id_lang'].'.jpg')) {
@ -43,7 +45,7 @@ class AdminAntPromobanner extends AdminTab
foreach(array_keys($this->imagelist) as $img) { foreach(array_keys($this->imagelist) as $img) {
$images[] = 'img_'.$img; $images[] = 'img_'.$img;
} }
$divLangImgName = 'img_bmobile'; $divLangName = 'img_bmobile¤url';
$helper = new HelperFormBootstrap(); $helper = new HelperFormBootstrap();
$helper->_select2 = true; $helper->_select2 = true;
@ -87,6 +89,26 @@ class AdminAntPromobanner extends AdminTab
$html.= $helper->generateInput($input); $html.= $helper->generateInput($input);
$html.= '<div class="clearfix"></div>'; $html.= '<div class="clearfix"></div>';
$urldefaults = array(
2 => Configuration::get('ANT_PROMO_BANNERURL_2'),
3 => Configuration::get('ANT_PROMO_BANNERURL_3')
);
$input = array(
'type' => 'text',
'label' => $this->l('Url :'),
'lang' => true,
'name' => 'url',
'id' => 'url',
'required' => true,
'help' => "Renseignez l'url sans le http ou https, ex : //www.bebeboutik.com/8737618-boumy",
'languages' => $languages,
'id_langs' => $divLangName,
'link_flag_img' => '../img/l/',
'default' => $urldefaults
);
$html.= $helper->generateInput($input);
$html.= '<div class="clearfix"></div>';
foreach($this->imagelist as $k => $v) { foreach($this->imagelist as $k => $v) {
$input = array( $input = array(
'type' => 'uploadImage', 'type' => 'uploadImage',
@ -99,7 +121,7 @@ class AdminAntPromobanner extends AdminTab
'languages' => $languages, 'languages' => $languages,
'default_language' => 2, 'default_language' => 2,
'input-class' => '', 'input-class' => '',
'id_langs' => $divLangImgName, 'id_langs' => $divLangName,
'link_flag_img' => '../img/l/', 'link_flag_img' => '../img/l/',
'url_imgs' => __PS_BASE_URI__.'modules/ant_promobanner/img/', 'url_imgs' => __PS_BASE_URI__.'modules/ant_promobanner/img/',
'url_to_show' => _PS_ROOT_DIR_.'/modules/ant_promobanner/img/', 'url_to_show' => _PS_ROOT_DIR_.'/modules/ant_promobanner/img/',

View File

@ -416,6 +416,7 @@ class PrivateSales extends Module {
$smarty->assign(array( $smarty->assign(array(
'path' => __PS_BASE_URI__.'modules/privatesales/', 'path' => __PS_BASE_URI__.'modules/privatesales/',
'is_banner_enable' => (int)Configuration::get('ANT_PROMO_BANNER_'.$cookie->id_lang), 'is_banner_enable' => (int)Configuration::get('ANT_PROMO_BANNER_'.$cookie->id_lang),
'is_banner_link' => (!empty(Configuration::get('ANT_PROMO_BANNERURL_'.$cookie->id_lang))?Configuration::get('ANT_PROMO_BANNERURL_'.$cookie->id_lang):false),
'banner_url' => __PS_BASE_URI__.'modules/ant_promobanner/img/', 'banner_url' => __PS_BASE_URI__.'modules/ant_promobanner/img/',
'sales' => $sales, 'sales' => $sales,
'HOOK_PRIVATESALES_LISTING' => Module::hookExec('privatesales_listing', array('sales' => $sales, 'futuresales' => $futuresales)), 'HOOK_PRIVATESALES_LISTING' => Module::hookExec('privatesales_listing', array('sales' => $sales, 'futuresales' => $futuresales)),

View File

@ -192,9 +192,9 @@
onclick="window.location.href='{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}';" onclick="window.location.href='{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}';"
{/if}> {/if}>
{*<a href="{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}"><img class="background" alt="{$sale->title[$cookie->id_lang]}" src="{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg" /></a>*} {*<a href="{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}"><img class="background" alt="{$sale->title[$cookie->id_lang]}" src="{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg" /></a>*}
{if $sale->id!=7639}
{include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay} {include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay}
{/if}
<div class="short_desc"> <div class="short_desc">
<h3>{$sale->title[$cookie->id_lang]}</h3> <h3>{$sale->title[$cookie->id_lang]}</h3>
{if isset($extrafields[$sale->id])} {if isset($extrafields[$sale->id])}
@ -277,9 +277,9 @@
{$sale->description[$cookie->id_lang]|escape:'htmlall':'UTF-8'} {$sale->description[$cookie->id_lang]|escape:'htmlall':'UTF-8'}
<div class="date">{l s='From' mod='privatesales'} {$sale->date_start|date_format:'%A %e %b %H:%M'} {l s='To' mod='privatesales'} {$sale->date_end|date_format:'%A %e %b %H:%M'}</div> <div class="date">{l s='From' mod='privatesales'} {$sale->date_start|date_format:'%A %e %b %H:%M'} {l s='To' mod='privatesales'} {$sale->date_end|date_format:'%A %e %b %H:%M'}</div>
</div>*} </div>*}
{if $sale->id!=7639}
{include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay} {include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay}
{/if}
<div class="short_desc"> <div class="short_desc">
<h3>{$sale->title[$cookie->id_lang]}</h3> <h3>{$sale->title[$cookie->id_lang]}</h3>
{if isset($extrafields[$sale->id])} {if isset($extrafields[$sale->id])}

View File

@ -5,7 +5,7 @@
{if !$cookie->isLogged() AND !$showtoguests} {if !$cookie->isLogged() AND !$showtoguests}
{literal} {literal}
$('document').ready(function(){ $('document').ready(function(){
$('#block_sales_home a.img_link, a.enter').unbind('click').removeAttr('href').click(function(){ $('#block_sales_home a.img_link, a.enter, .ant_promo_banner_img').unbind('click').removeAttr('href').click(function(){
$('.modalbox_shadow').fadeIn(100); $('.modalbox_shadow').fadeIn(100);
$('.modalbox_login').fadeIn(250); $('.modalbox_login').fadeIn(250);
}); });
@ -73,7 +73,7 @@
<div id="block_sales_home"> <div id="block_sales_home">
<div class="content clearfix"> <div class="content clearfix">
{if $is_banner_enable} {if $is_banner_enable}
<img class="ant_promo_banner_img" src="{$banner_url}img_bmobile_{$cookie->id_lang}.jpg"/> <img onclick="{if $is_banner_link && ($cookie->isLogged() OR $showtoguests)}window.location.href='{$is_banner_link|escape:'htmlall':'UTF-8'}';{/if}" class="ant_promo_banner_img" src="{$banner_url}img_bmobile_{$cookie->id_lang}.jpg" {if $is_banner_link} style="cursor:pointer;" {/if}/>
{/if} {/if}
{if count($sales) > 0} {if count($sales) > 0}
@ -83,7 +83,9 @@
{if count(array_intersect($customer_groups, $sale->groups))>0} {if count(array_intersect($customer_groups, $sale->groups))>0}
<li onclick="{if $cookie->isLogged() OR $showtoguests}window.location.href='{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}';{/if}"> <li onclick="{if $cookie->isLogged() OR $showtoguests}window.location.href='{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}';{/if}">
{if $sale->id!=7639}
{include file="./themes/site_mobile/delay.tpl" delivery_delay=$sale->delivery_delay} {include file="./themes/site_mobile/delay.tpl" delivery_delay=$sale->delivery_delay}
{/if}
<a href="{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}" class="img_link"><img class="background" alt="{$sale->title[$cookie->id_lang]}" src="{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg" /></a> <a href="{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}" class="img_link"><img class="background" alt="{$sale->title[$cookie->id_lang]}" src="{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg" /></a>
<div class="links"> <div class="links">
<div class="short_desc"> <div class="short_desc">