Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
Francois Gaillard
2013-09-19 17:31:42 +02:00
36 changed files with 330 additions and 340 deletions
@@ -58,6 +58,7 @@
</ul> </ul>
</fieldset> </fieldset>
<h2>{l s='Members of this customer group'}</h2> <h2>{l s='Members of this customer group'}</h2>
<p>{l s='Limited to the 100th first customers.'} {l s='Please use filters to narrow your search.'}</p>
{$customerList} {$customerList}
{/block} {/block}
@@ -1,8 +1,8 @@
{* {*
* 2007-2013 PrestaShop * 2007-2013 PrestaShop
* **
* NOTICE OF LICENSE * NOTICE OF LICENSE
* **
* This source file is subject to the Academic Free License (AFL 3.0) * This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt. * that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
@@ -10,72 +10,25 @@
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately. * to license@prestashop.com so we can send you a copy immediately.
* **
* DISCLAIMER * DISCLAIMER
* **
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your * versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* **
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA * @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title} {include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
<div class="leadin">{block name="leadin"}{/block}</div> <div class="leadin">{block name="leadin"}{/block}</div>
{if $module_confirmation} {if $module_confirmation}
<div class="module_confirmation conf confirm"> <div class="module_confirmation conf confirm">
{l s='Your .CSV file has been sucessfully imported into your shop.'} {l s='Your .CSV file has been sucessfully imported into your shop.'}
</div> </div>
{/if} {/if}
<script type="text/javascript">
var truncateAuthorized = {$truncateAuthorized|intval};
$(document).ready(function(){
activeClueTip();
$("a#upload_file_import_link").fancybox({
'titleShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
$('#preview_import').submit(function(e) {
if ($('#truncate').get(0).checked)
{
console.log(truncateAuthorized);
if (truncateAuthorized)
{
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
{
e.preventDefault();
}
}
else
{
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js=1}');
return false;
}
}
});
});
function activeClueTip()
{
$('.info_import').cluetip({
splitTitle: '|',
showTitle: false
});
};
</script>
{**
* Upload fancybox
*}
<div style="display: none"> <div style="display: none">
<div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7"> <div id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7">
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
@@ -97,28 +50,16 @@
</form> </form>
</div> </div>
</div> </div>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<form id="preview_import" action="{$current}&token={$token}" method="post" style="display:inline" enctype="multipart/form-data" class="clear">
{**
* Import fieldset
*}
<form id="preview_import"
action="{$current}&token={$token}"
method="post"
style="display:inline"
enctype="multipart/form-data"
class="clear">
<fieldset style="float: left; margin: 0pt 20px 0pt 0pt; width: 70%;"> <fieldset style="float: left; margin: 0pt 20px 0pt 0pt; width: 70%;">
<legend><img src="../img/admin/import.gif" />{l s='Import '}</legend> <legend><img src="../img/admin/import.gif" />{l s='Import '}</legend>
<label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=count($files_to_import)}{else}{l s='Your CSV file (%d file):' sprintf=count($files_to_import)}{/if}</label> <label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=count($files_to_import)}{else}{l s='Your CSV file (%d file):' sprintf=count($files_to_import)}{/if}</label>
<div class="margin-form"> <div class="margin-form">
{if count($files_to_import)} {if count($files_to_import)}
<select name="csv"> <select name="csv">
{foreach $files_to_import AS $filename} {foreach $files_to_import AS $filename}
<option value="{$filename}">{$filename}</option> <option value="{$filename}"{if $csv_selected == $filename} selected="selected"{/if}>{$filename}</option>
{/foreach} {/foreach}
</select> </select>
{/if} {/if}
@@ -146,13 +87,12 @@
<div class="margin-form"> <div class="margin-form">
<select name="entity" id="entity"> <select name="entity" id="entity">
{foreach $entities AS $entity => $i} {foreach $entities AS $entity => $i}
<option value="{$i}" {if $entity == $i}selected="selected"{/if}> <option value="{$i}"{if $entity_selected == $i} selected="selected"{/if}>
{$entity} {$entity}
</option> </option>
{/foreach} {/foreach}
</select> </select>
</div> </div>
<label class="clear">{l s='Language of the file'}</label> <label class="clear">{l s='Language of the file'}</label>
<div class="margin-form"> <div class="margin-form">
<select name="iso_lang"> <select name="iso_lang">
@@ -180,14 +120,18 @@
<div class="margin-form"> <div class="margin-form">
<input name="truncate" id="truncate" type="checkbox"/> <input name="truncate" id="truncate" type="checkbox"/>
</div> </div>
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label> <label for="regenerate" class="clear">{l s='No thumbnails regeneration'}</label>
<div class="margin-form"> <div class="margin-form">
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/> <input name="regenerate" id="regenerate" type="checkbox" />
</div> </div>
<label for="forceIDs" class="clear">{l s='Force all ID\'s during import?'} </label> <label for="forceIDs" class="clear">{l s='Force all ID\'s during import?'} </label>
<div class="margin-form"> <div class="margin-form">
<input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all ID\'s will be auto-incremented.'} <input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all ID\'s will be auto-incremented.'}
</div> </div>
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
<div class="margin-form">
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
</div>
<div class="space margin-form"> <div class="space margin-form">
<input type="submit" name="submitImportFile" value="{l s='Next step'}" class="button" {if empty($files_to_import)}disabled{/if}/> <input type="submit" name="submitImportFile" value="{l s='Next step'}" class="button" {if empty($files_to_import)}disabled{/if}/>
{if empty($files_to_import)}<span style="color:red;">{l s='You must upload a file in order to proceed to the next step'}</span>{/if} {if empty($files_to_import)}<span style="color:red;">{l s='You must upload a file in order to proceed to the next step'}</span>{/if}
@@ -210,13 +154,10 @@
{/if} {/if}
</fieldset> </fieldset>
</form> </form>
<fieldset style="display:block;"> <fieldset style="display:block;">
<legend> <legend>
<img src="../img/admin/import.gif" />{l s='Available fields'} <img src="../img/admin/import.gif" />{l s='Available fields'}
</legend> </legend>
<div id="availableFields"> <div id="availableFields">
{$available_fields} {$available_fields}
</div> </div>
@@ -224,74 +165,88 @@
<div class="clear"> <div class="clear">
<br /><br />{l s='* Required field'} <br /><br />{l s='* Required field'}
</div> </div>
</fieldset> </fieldset>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<script type="text/javascript"> <script type="text/javascript">
$("select#entity").change( function() { $(document).ready(function(){
var truncateAuthorized = {$truncateAuthorized|intval};
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8) activeClueTip();
{ $("a#upload_file_import_link").fancybox({
$("label[for=truncate],#truncate").hide(); 'titleShow' : false,
} 'transitionIn' : 'elastic',
else 'transitionOut' : 'elastic'
$("label[for=truncate],#truncate").show();
if ($("#entity > option:selected").val() == 8)
{
$(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|');
}
else
{
$(".import_supply_orders_details").hide();
$('input[name=multiple_value_separator]').val(',');
}
if ($("#entity > option:selected").val() == 1)
{
$("label[for=match_ref],#match_ref").show();
}
else
$("label[for=match_ref],#match_ref").hide();
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
{
$(".import_products_categories").show();
}
else
$(".import_products_categories").hide();
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=forceIDs],#forceIDs").show();
else
$("label[for=forceIDs],#forceIDs").hide();
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
$.ajax({
url: 'ajax.php',
data: {
getAvailableFields:1,
entity: $("#entity").val()
},
dataType: 'json',
success: function(j) {
var fields = "";
$("#availableFields").empty();
for (var i = 0; i < j.length; i++)
fields += j[i].field;
$("#availableFields").html(fields);
activeClueTip();
},
error: function(j) {
}
}); });
$('#preview_import').submit(function(e){
if ($('#truncate').get(0).checked)
if (truncateAuthorized)
{
if (!confirm('{l s='Are you sure that you would like to delete this' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '?'))
e.preventDefault();
}
else
{
jAlert('{l s='You do not have permission to delete here. When the multistore is enabled, only a SuperAdmin can delete all items before an import.' js=1}');
return false;
}
});
$("select#entity").change(function(){
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8)
$("label[for=truncate],#truncate").hide();
else
$("label[for=truncate],#truncate").show();
if ($("#entity > option:selected").val() == 8)
{
$(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|');
}
else
{
$(".import_supply_orders_details").hide();
$('input[name=multiple_value_separator]').val(',');
}
if ($("#entity > option:selected").val() == 1)
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").show();
else
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
$(".import_products_categories, label[for=regenerate], #regenerate").show();
else
$(".import_products_categories, label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=forceIDs], #forceIDs").show();
else
$("label[for=forceIDs], #forceIDs").hide();
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
$.ajax({
url: 'ajax.php',
data: {
getAvailableFields:1,
entity: $("#entity").val()
},
dataType: 'json',
success: function(j){
var fields = "";
$("#availableFields").empty();
for (var i = 0; i < j.length; i++)
fields += j[i].field;
$("#availableFields").html(fields);
activeClueTip();
},
error: function(j){}
});
});
$("select#entity").trigger('change');
function activeClueTip()
{
$('.info_import').cluetip({
splitTitle: '|',
showTitle: false
});
};
}); });
</script> </script>
@@ -22,20 +22,52 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{extends file="helpers/view/view.tpl"} {extends file="helpers/view/view.tpl"}
{block name="override_tpl"} {block name="override_tpl"}
<script type="text/javascript"> <script type="text/javascript">
var errorEmpty = "{l s='Please name your matching configuration to save.'}" var errorEmpty = '{l s='Please name your matching configuration to save.' js='1'}';
var token = '{$token}'; var token = '{$token}';
var current = 0;
function showTable(nb)
{
$('#btn_left').disabled = null;
$('#btn_right').disabled = null;
if (nb <= 0)
{
nb = 0;
$('#btn_left').disabled = 'true';
}
if (nb >= {$nb_table} - 1)
{
nb = {$nb_table} - 1;
$('#btn_right').disabled = 'true';
}
$('#table' + current).hide();
current = nb;
$('#table' + current).show();
}
$(document).ready(function(){
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
var btn_submit_import = $('#import');
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
{
btn_submit_import.hide();
btn_save_import.find('span').removeClass('process-icon-save-import');
btn_save_import.find('span').addClass('process-icon-save');
btn_save_import.click(function(){
btn_submit_import.before('<input type="hidden" name="' + btn_submit_import.attr("name") + '" value="1" />');
$('#import_form').submit();
});
}
showTable(current);
});
</script> </script>
<div id="container-customer"> <div id="container-customer">
<h2>{l s='View your data'}</h2> <h2>{l s='View your data'}</h2>
<div> <div>
<b>{l s='Save and load your configuration for importing files'} : </b><br><br> <b>{l s='Save and load your configuration for importing files'} : </b><br/><br/>
<input type="text" name="newImportMatchs" id="newImportMatchs"> <input type="text" name="newImportMatchs" id="newImportMatchs" />
<a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br><br> <a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br /><br />
<div id="selectDivImportMatchs" {if !$import_matchs}style="display:none"{/if}> <div id="selectDivImportMatchs" {if !$import_matchs}style="display:none"{/if}>
<select id="valueImportMatchs"> <select id="valueImportMatchs">
{foreach $import_matchs as $match} {foreach $import_matchs as $match}
@@ -46,21 +78,18 @@
<a class="button" id="deleteImportMatchs" href="#">{l s='Delete'}</a> <a class="button" id="deleteImportMatchs" href="#">{l s='Delete'}</a>
</div> </div>
</div> </div>
<h3>{l s='Please set the value type of each column'}</h3> <h3>{l s='Please set the value type of each column'}</h3>
<div id="error_duplicate_type" class="warning warn" style="display:none;"> <div id="error_duplicate_type" class="warning warn" style="display:none;">
<h3>{l s='Columns cannot have the same value type'}</h3> <h3>{l s='Columns cannot have the same value type'}</h3>
</div> </div>
<div id="required_column" class="warning warn" style="display:none;"> <div id="required_column" class="warning warn" style="display:none;">
<h3>{l s='Column'} <span id="missing_column">&nbsp;</span> {l s='must be set'}</h3> <h3>{l s='Column'} <span id="missing_column">&nbsp;</span> {l s='must be set'}</h3>
</div> </div>
<form action="{$current}&token={$token}" method="post" id="import_form" name="import_form"> <form action="{$current}&token={$token}" method="post" id="import_form" name="import_form">
{l s='Skip'} <input type="text" size="2" name="skip" value="1" /> {l s='lines'} {l s='Skip'} <input type="text" size="2" name="skip" value="1" /> {l s='lines'}
<input type="hidden" name="csv" value="{$fields_value.csv}" /> <input type="hidden" name="csv" value="{$fields_value.csv}" />
<input type="hidden" name="convert" value="{$fields_value.convert}" /> <input type="hidden" name="convert" value="{$fields_value.convert}" />
<input type="hidden" name="regenerate" value="{$fields_value.regenerate}" />
<input type="hidden" name="entity" value="{$fields_value.entity}" /> <input type="hidden" name="entity" value="{$fields_value.entity}" />
<input type="hidden" name="iso_lang" value="{$fields_value.iso_lang}" /> <input type="hidden" name="iso_lang" value="{$fields_value.iso_lang}" />
{if $fields_value.truncate} {if $fields_value.truncate}
@@ -72,49 +101,8 @@
{if $fields_value.match_ref} {if $fields_value.match_ref}
<input type="hidden" name="match_ref" value="1" /> <input type="hidden" name="match_ref" value="1" />
{/if} {/if}
<input type="hidden" name="separator" value="{$fields_value.separator}"> <input type="hidden" name="separator" value="{$fields_value.separator}" />
<input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}"> <input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}" />
<script type="text/javascript">
var current = 0;
function showTable(nb)
{
getE('btn_left').disabled = null;
getE('btn_right').disabled = null;
if (nb <= 0)
{
nb = 0;
getE('btn_left').disabled = 'true';
}
if (nb >= {$nb_table} - 1)
{
nb = {$nb_table} - 1;
getE('btn_right').disabled = 'true';
}
toggle(getE('table'+current), false);
current = nb;
toggle(getE('table'+current), true);
}
$(function() {
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
var btn_submit_import = $('#import');
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
{
btn_submit_import.hide();
btn_save_import.find('span').removeClass('process-icon-save-import');
btn_save_import.find('span').addClass('process-icon-save');
btn_save_import.click(function() {
btn_submit_import.before('<input type="hidden" name="'+btn_submit_import.attr("name")+'" value="1" />');
$('#import_form').submit();
});
}
});
</script>
<table> <table>
<tr> <tr>
<td colspan="3" align="center"> <td colspan="3" align="center">
@@ -123,7 +111,7 @@
</tr> </tr>
<tr> <tr>
<td valign="top" align="center"> <td valign="top" align="center">
<input id="btn_left" value="{l s='<<'}" type="button" class="button" onclick="showTable(current - 1)" /> <input id="btn_left" value="{l s='<<'}" type="button" class="button" onclick="showTable(current - 1);" />
</td> </td>
<td align="left"> <td align="left">
{section name=nb_i start=0 loop=$nb_table step=1} {section name=nb_i start=0 loop=$nb_table step=1}
@@ -132,12 +120,10 @@
{/section} {/section}
</td> </td>
<td valign="top" align="center"> <td valign="top" align="center">
<input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1)" /> <input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1);" />
</td> </td>
</tr> </tr>
</table> </table>
<script type="text/javascript">showTable(current);</script>
</form> </form>
</div> </div>
{/block} {/block}
@@ -153,7 +153,7 @@
<br /> <br />
<fieldset> <fieldset>
<legend><img src="../img/admin/tab-customers.gif" /> {l s='Customer information'}</legend> <legend><img src="../img/admin/tab-customers.gif" /> {l s='Customer information'}</legend>
<span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}"> {$customer->firstname} {$customer->lastname}</a></span> ({l s='#'}{$customer->id})<br /> <span style="font-weight: bold; font-size: 14px;"><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}"> {$gender->name|escape:'htmlall':'UTF-8'} {$customer->firstname} {$customer->lastname}</a></span> ({l s='#'}{$customer->id})<br />
(<a href="mailto:{$customer->email}">{$customer->email}</a>)<br /><br /> (<a href="mailto:{$customer->email}">{$customer->email}</a>)<br /><br />
{if ($customer->isGuest())} {if ($customer->isGuest())}
{l s='This order has been placed by a guest.'} {l s='This order has been placed by a guest.'}
@@ -30,7 +30,7 @@
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if} {if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
{block name="defaultForm"} {block name="defaultForm"}
<form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{$table}_form{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}> <form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{if $table == null}configuration_form{else}{$table}_form{/if}{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
{if $form_id} {if $form_id}
<input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" /> <input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" />
{/if} {/if}
@@ -34,7 +34,7 @@
{block name="defaultOptions"} {block name="defaultOptions"}
<form action="{$current}&token={$token}" <form action="{$current}&token={$token}"
id="{$table}_form" id="{if $table == null}configuration_form{else}{$table}_form{/if}"
{if isset($categoryData['name'])} name={$categoryData['name']}{/if} {if isset($categoryData['name'])} name={$categoryData['name']}{/if}
{if isset($categoryData['id'])} id={$categoryData['id']} {/if} {if isset($categoryData['id'])} id={$categoryData['id']} {/if}
method="post" method="post"
@@ -36,7 +36,7 @@
{if $k == 'modules-list'} {if $k == 'modules-list'}
<div id="modules_list_container" style="display:none"> <div id="modules_list_container" style="display:none">
<div style="float:right;margin:5px"> <div style="float:right;margin:5px">
<a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png"></a> <a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png" /></a>
</div> </div>
<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div> <div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div>
<div id="modules_list_container_tab" style="display:none;"></div> <div id="modules_list_container_tab" style="display:none;"></div>
+34 -54
View File
@@ -91,12 +91,8 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
$shop = new Shop($id_shop); $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
else
$shop = Context::getContext()->shop;
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($product)) if (!is_object($product))
{ {
@@ -163,11 +159,7 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null) $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($category)) if (!is_object($category))
$category = new Category($category, $id_lang); $category = new Category($category, $id_lang);
@@ -206,11 +198,7 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null) $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($cms_category)) if (!is_object($cms_category))
@@ -239,19 +227,12 @@ class LinkCore
* @param int $id_lang * @param int $id_lang
* @return string * @return string
*/ */
public function getCMSLink($cms, $alias = null, $ssl = false, $id_lang = null, $id_shop = null) public function getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop = null)
{ {
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
$url = $base.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($cms)) if (!is_object($cms))
@@ -290,11 +271,8 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$shop = Context::getContext()->shop; $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($supplier)) if (!is_object($supplier))
@@ -327,11 +305,7 @@ class LinkCore
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null) $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance(); $dispatcher = Dispatcher::getInstance();
if (!is_object($manufacturer)) if (!is_object($manufacturer))
@@ -360,18 +334,12 @@ class LinkCore
* @param int $id_lang * @param int $id_lang
* @return string * @return string
*/ */
public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = false, $id_lang = null, $id_shop = null) public function getModuleLink($module, $controller = 'default', array $params = array(), $ssl = null, $id_lang = null, $id_shop = null)
{ {
if (!$id_lang) if (!$id_lang)
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
if ($id_shop === null) $url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop);
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
$url = $base.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
// If the module has its own route ... just use it ! // If the module has its own route ... just use it !
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop)) if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop))
@@ -453,10 +421,9 @@ class LinkCore
* *
* @return string Page link * @return string Page link
*/ */
public function getPageLink($controller, $ssl = false, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null) public function getPageLink($controller, $ssl = null, $id_lang = null, $request = null, $request_url_encode = false, $id_shop = null)
{ {
$controller = Tools::strReplaceFirst('.php', '', $controller); $controller = Tools::strReplaceFirst('.php', '', $controller);
if (!$id_lang) if (!$id_lang)
$id_lang = (int)Context::getContext()->language->id; $id_lang = (int)Context::getContext()->language->id;
@@ -469,17 +436,9 @@ class LinkCore
parse_str($request, $request); parse_str($request, $request);
} }
if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop); $uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request, false, '', $id_shop);
$url = ($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain; return $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
$url .= $shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
return $url;
} }
public function getCatImageLink($name, $id_category, $type = null) public function getCatImageLink($name, $id_category, $type = null)
@@ -643,5 +602,26 @@ class LinkCore
return Language::getIsoById($id_lang).'/'; return Language::getIsoById($id_lang).'/';
} }
protected function getBaseLink($id_shop = null, $ssl = null)
{
static $force_ssl = null;
if ($ssl === null)
{
if ($force_ssl === null)
$force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'));
$ssl = $force_ssl;
}
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
$shop = new Shop($id_shop);
else
$shop = Context::getContext()->shop;
$base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain);
return $base.$shop->getBaseURI();
}
} }
+1 -1
View File
@@ -39,7 +39,7 @@ class MediaCore
'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), 'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true),
'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true),
'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true), 'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true),
+8 -8
View File
@@ -3055,18 +3055,18 @@ class ProductCore extends ObjectModel
if (!Combination::isFeatureActive()) if (!Combination::isFeatureActive())
return array(); return array();
$sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name,
a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`,
IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`,
product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`, product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`,
pa.`minimal_quantity`, pa.`available_date`, ag.`group_type` product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type`
FROM `'._DB_PREFIX_.'product_attribute` pa FROM `'._DB_PREFIX_.'product_attribute` pa
'.Shop::addSqlAssociation('product_attribute', 'pa').' '.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Product::sqlStock('pa', 'pa').' '.Product::sqlStock('pa', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`)
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`)
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`)
'.Shop::addSqlAssociation('attribute', 'a').' '.Shop::addSqlAssociation('attribute', 'a').'
WHERE pa.`id_product` = '.(int)$this->id.' WHERE pa.`id_product` = '.(int)$this->id.'
AND al.`id_lang` = '.(int)$id_lang.' AND al.`id_lang` = '.(int)$id_lang.'
+10 -20
View File
@@ -1260,6 +1260,13 @@ class ToolsCore
return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1); return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1);
} }
public static function ucwords($str)
{
if (function_exists('mb_convert_case'))
return mb_convert_case($str, MB_CASE_TITLE);
return ucwords(strtolower($str));
}
public static function orderbyPrice(&$array, $order_way) public static function orderbyPrice(&$array, $order_way)
{ {
foreach ($array as &$row) foreach ($array as &$row)
@@ -1401,26 +1408,9 @@ class ToolsCore
public static function copy($source, $destination, $stream_context = null) public static function copy($source, $destination, $stream_context = null)
{ {
if ($stream_context == null && preg_match('/^https?:\/\//', $source)) if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source))
$stream_context = @stream_context_create(array('http' => array('timeout' => 10))); return @copy($source, $destination);
return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context));
if (in_array(@ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $source))
return @copy($source, $destination, $stream_context);
elseif (function_exists('curl_init'))
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $source);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$opts = stream_context_get_options($stream_context);
$content = curl_exec($curl);
curl_close($curl);
return file_put_contents($destination, $content);
}
else
return false;
} }
/** /**
+1 -1
View File
@@ -45,7 +45,7 @@ class AdminControllerCore extends Controller
public $template = 'content.tpl'; public $template = 'content.tpl';
/** @var string Associated table name */ /** @var string Associated table name */
public $table; public $table = 'configuration';
public $list_id; public $list_id;
+7 -3
View File
@@ -65,6 +65,9 @@ class FrontControllerCore extends Controller
parent::__construct(); parent::__construct();
if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'))
$this->ssl = true;
if (isset($useSSL)) if (isset($useSSL))
$this->ssl = $useSSL; $this->ssl = $useSSL;
else else
@@ -144,8 +147,6 @@ class FrontControllerCore extends Controller
// Init cookie language // Init cookie language
// @TODO This method must be moved into switchLanguage // @TODO This method must be moved into switchLanguage
Tools::setCookieLanguage($this->context->cookie); Tools::setCookieLanguage($this->context->cookie);
$currency = Tools::setCurrency($this->context->cookie);
$protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://'; $protocol_link = (Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode()) ? 'https://' : 'http://';
$useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false; $useSSL = ((isset($this->ssl) && $this->ssl && Configuration::get('PS_SSL_ENABLED')) || Tools::usingSecureMode()) ? true : false;
@@ -167,6 +168,8 @@ class FrontControllerCore extends Controller
if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault)) if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault))
$this->context->country = $newDefault; $this->context->country = $newDefault;
$currency = Tools::setCurrency($this->context->cookie);
if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id))) if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id)))
{ {
$this->context->customer->logout(); $this->context->customer->logout();
@@ -597,7 +600,7 @@ class FrontControllerCore extends Controller
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit')) if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit'))
return; return;
$match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $match_url = (($this->ssl) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$match_url = rawurldecode($match_url); $match_url = rawurldecode($match_url);
if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url)) if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url))
{ {
@@ -667,6 +670,7 @@ class FrontControllerCore extends Controller
} }
} }
} }
if (isset($this->context->cookie->iso_code_country) && $this->context->cookie->iso_code_country && !Validate::isLanguageIsoCode($this->context->cookie->iso_code_country)) if (isset($this->context->cookie->iso_code_country) && $this->context->cookie->iso_code_country && !Validate::isLanguageIsoCode($this->context->cookie->iso_code_country))
$this->context->cookie->iso_code_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT')); $this->context->cookie->iso_code_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country)))) if (isset($this->context->cookie->iso_code_country) && ($id_country = Country::getByIso(strtoupper($this->context->cookie->iso_code_country))))
+2 -2
View File
@@ -35,10 +35,10 @@ class HelperFormCore extends Helper
/** @var array of forms fields */ /** @var array of forms fields */
protected $fields_form = array(); protected $fields_form = array();
/** @var array values ​​of form fields */ /** @var array values of form fields */
public $fields_value = array(); public $fields_value = array();
public $table; public $table = 'configuration';
public $name_controller = ''; public $name_controller = '';
/** @var string if not null, a title will be added on that list */ /** @var string if not null, a title will be added on that list */
+4 -4
View File
@@ -136,6 +136,9 @@ class HelperListCore extends Helper
$this->_list = $list; $this->_list = $list;
$this->fields_list = $fields_display; $this->fields_list = $fields_display;
$this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy);
$this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay);
// Display list header (filtering, pagination and column names) // Display list header (filtering, pagination and column names)
$tpl_vars['header'] = $this->displayListHeader(); $tpl_vars['header'] = $this->displayListHeader();
@@ -456,7 +459,7 @@ class HelperListCore extends Helper
); );
if ($this->specificConfirmDelete !== false) if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\''); $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\''));
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data)); $tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
@@ -522,9 +525,6 @@ class HelperListCore extends Helper
isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null
); );
// Cleaning links
if (Tools::getValue($this->table.'Orderby') && Tools::getValue($this->table.'Orderway'))
$this->currentIndex = preg_replace('/&'.$this->table.'Orderby=([a-z _]*)&'.$this->table.'Orderway=([a-z]*)/i', '', $this->currentIndex);
if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1)) if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1))
$table_id = substr($this->identifier, 3, strlen($this->identifier)); $table_id = substr($this->identifier, 3, strlen($this->identifier));
@@ -77,7 +77,7 @@ class AdminAddressesControllerCore extends AdminController
parent::initToolbar(); parent::initToolbar();
if (!$this->display) if (!$this->display)
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=addresses',
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
@@ -246,7 +246,7 @@ class AdminCategoriesControllerCore extends AdminController
'desc' => $this->l('Add New') 'desc' => $this->l('Add New')
); );
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=categories',
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
@@ -190,7 +190,7 @@ class AdminCustomersControllerCore extends AdminController
else if (!$this->display) //display import button only on listing else if (!$this->display) //display import button only on listing
{ {
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=customers',
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
+1 -1
View File
@@ -193,7 +193,7 @@ class AdminGroupsControllerCore extends AdminController
'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool') 'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool')
)); ));
$customer_list = $group->getCustomers(false, 0, 0, true); $customer_list = $group->getCustomers(false, 0, 100, true);
$helper = new HelperList(); $helper = new HelperList();
$helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false); $helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false);
+32 -10
View File
@@ -465,11 +465,25 @@ class AdminImportControllerCore extends AdminController
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$this->addJqueryPlugin(array('fancybox')); $this->addJqueryPlugin(array('fancybox'));
$entity_selected = 0;
if (isset($this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))]))
{
$entity_selected = $this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))];
$this->context->cookie->entity_selected = $entity_selected;
}
elseif (isset($this->context->cookie->entity_selected))
$entity_selected = (int)$this->context->cookie->entity_selected;
$csv_selected = '';
if (isset($this->context->cookie->csv_selected))
$csv_selected = pSQL($this->context->cookie->csv_selected);
$this->tpl_form_vars = array( $this->tpl_form_vars = array(
'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)), 'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)),
'path_import' => _PS_ADMIN_DIR_.'/import/', 'path_import' => _PS_ADMIN_DIR_.'/import/',
'entities' => $this->entities, 'entities' => $this->entities,
'entity' => Tools::getValue('entity'), 'entity_selected' => $entity_selected,
'csv_selected' => $csv_selected,
'files_to_import' => $files_to_import, 'files_to_import' => $files_to_import,
'languages' => Language::getLanguages(false), 'languages' => Language::getLanguages(false),
'id_language' => $this->context->language->id, 'id_language' => $this->context->language->id,
@@ -497,6 +511,11 @@ class AdminImportControllerCore extends AdminController
for ($i = 0; $i < $nb_table; $i++) for ($i = 0; $i < $nb_table; $i++)
$data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator); $data[$i] = $this->generateContentTable($i, $nb_column, $handle, $this->separator);
if ($entity_selected = (int)Tools::getValue('entity'))
$this->context->cookie->entity_selected = $entity_selected;
if ($csv_selected = Tools::getValue('csv'))
$this->context->cookie->csv_selected = $csv_selected;
$this->tpl_view_vars = array( $this->tpl_view_vars = array(
'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'), 'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'),
'fields_value' => array( 'fields_value' => array(
@@ -506,6 +525,7 @@ class AdminImportControllerCore extends AdminController
'iso_lang' => Tools::getValue('iso_lang'), 'iso_lang' => Tools::getValue('iso_lang'),
'truncate' => Tools::getValue('truncate'), 'truncate' => Tools::getValue('truncate'),
'forceIDs' => Tools::getValue('forceIDs'), 'forceIDs' => Tools::getValue('forceIDs'),
'regenerate' => Tools::getValue('regenerate'),
'match_ref' => Tools::getValue('match_ref'), 'match_ref' => Tools::getValue('match_ref'),
'separator' => $this->separator, 'separator' => $this->separator,
'multiple_value_separator' => $this->multiple_value_separator 'multiple_value_separator' => $this->multiple_value_separator
@@ -795,7 +815,7 @@ class AdminImportControllerCore extends AdminController
* @param string entity 'products' or 'categories' * @param string entity 'products' or 'categories'
* @return void * @return void
*/ */
protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products') protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products', $regenerate = true)
{ {
$tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import');
$watermark_types = explode(',', Configuration::get('WATERMARK_TYPES')); $watermark_types = explode(',', Configuration::get('WATERMARK_TYPES'));
@@ -823,11 +843,14 @@ class AdminImportControllerCore extends AdminController
{ {
ImageManager::resize($tmpfile, $path.'.jpg'); ImageManager::resize($tmpfile, $path.'.jpg');
$images_types = ImageType::getImagesTypes($entity); $images_types = ImageType::getImagesTypes($entity);
foreach ($images_types as $image_type)
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
if (in_array($image_type['id_image_type'], $watermark_types)) if ($regenerate)
Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); foreach ($images_types as $image_type)
{
ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']);
if (in_array($image_type['id_image_type'], $watermark_types))
Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity));
}
} }
else else
{ {
@@ -976,7 +999,7 @@ class AdminImportControllerCore extends AdminController
} }
//copying images of categories //copying images of categories
if (isset($category->image) && !empty($category->image)) if (isset($category->image) && !empty($category->image))
if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories'))) if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories', !Tools::getValue('regenerate'))))
$this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.'); $this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.');
// If both failed, mysql error // If both failed, mysql error
if (!$res) if (!$res)
@@ -1438,7 +1461,7 @@ class AdminImportControllerCore extends AdminController
{ {
// associate image to selected shops // associate image to selected shops
$image->associateTo($shops); $image->associateTo($shops);
if (!AdminImportController::copyImg($product->id, $image->id, $url)) if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate')))
{ {
$image->delete(); $image->delete();
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
@@ -1564,7 +1587,7 @@ class AdminImportControllerCore extends AdminController
if ($field_error === true && $lang_field_error === true && $image->add()) if ($field_error === true && $lang_field_error === true && $image->add())
{ {
$image->associateTo($id_shop_list); $image->associateTo($id_shop_list);
if (!AdminImportController::copyImg($product->id, $image->id, $url)) if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate')))
{ {
$this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url);
$image->delete(); $image->delete();
@@ -2720,7 +2743,6 @@ class AdminImportControllerCore extends AdminController
$this->clearSmartyCache(); $this->clearSmartyCache();
break; break;
case $this->entities[$import_type = $this->l('Products')]: case $this->entities[$import_type = $this->l('Products')]:
$import_type = $this->l('Categories');
$this->productImport(); $this->productImport();
$this->clearSmartyCache(); $this->clearSmartyCache();
break; break;
@@ -140,7 +140,7 @@ class AdminManufacturersControllerCore extends AdminController
'lastname' => array( 'lastname' => array(
'title' => $this->l('Last name'), 'title' => $this->l('Last name'),
'width' => 100, 'width' => 100,
'filter_key' => 'a!name' 'filter_key' => 'a!lastname'
), ),
'postcode' => array( 'postcode' => array(
'title' => $this->l('Zip Code/Postal Code'), 'title' => $this->l('Zip Code/Postal Code'),
@@ -570,7 +570,7 @@ class AdminManufacturersControllerCore extends AdminController
default: default:
parent::initToolbar(); parent::initToolbar();
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=manufacturers',
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
} }
+4 -1
View File
@@ -805,7 +805,7 @@ class AdminOrdersControllerCore extends AdminController
if (!Validate::isLoadedObject($order)) if (!Validate::isLoadedObject($order))
$this->errors[] = Tools::displayError('The order cannot be found'); $this->errors[] = Tools::displayError('The order cannot be found');
elseif (!Validate::isNegativePrice($amount)) elseif (!Validate::isNegativePrice($amount) || !(float)$amount)
$this->errors[] = Tools::displayError('The amount is invalid.'); $this->errors[] = Tools::displayError('The amount is invalid.');
elseif (!Validate::isString(Tools::getValue('payment_method'))) elseif (!Validate::isString(Tools::getValue('payment_method')))
$this->errors[] = Tools::displayError('The selected payment method is invalid.'); $this->errors[] = Tools::displayError('The selected payment method is invalid.');
@@ -1342,11 +1342,14 @@ class AdminOrdersControllerCore extends AdminController
$product['warehouse_name'] = '--'; $product['warehouse_name'] = '--';
} }
$gender = new Gender((int)$customer->id_gender, $this->context->language->id);
// Smarty assign // Smarty assign
$this->tpl_view_vars = array( $this->tpl_view_vars = array(
'order' => $order, 'order' => $order,
'cart' => new Cart($order->id_cart), 'cart' => new Cart($order->id_cart),
'customer' => $customer, 'customer' => $customer,
'gender' => $gender,
'customer_addresses' => $customer->getAddresses($this->context->language->id), 'customer_addresses' => $customer->getAddresses($this->context->language->id),
'addresses' => array( 'addresses' => array(
'delivery' => $addressDelivery, 'delivery' => $addressDelivery,
@@ -86,6 +86,19 @@ class AdminPreferencesControllerCore extends AdminController
'type' => 'bool', 'type' => 'bool',
'default' => '0' 'default' => '0'
), ),
);
if (Configuration::get('PS_SSL_ENABLED'))
$fields['PS_SSL_ENABLED_EVERYWHERE'] = array(
'title' => $this->l('Force the SSL on all the pages'),
'desc' => $this->l('Force all your store to use SSL'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
'default' => '0'
);
$fields = array_merge($fields, array(
'PS_TOKEN_ENABLE' => array( 'PS_TOKEN_ENABLE' => array(
'title' => $this->l('Increase Front Office security'), 'title' => $this->l('Increase Front Office security'),
'desc' => $this->l('Enable or disable token in the Front Office to improve PrestaShop\'s security.'), 'desc' => $this->l('Enable or disable token in the Front Office to improve PrestaShop\'s security.'),
@@ -135,7 +148,7 @@ class AdminPreferencesControllerCore extends AdminController
'list' => $activities2, 'list' => $activities2,
'identifier' => 'value' 'identifier' => 'value'
), ),
); ));
// No HTTPS activation if you haven't already. // No HTTPS activation if you haven't already.
if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED')) if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED'))
@@ -2437,7 +2437,7 @@ class AdminProductsControllerCore extends AdminController
} }
else else
$this->toolbar_btn['import'] = array( $this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type='.$this->table, 'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=products',
'desc' => $this->l('Import') 'desc' => $this->l('Import')
); );
@@ -136,6 +136,7 @@ class AdminStatusesControllerCore extends AdminController
{ {
$this->table = 'order_return_state'; $this->table = 'order_return_state';
$this->_defaultOrderBy = $this->identifier = 'id_order_return_state'; $this->_defaultOrderBy = $this->identifier = 'id_order_return_state';
$this->list_id = 'order_return_state';
$this->deleted = false; $this->deleted = false;
$this->_orderBy = null; $this->_orderBy = null;
@@ -262,6 +262,24 @@ class AdminSuppliersControllerCore extends AdminController
return parent::renderForm(); return parent::renderForm();
} }
/**
* AdminController::initToolbar() override
* @see AdminController::initToolbar()
*
*/
public function initToolbar()
{
switch ($this->display)
{
default:
parent::initToolbar();
$this->toolbar_btn['import'] = array(
'href' => $this->context->link->getAdminLink('AdminImport', true).'&import_type=suppliers',
'desc' => $this->l('Import')
);
}
}
public function renderView() public function renderView()
{ {
$products = $this->object->getProductsLite($this->context->language->id); $products = $this->object->getProductsLite($this->context->language->id);
+1
View File
@@ -425,6 +425,7 @@ class AuthControllerCore extends FrontController
if (Tools::isSubmit('newsletter')) if (Tools::isSubmit('newsletter'))
$this->processCustomerNewsletter($customer); $this->processCustomerNewsletter($customer);
$customer->firstname = Tools::ucwords($customer->firstname);
$customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']); $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
if (!Validate::isBirthDate($customer->birthday)) if (!Validate::isBirthDate($customer->birthday))
$this->errors[] = Tools::displayError('Invalid date of birth.'); $this->errors[] = Tools::displayError('Invalid date of birth.');
+1 -1
View File
@@ -79,7 +79,7 @@ class IdentityControllerCore extends FrontController
if (!count($this->errors)) if (!count($this->errors))
{ {
$this->customer->id_default_group = (int)$prev_id_default_group; $this->customer->id_default_group = (int)$prev_id_default_group;
$this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname)); $this->customer->firstname = Tools::ucwords($this->customer->firstname);
if (!isset($_POST['newsletter'])) if (!isset($_POST['newsletter']))
$this->customer->newsletter = 0; $this->customer->newsletter = 0;
@@ -35,9 +35,14 @@ function add_module_to_hook($module_name, $hook_name)
if ((int)$id_module > 0) if ((int)$id_module > 0)
{ {
$id_hook = Db::getInstance()->getValue(' $id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'"');
SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'" if(!$id_hook)
'); {
$res &= Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`)
VALUES ("'.pSQL($hook_name).'", "'.pSQL($hook_name).'")');
$id_hook = Db::getInstance()->Insert_ID();
}
if ((int)$id_hook > 0) if ((int)$id_hook > 0)
{ {
@@ -51,7 +56,5 @@ function add_module_to_hook($module_name, $hook_name)
)'); )');
} }
} }
return $res; return $res;
} }
+1 -1
View File
@@ -29,6 +29,6 @@ function remove_tab($tabname)
Db::getInstance()->execute(' Db::getInstance()->execute('
DELETE t, l DELETE t, l
FROM `'._DB_PREFIX_.'tab` t LEFT JOIN `'._DB_PREFIX_.'tab_lang` l ON (t.id_tab = l.id_tab) FROM `'._DB_PREFIX_.'tab` t LEFT JOIN `'._DB_PREFIX_.'tab_lang` l ON (t.id_tab = l.id_tab)
WHERE t.`class_name` = '.pSQL($tabname)); WHERE t.`class_name` = "'.pSQL($tabname).'"');
} }
+15 -1
View File
@@ -1 +1,15 @@
ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
/* PHP:add_module_to_hook(blockcart, actionCartListOverride); */;
/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerDeleteAfter); */;
/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerAddAfter); */;
/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerUpdateAfter); */;
/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierDeleteAfter); */;
/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */;
/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */;
/* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */;
/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */;
/* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */;
/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */;
/* PHP:remove_tab(AdminRangePrice); */;
/* PHP:remove_tab(AdminRangeWeight); */;
+2 -1
View File
@@ -481,7 +481,7 @@ function askFeatureName(selected, selector)
{ {
var elem; var elem;
if (selected.value == 'feature') if (selected.value == 'features')
{ {
$('#features_' + selector).show(); $('#features_' + selector).show();
$('#feature_name_' + selector).attr('name', selected.name); $('#feature_name_' + selector).attr('name', selected.name);
@@ -751,6 +751,7 @@ function doAdminAjax(data, success_func, error_func)
{ {
url : 'index.php', url : 'index.php',
data : data, data : data,
type : 'POST',
success : function(data){ success : function(data){
if (success_func) if (success_func)
return success_func(data); return success_func(data);
+4 -4
View File
@@ -153,12 +153,13 @@ function displaySummary()
$('tr.range_inf td input').each( function() $('tr.range_inf td input').each( function()
{ {
if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || range_inf > $(this).val())) if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || parseFloat(range_inf) > parseFloat($(this).val())))
range_inf = $(this).val(); range_inf = $(this).val();
}); });
$('tr.range_sup td input').each( function(){ $('tr.range_sup td input').each( function(){
if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || range_sup < $(this).val()))
if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || parseFloat(range_sup) < parseFloat($(this).val())))
range_sup = $(this).val(); range_sup = $(this).val();
}); });
@@ -272,7 +273,6 @@ function bind_inputs()
}); });
$('tr.fees td input:checkbox').off('change').on('change', function () { $('tr.fees td input:checkbox').off('change').on('change', function () {
if($(this).is(':checked')) if($(this).is(':checked'))
{ {
$(this).closest('tr').children('td').each( function () { $(this).closest('tr').children('td').each( function () {
@@ -389,7 +389,7 @@ function hideFees()
function showFees() function showFees()
{ {
$('tr.range_inf td, tr.range_sup td, tr.fees_all td, tr.fees td').each( function () { $('tr.range_inf td, tr.range_sup td, tr.fees_all td, tr.fees td').each( function () {
if ($(this).index() >= 2) if ($(this).index() > 2)
{ {
//enable only if zone is active //enable only if zone is active
tr = $(this).parent('tr'); tr = $(this).parent('tr');
@@ -134,6 +134,11 @@ class BlockNewProducts extends Module
{ {
return $this->hookRightColumn($params); return $this->hookRightColumn($params);
} }
public function hookHome($params)
{
return $this->hookRightColumn($params);
}
public function hookHeader($params) public function hookHeader($params)
{ {
+3 -3
View File
@@ -218,9 +218,9 @@ class Editorial extends Module
if ($input['name'] != 'body_homepage_logo') if ($input['name'] != 'body_homepage_logo')
$helper->fields_value[$input['name']] = $editorial->{$input['name']}; $helper->fields_value[$input['name']] = $editorial->{$input['name']};
$helper->fields_value['image'] = (file_exists(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') ? '<img src="'.$this->_path.'homepage_logo_'.(int)$id_shop.'.jpg">' : ''); $helper->fields_value['body_homepage_logo']['image'] = (file_exists(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') ? '<img src="'.$this->_path.'homepage_logo_'.(int)$id_shop.'.jpg">' : '');
if ($helper->fields_value['image']) if ($helper->fields_value['body_homepage_logo'])
$helper->fields_value['size'] = filesize(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') / 1000; $helper->fields_value['body_homepage_logo']['size'] = filesize(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') / 1000;
$this->_html .= $helper->generateForm($this->fields_form); $this->_html .= $helper->generateForm($this->fields_form);
return $this->_html; return $this->_html;
+4 -11
View File
@@ -433,17 +433,10 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
{/if} {/if}
{*close if for show price*} {*close if for show price*}
{/if} {/if}
{if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} <p id="add_to_cart" {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block">
<span class="exclusive"> <span></span>
<span></span> <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
{l s='Add to cart'} </p>
</span>
{else}
<p id="add_to_cart" class="buttons_bottom_block">
<span></span>
<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
</p>
{/if}
{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
<div class="clear"></div> <div class="clear"></div>