Merge branch 'ticket-13560-BannerMobile' into develop

This commit is contained in:
Marion Muszynski 2017-06-27 18:22:46 +02:00
commit 7ef886ba82
9 changed files with 211 additions and 8 deletions

View File

@ -527,6 +527,7 @@ class HelperFormBootstrap{
//$this->_html .= '
$this->_js .= '
<script>
id_language = '.(int)$defaultLanguage.';
$(function() {';
foreach ($p['languages'] as $language) {
@ -548,6 +549,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(){

View 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;
}
}

View 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;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -1326,9 +1326,15 @@ class AdminAntReturnprocess extends AdminTab
</div>
<div class="col-md-12">
<div class="panel-content">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="anticon anticon-barcode"></i></span>
<input type="text" data-table="product_detail" class="form-control input_ean" placeholder="Sélection par EAN..."/>
</div>
</div>
<form action="'.$currentIndex.'&submitCancelProduct=1&updateorder_return&id_order_return='.(int)$orderReturn->id.'&token='.$this->token.'" method="post">
<div class="table-responsive">
<table class="table table-custombordered" style="margin-bottom:0;">
<table id="product_detail" class="table table-custombordered" style="margin-bottom:0;">
<thead>
<tr>
<th><span class="anticon anticon-cart"></span> '.$this->l('Produit').'</th>
@ -1374,7 +1380,7 @@ class AdminAntReturnprocess extends AdminTab
<td style="vertical-align:middle;color:#444;" align="center" class="productQuantity">'.(int)$stock['quantity'].'</td>
<td style=" width:70px;vertical-align:middle;color:#444;" align="center">'.Tools::displayPrice(Tools::ps_round($product_price, 2) * ((int)($product['product_quantity']) - $product['customizationQuantityTotal']), $currency, false).'</td>
<td width="70" style="vertical-align:middle;color:#444;">
<input class="form-control" type="number" id="cancelQuantity_'.(int)($product['id_order_detail']).'" name="cancelQuantity['.(int)($product['id_order_detail']).']" min="0" max="'.((int)($product['product_quantity']) - (int)($product['product_quantity_return'] + $product['product_quantity_refunded'])).'" value="0" '.(((int)($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int)($product['product_quantity'])) ? 'disabled="disabled" ' : '').'/>
<input class="form-control" type="number" data-ean="'.$product['product_ean13'].'" id="cancelQuantity_'.(int)($product['id_order_detail']).'" name="cancelQuantity['.(int)($product['id_order_detail']).']" min="0" max="'.((int)($product['product_quantity']) - (int)($product['product_quantity_return'] + $product['product_quantity_refunded'])).'" value="0" '.(((int)($product['product_quantity_return'] + $product['product_quantity_refunded']) >= (int)($product['product_quantity'])) ? 'disabled="disabled" ' : '').'/>
</td>
</tr>';
}
@ -1515,9 +1521,15 @@ class AdminAntReturnprocess extends AdminTab
<div class="panel-content">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="anticon anticon-barcode"></i></span>
<input type="text" data-table="product-resend" class="form-control input_ean" placeholder="Sélection par EAN..."/>
</div>
</div>
<form action="'.$currentIndex.'&submitResendParcel=1&updateorder_return&id_order_return='.(int)$orderReturn->id.'&token='.$this->token.'" method="post">
<div class="table-responsive">
<table class="table table-custombordered">
<table id="product-resend" class="table table-custombordered">
<tbody>';
$id_order_details = array();
foreach ($order->getProducts() AS $k => $product) {
@ -1543,7 +1555,7 @@ class AdminAntReturnprocess extends AdminTab
</a>
</td>
<td width="70" style="vertical-align:middle;color:#444;">
<input class="form-control" type="number" id="resendQuantity_'.(int)($product['id_order_detail']).'" name="resendQuantity['.(int)($product['id_order_detail']).']" min="0" max="'.$product['product_quantity'].'" value="0"/>
<input class="form-control" type="number" id="resendQuantity_'.(int)($product['id_order_detail']).'" name="resendQuantity['.(int)($product['id_order_detail']).']" min="0" max="'.$product['product_quantity'].'" data-ean="'.$product['product_ean13'].'" value="0"/>
</td>
</tr>';
}
@ -1841,6 +1853,19 @@ class AdminAntReturnprocess extends AdminTab
modal.find(".modal-body select#instruction option[value=\'"+id_instruction+"\']").attr("selected","selected");
modal.find(".modal-body select#reason option[value=\'"+id_reason+"\']").attr("selected","selected");
});
$(".input_ean").change(function(event){
table = $(this).data("table");
input = $("#"+table+" input[data-ean=\'"+$(this).val()+"\']");
value = input.val();
max = input.attr("max");
new_value = parseInt(value) + 1;
if(new_value <= max) {
input.val(new_value);
}
$(this).val("");
});
});
</script>
';

View File

@ -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'),

View File

@ -5386,3 +5386,9 @@ h3.gift_title {
background-size: 100%;
}
}
/***** Module : Ant_promobanner ****/
.ant_promo_banner_img{
width: 100%;
margin-bottom: 10px;
}

View File

@ -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}