Merge branch 'development' of github.com:202-ecommerce/PrestaShop into development

This commit is contained in:
thoma202
2013-10-02 14:38:44 +02:00
83 changed files with 699 additions and 17498 deletions
@@ -48,11 +48,11 @@
<script type="text/javascript">
$(document).ready(function() {
$("#group_discount_category").fancybox({
onStart: function () {
beforeLoad: function () {
$('#group_discount_category_fancybox').show();
initFancyBox();
},
onClosed: function () {
beforeClose: function () {
$('#group_discount_category_fancybox').hide();
}
});
@@ -1,8 +1,8 @@
{*
* 2007-2013 PrestaShop
*
**
* NOTICE OF LICENSE
*
**
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* 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
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
**
* DISCLAIMER
*
**
* 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
* needs please refer to http://www.prestashop.com for more information.
*
**
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
<div class="leadin">{block name="leadin"}{/block}</div>
{if $module_confirmation}
<div class="module_confirmation conf confirm">
{l s='Your .CSV file has been sucessfully imported into your shop.'}
</div>
{/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 id="upload_file_import" style="padding-left: 10px; background-color: #EBEDF4; border: 1px solid #CCCED7">
<div class="clear">&nbsp;</div>
@@ -97,28 +50,16 @@
</form>
</div>
</div>
<div class="clear">&nbsp;</div>
{**
* Import fieldset
*}
<form id="preview_import"
action="{$current}&token={$token}"
method="post"
style="display:inline"
enctype="multipart/form-data"
class="clear">
<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%;">
<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>
<div class="margin-form">
{if count($files_to_import)}
<select name="csv">
{foreach $files_to_import AS $filename}
<option value="{$filename}">{$filename}</option>
<option value="{$filename}"{if $csv_selected == $filename} selected="selected"{/if}>{$filename}</option>
{/foreach}
</select>
{/if}
@@ -146,13 +87,12 @@
<div class="margin-form">
<select name="entity" id="entity">
{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}
</option>
{/foreach}
</select>
</div>
<label class="clear">{l s='Language of the file'}</label>
<div class="margin-form">
<select name="iso_lang">
@@ -180,14 +120,18 @@
<div class="margin-form">
<input name="truncate" id="truncate" type="checkbox"/>
</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">
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
<input name="regenerate" id="regenerate" type="checkbox" />
</div>
<label for="forceIDs" class="clear">{l s='Force all ID\'s during import?'} </label>
<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.'}
</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">
<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}
@@ -210,13 +154,10 @@
{/if}
</fieldset>
</form>
<fieldset style="display:block;">
<legend>
<img src="../img/admin/import.gif" />{l s='Available fields'}
</legend>
<div id="availableFields">
{$available_fields}
</div>
@@ -224,74 +165,88 @@
<div class="clear">
<br /><br />{l s='* Required field'}
</div>
</fieldset>
<div class="clear">&nbsp;</div>
<script type="text/javascript">
$("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").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) {
}
$(document).ready(function(){
var truncateAuthorized = {$truncateAuthorized|intval};
activeClueTip();
$("a#upload_file_import_link").fancybox({
'titleShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
});
$('#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)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helpers/view/view.tpl"}
{block name="override_tpl"}
<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 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>
<div id="container-customer">
<h2>{l s='View your data'}</h2>
<div>
<b>{l s='Save and load your configuration for importing files'} : </b><br><br>
<input type="text" name="newImportMatchs" id="newImportMatchs">
<a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br><br>
<b>{l s='Save and load your configuration for importing files'} : </b><br/><br/>
<input type="text" name="newImportMatchs" id="newImportMatchs" />
<a id="saveImportMatchs" class="button" href="#">{l s='Save'}</a><br /><br />
<div id="selectDivImportMatchs" {if !$import_matchs}style="display:none"{/if}>
<select id="valueImportMatchs">
{foreach $import_matchs as $match}
@@ -46,21 +78,18 @@
<a class="button" id="deleteImportMatchs" href="#">{l s='Delete'}</a>
</div>
</div>
<h3>{l s='Please set the value type of each column'}</h3>
<div id="error_duplicate_type" class="warning warn" style="display:none;">
<h3>{l s='Columns cannot have the same value type'}</h3>
</div>
<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>
</div>
<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'}
<input type="hidden" name="csv" value="{$fields_value.csv}" />
<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="iso_lang" value="{$fields_value.iso_lang}" />
{if $fields_value.truncate}
@@ -72,49 +101,8 @@
{if $fields_value.match_ref}
<input type="hidden" name="match_ref" value="1" />
{/if}
<input type="hidden" name="separator" value="{$fields_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>
<input type="hidden" name="separator" value="{$fields_value.separator}" />
<input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}" />
<table>
<tr>
<td colspan="3" align="center">
@@ -123,7 +111,7 @@
</tr>
<tr>
<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 align="left">
{section name=nb_i start=0 loop=$nb_table step=1}
@@ -132,12 +120,10 @@
{/section}
</td>
<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>
</tr>
</table>
<script type="text/javascript">showTable(current);</script>
</form>
</div>
{/block}
{/block}
@@ -101,7 +101,7 @@
<a href="{$module->addons_buy_url}" target="_blank" class="button updated"><span><img src="../img/admin/cart_addons.png">&nbsp;&nbsp;{if isset($module->id_currency) && isset($module->price)}{displayPrice price=$module->price currency=$module->id_currency}{/if}</span></a>
</li>
{else}
{if $module->id && isset($module->version_addons) && $module->version_addons}
{if isset($module->version_addons) && $module->version_addons}
<li><a href="{$module->options.update_url}" class="button updated"><span>{l s='Update it!'}</span></a></li>
{/if}
<li>
@@ -153,7 +153,7 @@
<br />
<fieldset>
<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 />
{if ($customer->isGuest())}
{l s='This order has been placed by a guest.'}
@@ -166,7 +166,7 @@
</tr>
<tr class="redirect_product_options" style="display:none">
<td class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
{include file="controllers/products/multishop/checkbox.tpl" field="redirect_type" type="radio" onclick=""}
<label class="text">{l s='Redirect:'}</label>
</td>
<td style="padding-bottom:5px;">
@@ -184,7 +184,7 @@
</tr>
<tr class="redirect_product_options redirect_product_options_product_choise" style="display:none">
<td class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="active" type="radio" onclick=""}
{include file="controllers/products/multishop/checkbox.tpl" field="id_product_redirected" type="radio" onclick=""}
<label class="text">{l s='Related product:'}</label>
</td>
<td style="padding-bottom:5px;">
@@ -178,7 +178,7 @@ $(document).ready(function () {
</tr>
<tr {if !$ps_use_ecotax} style="display:none;"{/if}>
<td class="col-left">
{include file="controllers/products/multishop/checkbox.tpl" field="ecot" type="default"}
{include file="controllers/products/multishop/checkbox.tpl" field="ecotax" type="default"}
<label>{l s='Eco-tax (tax incl.):'}</label>
</td>
<td>
@@ -75,7 +75,7 @@
<p>{l s='Click "Save and Stay" after changing selected suppliers to display the associated product references.'}</p>
<div id="suppliers_accordion" style="margin-top:10px; display:block;">
{foreach from=$associated_suppliers item=supplier}
<h3 style="margin-bottom:0;"><a href="#">{$supplier->name}</a></h3>
<h3 style="margin-bottom:0;"><a href="#">{if isset($supplier->name)}{$supplier->name}{/if}</a></h3>
<div style="display:block;">
<table cellpadding="10" cellspacing="0" class="table">
@@ -45,7 +45,7 @@
{l s='The field `request_uri` is the URL from which the customers come to your website.'}<br />
{l s='For example, if the visitor accesses a product page, the URL will be'} "{$uri}music-ipods/1-ipod-nano.html".<br />
{l s='This is helpful because you can add tags or tokens in the links pointing to your website.'}
{l s='For example, you can post a link "%dindex.php?prestashop" in the forum and get statistics by entering "%prestashop" in the field `request_uri`. '}
{l s='For example, you can post a link "%1$sindex.php?prestashop" in the forum and get statistics by entering "%%prestashop" in the field `request_uri`. ' sprintf=[$uri]}
{l s='This method is more reliable than the `http_referer`, but there is one disadvantage. If a search engine references a page with your link, then it will be displayed in the search results and you will not only have visitors from the forum, but also those from the search engine.'}
</li>
<br />
@@ -30,7 +30,7 @@
{if isset($fields.title)}<h2>{$fields.title}</h2>{/if}
{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}
<input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" />
{/if}
@@ -34,7 +34,7 @@
{block name="defaultOptions"}
<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['id'])} id={$categoryData['id']} {/if}
method="post"
@@ -36,7 +36,7 @@
{if $k == 'modules-list'}
<div id="modules_list_container" style="display:none">
<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 id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div>
<div id="modules_list_container_tab" style="display:none;"></div>
+2 -2
View File
@@ -139,7 +139,7 @@ class AttributeCore extends ObjectModel
ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$id_lang.')
'.Shop::addSqlAssociation('attribute_group', 'ag').'
'.Shop::addSqlAssociation('attribute', 'a').'
'.($not_null ? 'WHERE a.`id_attribute` IS NOT NULL AND al.`name` IS NOT NULL' : '').'
'.($not_null ? 'WHERE a.`id_attribute` IS NOT NULL AND al.`name` IS NOT NULL AND agl.`id_attribute_group` IS NOT NULL' : '').'
ORDER BY agl.`name` ASC, a.`position` ASC
');
}
@@ -343,4 +343,4 @@ class AttributeCore extends ObjectModel
return (is_numeric($position)) ? $position : -1;
}
}
}
+1
View File
@@ -340,6 +340,7 @@ class CartCore extends ObjectModel
'.($filter == CartRule::FILTER_ACTION_SHIPPING ? 'AND free_shipping = 1' : '').'
'.($filter == CartRule::FILTER_ACTION_GIFT ? 'AND gift_product != 0' : '').'
'.($filter == CartRule::FILTER_ACTION_REDUCTION ? 'AND (reduction_percent != 0 OR reduction_amount != 0)' : '')
.' ORDER by cr.priority ASC'
);
Cache::store($cache_key, $result);
}
+19 -1
View File
@@ -58,7 +58,8 @@ class ConfigurationTestCore
'theme_cache_dir' => 'themes/'._THEME_NAME_.'/cache/',
'translations_dir' => 'translations',
'customizable_products_dir' => 'upload',
'virtual_products_dir' => 'download'
'virtual_products_dir' => 'download',
'files' => false
);
}
@@ -318,4 +319,21 @@ class ConfigurationTestCore
{
return extension_loaded('Dom');
}
public static function test_files()
{
$files = array(
'/cache/smarty/compile/index.php',
'/classes/log/index.php',
'/classes/cache/index.php',
'/config/index.php',
'/tools/tar/Archive_Tar.php',
'/tools/pear/PEAR.php',
'/index.php'
);
foreach ($files as $file)
if (!file_exists(rtrim(_PS_ROOT_DIR_, DIRECTORY_SEPARATOR).str_replace('/', DIRECTORY_SEPARATOR, $file)))
return false;
return true;
}
}
+20 -1
View File
@@ -81,6 +81,7 @@ class CurrencyCore extends ObjectModel
/** @var array Currency cache */
static protected $currencies = array();
protected static $countActiveCurrencies = array();
protected $webserviceParameters = array(
'objectsNodeName' => 'currencies',
@@ -414,5 +415,23 @@ class CurrencyCore extends ObjectModel
self::$currencies[(int)($id)] = new Currency($id);
return self::$currencies[(int)($id)];
}
}
public static function countActiveCurrencies($id_shop = null)
{
if ($id_shop === null)
$id_shop = (int)Context::getContext()->shop->id;
if (!isset(self::$countActiveCurrencies[$id_shop]))
self::$countActiveCurrencies[$id_shop] = Db::getInstance()->getValue('
SELECT COUNT(DISTINCT c.id_currency) FROM `'._DB_PREFIX_.'currency` c
LEFT JOIN '._DB_PREFIX_.'currency_shop cs ON (cs.id_currency = c.id_currency AND cs.id_shop = '.(int)$id_shop.')
WHERE c.`active` = 1
');
return self::$countActiveCurrencies[$id_shop];
}
public static function isMultiCurrencyActivated($id_shop = null)
{
return (Currency::countActiveCurrencies($id_shop) > 1);
}
}
+34 -54
View File
@@ -91,12 +91,8 @@ class LinkCore
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
$shop = new Shop($id_shop);
else
$shop = Context::getContext()->shop;
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($product))
{
@@ -163,11 +159,7 @@ class LinkCore
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
if (!is_object($category))
$category = new Category($category, $id_lang);
@@ -206,11 +198,7 @@ class LinkCore
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($cms_category))
@@ -239,19 +227,12 @@ class LinkCore
* @param int $id_lang
* @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)
$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();
if (!is_object($cms))
@@ -290,11 +271,8 @@ class LinkCore
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($supplier))
@@ -327,11 +305,7 @@ class LinkCore
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if ($id_shop === null)
$shop = Context::getContext()->shop;
else
$shop = new Shop($id_shop);
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop);
$url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop);
$dispatcher = Dispatcher::getInstance();
if (!is_object($manufacturer))
@@ -360,18 +334,12 @@ class LinkCore
* @param int $id_lang
* @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)
$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);
// If the module has its own route ... just use it !
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang, $id_shop))
@@ -453,10 +421,9 @@ class LinkCore
*
* @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);
if (!$id_lang)
$id_lang = (int)Context::getContext()->language->id;
@@ -469,17 +436,9 @@ class LinkCore
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);
$url = ($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain;
$url .= $shop->getBaseURI().$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
return $url;
return $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop).ltrim($uri_path, '/');
}
public function getCatImageLink($name, $id_category, $type = null)
@@ -643,5 +602,26 @@ class LinkCore
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();
}
}
+6 -1
View File
@@ -235,8 +235,13 @@ class MailCore
include_once($template_path.$iso.'/lang.php');
else if ($module_name && file_exists($theme_path.'mails/'.$iso.'/lang.php'))
include_once($theme_path.'mails/'.$iso.'/lang.php');
else
else if (file_exists(_PS_MAIL_DIR_.$iso.'/lang.php'))
include_once(_PS_MAIL_DIR_.$iso.'/lang.php');
else
{
Tools::dieOrLog(Tools::displayError('Error - The lang file is missing for :').' '.$iso, $die);
return false;
}
/* Create mail and attach differents parts */
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
+30 -9
View File
@@ -893,7 +893,7 @@ abstract class ObjectModelCore
* @param int $id_lang
* @return bool|string
*/
public function validateField($field, $value, $id_lang = null)
public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{
$this->cacheFieldsRequiredDatabase();
$data = $this->def['fields'][$field];
@@ -901,9 +901,12 @@ abstract class ObjectModelCore
// Check if field is required
$required_fields = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
if (!$id_lang || $id_lang == Configuration::get('PS_LANG_DEFAULT'))
if (!empty($data['required']) || in_array($field, $required_fields))
if (!in_array('required', $skip) && (!empty($data['required']) || in_array($field, $required_fields)))
if (Tools::isEmpty($value))
return 'Property '.get_class($this).'->'.$field.' is empty';
if ($human_errors)
return sprintf(Tools::displayError('The %s field is required.'), $this->displayFieldName($field, get_class($this)));
else
return 'Property '.get_class($this).'->'.$field.' is empty';
// Default value
if (!$value && !empty($data['default']))
@@ -913,11 +916,11 @@ abstract class ObjectModelCore
}
// Check field values
if (!empty($data['values']) && is_array($data['values']) && !in_array($value, $data['values']))
return 'Property '.get_class($this).'->'.$field.' has bad value (allowed values are: '.implode(', ', $data['values']).')';
if (!in_array('values', $skip) && !empty($data['values']) && is_array($data['values']) && !in_array($value, $data['values']))
return 'Property '.get_class($this).'->'.$field.' has bad value (allowed values are: '.implode(', ', $data['values']).')';
// Check field size
if (!empty($data['size']))
if (!in_array('size', $skip) && !empty($data['size']))
{
$size = $data['size'];
if (!is_array($data['size']))
@@ -925,11 +928,24 @@ abstract class ObjectModelCore
$length = Tools::strlen($value);
if ($length < $size['min'] || $length > $size['max'])
return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max'];
{
if ($human_errors)
{
if (isset($data['lang']) && $data['lang'])
{
$language = new Language((int)$id_lang);
return sprintf(Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'), $this->displayFieldName($field, get_class($this)), $language->name, $size['max']);
}
else
return sprintf(Tools::displayError('The %1$s field is too long (%2$d chars max).'), $this->displayFieldName($field, get_class($this)), $size['max']);
}
else
return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max'];
}
}
// Check field validator
if (!empty($data['validate']))
if (!in_array('validate', $skip) && !empty($data['validate']))
{
if (!method_exists('Validate', $data['validate']))
throw new PrestaShopException('Validation function not found. '.$data['validate']);
@@ -948,7 +964,12 @@ abstract class ObjectModelCore
$res = false;
}
if (!$res)
return 'Property '.get_class($this).'->'.$field.' is not valid';
{
if ($human_errors)
return sprintf(Tools::displayError('The %s field is invalid.'), $this->displayFieldName($field, get_class($this)));
else
return 'Property '.get_class($this).'->'.$field.' is not valid';
}
}
}
+9 -3
View File
@@ -399,6 +399,8 @@ abstract class PaymentModuleCore extends Module
} // end foreach ($products)
$cart_rules_list = '';
$total_reduction_value_ti = 0;
$total_reduction_value_tex = 0;
foreach ($cart_rules as $cart_rule)
{
$package = array('id_carrier' => $order->id_carrier, 'id_address' => $order->id_address_delivery, 'products' => $order->product_list);
@@ -419,7 +421,8 @@ abstract class PaymentModuleCore extends Module
** THEN
** The voucher is cloned with a new value corresponding to the remainder
*/
if (count($order_list) == 1 && $values['tax_incl'] > $order->total_products_wt && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0)
if (count($order_list) == 1 && $values['tax_incl'] > ($order->total_products_wt - $total_reduction_value_ti) && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0)
{
// Create a new voucher from the original
$voucher = new CartRule($cart_rule['obj']->id); // We need to instantiate the CartRule without lang parameter to allow saving it
@@ -432,9 +435,9 @@ abstract class PaymentModuleCore extends Module
// Set the new voucher value
if ($voucher->reduction_tax)
$voucher->reduction_amount = $values['tax_incl'] - $order->total_products_wt - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_incl : 0);
$voucher->reduction_amount = $values['tax_incl'] - ($order->total_products_wt - $total_reduction_value_ti) - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_incl : 0);
else
$voucher->reduction_amount = $values['tax_excl'] - $order->total_products - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_excl : 0);
$voucher->reduction_amount = $values['tax_excl'] - ($order->total_products - $total_reduction_value_tex) - ($voucher->free_shipping == 1 ? $order->total_shipping_tax_excl : 0);
$voucher->id_customer = $order->id_customer;
$voucher->quantity = 1;
@@ -466,7 +469,10 @@ abstract class PaymentModuleCore extends Module
$values['tax_incl'] -= $values['tax_incl'] - $order->total_products_wt;
$values['tax_excl'] -= $values['tax_excl'] - $order->total_products;
}
$total_reduction_value_ti += $values['tax_incl'];
$total_reduction_value_tex += $values['tax_excl'];
$order->addCartRule($cart_rule['obj']->id, $cart_rule['obj']->name, $values, 0, $cart_rule['obj']->free_shipping);
+12 -11
View File
@@ -730,10 +730,10 @@ class ProductCore extends ObjectModel
/**
* @see ObjectModel::validateField()
*/
public function validateField($field, $value, $id_lang = null)
public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{
$value = ($field == 'description_short' ? strip_tags($value) : $value);
return parent::validateField($field, $value, $id_lang);
return parent::validateField($field, $value, $id_lang, $skip, $human_errors);
}
public function toggleStatus()
@@ -2468,8 +2468,9 @@ class ProductCore extends ObjectModel
if (!Validate::isBool($usetax) || !Validate::isUnsignedId($id_product))
die(Tools::displayError());
// Initializations
$id_group = (isset($context->customer) ? $context->customer->id_default_group : (int)Configuration::get('PS_CUSTOMER_GROUP'));
$id_group = (int)Group::getCurrent()->id;
// If there is cart in context or if the specified id_cart is different from the context cart id
if (!is_object($cur_cart) || (Validate::isUnsignedInt($id_cart) && $id_cart && $cur_cart->id != $id_cart))
@@ -3055,18 +3056,18 @@ class ProductCore extends ObjectModel
if (!Combination::isFeatureActive())
return array();
$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`,
IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`,
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`, product_attribute_shop.`weight`,
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
'.Shop::addSqlAssociation('product_attribute', '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_.'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_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_.'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_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_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`)
'.Shop::addSqlAssociation('attribute', 'a').'
WHERE pa.`id_product` = '.(int)$this->id.'
AND al.`id_lang` = '.(int)$id_lang.'
+18 -20
View File
@@ -704,6 +704,21 @@ class ToolsCore
}
return false;
}
/**
* Delete file
*
* @param string File path
* @param array Excluded files
*/
public static function deleteFile($file, $exclude_files = array())
{
if (isset($exclude_files) && !is_array($exclude_files))
$exclude_files = array($exclude_files);
if (file_exists($file) && is_file($file) && array_search(basename($file), $exclude_files) === FALSE)
unlink($file);
}
/**
* Clear smarty cache folders
@@ -1408,26 +1423,9 @@ class ToolsCore
public static function copy($source, $destination, $stream_context = null)
{
if ($stream_context == null && preg_match('/^https?:\/\//', $source))
$stream_context = @stream_context_create(array('http' => array('timeout' => 10)));
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;
if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source))
return @copy($source, $destination);
return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context));
}
/**
+29 -90
View File
@@ -45,7 +45,7 @@ class AdminControllerCore extends Controller
public $template = 'content.tpl';
/** @var string Associated table name */
public $table;
public $table = 'configuration';
public $list_id;
@@ -2426,102 +2426,41 @@ class AdminControllerCore extends Controller
if (!$class_name)
$class_name = $this->className;
/* Class specific validation rules */
if (!empty($class_name))
$rules = call_user_func(array($class_name, 'getValidationRules'), $class_name);
$object = new $class_name();
$definition = ObjectModel::getDefinition($class_name);
$default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
if (isset($rules) && count($rules) && (count($rules['requiredLang']) || count($rules['sizeLang']) || count($rules['validateLang'])))
foreach ($definition['fields'] as $field => $def)
{
/* Language() instance determined by default language */
$default_language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$skip = array();
if (in_array($field, array('passwd', 'no-picture')))
$skip = array('required');
/* All availables languages */
$languages = Language::getLanguages(false);
if (isset($def['lang']) && $def['lang'] && isset($def['required']) && $def['required'])
{
$value = Tools::getValue($field.'_'.$default_language->id);
if (Tools::isEmpty($value))
$this->errors[$field.'_'.$default_language->id] = sprintf(
Tools::displayError('The field %1$s is required at least in %2$s.'),
$object->displayFieldName($field, $class_name),
$default_language->name
);
foreach (Language::getLanguages(false) as $language)
{
$value = Tools::getValue($field.'_'.$language['id_lang']);
if (!empty($value))
if (($error = $object->validateField($field, $value, $language['id_lang'], $skip, true)) !== true)
$this->errors[$field.'_'.$language['id_lang']] = $error;
}
}
else
if (($error = $object->validateField($field, Tools::getValue($field), null, $skip, true)) !== true)
$this->errors[$field] = $error;
}
/* Checking for required fields */
if (isset($rules['required']) && is_array($rules['required']))
foreach ($rules['required'] as $field)
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
$this->errors[$field] = sprintf(
Tools::displayError('The %s field is required.'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
);
/* Checking for multilingual required fields */
if (isset($rules['requiredLang']) && is_array($rules['requiredLang']))
foreach ($rules['requiredLang'] as $field_lang)
if (($empty = Tools::getValue($field_lang.'_'.$default_language->id)) === false || $empty !== '0' && empty($empty))
$this->errors[$field_lang.'_'.$default_language->id] = sprintf(
Tools::displayError('The field %1$s is required at least in %2$s.'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$default_language->name
);
/* Checking for maximum fields sizes */
if (isset($rules['size']) && is_array($rules['size']))
foreach ($rules['size'] as $field => $max_length)
if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length)
$this->errors[$field] = sprintf(
Tools::displayError('The %1$s field is too long (%2$d chars max).'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name),
$max_length
);
/* Checking for maximum multilingual fields size */
if (isset($rules['sizeLang']) && is_array($rules['sizeLang']))
foreach ($rules['sizeLang'] as $field_lang => $max_length)
foreach ($languages as $language)
{
$field_lang_value = Tools::getValue($field_lang.'_'.$language['id_lang']);
if ($field_lang_value !== false && Tools::strlen($field_lang_value) > $max_length)
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$language['name'],
$max_length
);
}
/* Overload this method for custom checking */
$this->_childValidation();
/* Checking for fields validity */
if (isset($rules['validate']) && is_array($rules['validate']))
foreach ($rules['validate'] as $field => $function)
if (($value = Tools::getValue($field)) !== false && ($field != 'passwd'))
if (!Validate::$function($value) && !empty($value))
$this->errors[$field] = sprintf(
Tools::displayError('The %s field is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
);
/* Checking for passwd_old validity */
if (($value = Tools::getValue('passwd')) != false)
{
if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value))
$this->errors['passwd'] = sprintf(
Tools::displayError('The %s field is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
);
elseif ($class_name == 'Customer' && !Validate::isPasswd($value))
$this->errors['passwd'] = sprintf(
Tools::displayError('The %s field is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
);
}
/* Checking for multilingual fields validity */
if (isset($rules['validateLang']) && is_array($rules['validateLang']))
foreach ($rules['validateLang'] as $field_lang => $function)
foreach ($languages as $language)
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
if (!Validate::$function($value))
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
Tools::displayError('The %1$s field (%2$s) is invalid.'),
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
$language['name']
);
}
/**
+7 -3
View File
@@ -65,6 +65,9 @@ class FrontControllerCore extends Controller
parent::__construct();
if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE'))
$this->ssl = true;
if (isset($useSSL))
$this->ssl = $useSSL;
else
@@ -144,8 +147,6 @@ class FrontControllerCore extends Controller
// Init cookie language
// @TODO This method must be moved into switchLanguage
Tools::setCookieLanguage($this->context->cookie);
$currency = Tools::setCurrency($this->context->cookie);
$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;
@@ -167,6 +168,8 @@ class FrontControllerCore extends Controller
if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($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)))
{
$this->context->customer->logout();
@@ -600,7 +603,7 @@ class FrontControllerCore extends Controller
if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit'))
return;
$match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$match_url = (Configuration::get('PS_SSL_ENABLED') && ($this->ssl || Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$match_url = rawurldecode($match_url);
if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonical_url), '/').'([&?].*)?$/', $match_url))
{
@@ -670,6 +673,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))
$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))))
+2 -2
View File
@@ -35,10 +35,10 @@ class HelperFormCore extends Helper
/** @var array of forms fields */
protected $fields_form = array();
/** @var array values of form fields */
/** @var array values of form fields */
public $fields_value = array();
public $table;
public $table = 'configuration';
public $name_controller = '';
/** @var string if not null, a title will be added on that list */
+3 -3
View File
@@ -136,6 +136,9 @@ class HelperListCore extends Helper
$this->_list = $list;
$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)
$tpl_vars['header'] = $this->displayListHeader();
@@ -522,9 +525,6 @@ class HelperListCore extends Helper
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))
$table_id = substr($this->identifier, 3, strlen($this->identifier));
+20 -13
View File
@@ -938,7 +938,7 @@ abstract class ModuleCore
public static function configXmlStringFormat($string)
{
return str_replace('\'', '\\\'', Tools::htmlentitiesDecodeUTF8($string));
return Tools::htmlentitiesDecodeUTF8($string);
}
@@ -1630,15 +1630,18 @@ abstract class ModuleCore
protected function getCacheId($name = null)
{
$cache_array = array(
$name !== null ? $name : $this->name,
(int)Tools::usingSecureMode(),
(int)$this->context->shop->id,
(int)Group::getCurrent()->id,
(int)$this->context->language->id,
(int)$this->context->currency->id,
(int)$this->context->country->id
);
$cache_array = array();
$cache_array[] = $name !== null ? $name : $this->name;
if (Configuration::get('PS_SSL_ENABLED'))
$cache_array[] = (int)Tools::usingSecureMode();
if (Shop::isFeatureActive())
$cache_array[] = (int)$this->context->shop->id;
$cache_array[] = (int)Group::getCurrent()->id;
if (Language::isMultiLanguageActivated())
$cache_array[] = (int)$this->context->language->id;
if (Currency::isMultiCurrencyActivated())
$cache_array[] = (int)$this->context->currency->id;
$cache_array[] = (int)$this->context->country->id;
return implode('|', $cache_array);
}
@@ -1701,10 +1704,12 @@ abstract class ModuleCore
if ($overloaded)
return $overloaded;
else if (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template))
elseif (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template))
return _PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template;
else
elseif (file_exists(_PS_MODULE_DIR_.$this->name.'/'.$template))
return _PS_MODULE_DIR_.$this->name.'/'.$template;
else
return null;
}
protected function _getApplicableTemplateDir($template)
@@ -1724,6 +1729,8 @@ abstract class ModuleCore
protected function _clearCache($template, $cache_id = null, $compile_id = null)
{
Tools::enableCache();
if ($cache_id === null)
$cache_id = Module::getCacheId($this->name);
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath($template), $cache_id, $compile_id);
Tools::restoreCacheSettings();
}
@@ -2075,7 +2082,7 @@ abstract class ModuleCore
// Remplacer la ligne de declaration par "remove"
foreach ($override_file as $line_number => &$line_content)
if (preg_match('/(public|private|protected)\s+(static\s+)?\$'.$property->getName().'/i', $line_content))
if (preg_match('/(public|private|protected|const)\s+(static\s+)?(\$)?'.$property->getName().'/i', $line_content))
{
$line_content = '#--remove--#';
break;
+1 -1
View File
@@ -305,7 +305,7 @@ class StockAvailableCore extends ObjectModel
if (!Validate::isUnsignedId($id_product))
return false;
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop);
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, $id_shop);
if ($existing_id > 0)
{
Db::getInstance()->update(
@@ -77,7 +77,7 @@ class AdminAddressesControllerCore extends AdminController
parent::initToolbar();
if (!$this->display)
$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')
);
}
@@ -246,7 +246,7 @@ class AdminCategoriesControllerCore extends AdminController
'desc' => $this->l('Add New')
);
$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')
);
}
@@ -190,7 +190,7 @@ class AdminCustomersControllerCore extends AdminController
else if (!$this->display) //display import button only on listing
{
$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')
);
}
@@ -341,9 +341,7 @@ class AdminEmployeesControllerCore extends AdminController
if (!($obj = $this->loadObject(true)))
return false;
$email = $this->getFieldValue($obj, 'email');
if (!Validate::isEmail($email))
$this->errors[] = Tools::displayError('Invalid email address.');
elseif (Employee::employeeExists($email) && (!Tools::getValue('id_employee') || ($employee = new Employee((int)Tools::getValue('id_employee'))) && $employee->email != $email))
if (Validate::isEmail($email) && Employee::employeeExists($email) && (!Tools::getValue('id_employee') || ($employee = new Employee((int)Tools::getValue('id_employee'))) && $employee->email != $email))
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$email;
}
@@ -142,7 +142,7 @@ class AdminFeaturesControllerCore extends AdminController
$this->_where = sprintf('AND `id_feature` = %d', (int)$id);
// get list and force no limit clause in the request
$this->getList($this->context->language->id);
$this->getList($this->context->language->id, 'id_feature_value', 'ASC');
// Render list
$helper = new HelperList();
@@ -151,8 +151,6 @@ class AdminFeaturesControllerCore extends AdminController
$helper->shopLinkType = '';
$helper->identifier = $this->identifier;
$helper->toolbar_scroll = false;
$helper->orderBy = 'position';
$helper->orderWay = 'ASC';
$helper->currentIndex = self::$currentIndex;
$helper->token = $this->token;
$helper->table = $this->table;
+28 -18
View File
@@ -30,6 +30,7 @@ class AdminGroupsControllerCore extends AdminController
{
$this->table = 'group';
$this->className = 'Group';
$this->list_id = 'group';
$this->lang = true;
$this->addRowAction('edit');
$this->addRowAction('view');
@@ -153,6 +154,16 @@ class AdminGroupsControllerCore extends AdminController
if (Tools::isSubmit('changeShowPricesVal') && $this->id_object)
$this->action = 'change_show_prices_val';
if (Tools::getIsset('viewgroup'))
{
$this->list_id = 'customer_group';
if (isset($_POST['submitReset'.$this->list_id]))
$this->processResetFilters();
}
else
$this->list_id = 'group';
parent::initProcess();
}
@@ -181,30 +192,29 @@ class AdminGroupsControllerCore extends AdminController
$genders_icon[$gender->id] = '../genders/'.(int)$gender->id.'.jpg';
$genders[$gender->id] = $gender->name;
}
$customer_fields_display = (array(
'id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center'),
$this->table = 'customer_group';
$this->lang = false;
$this->list_id = 'customer_group';
$this->actions = array();
$this->bulk_actions = false;
$this->list_no_link = true;
$this->fields_list = (array(
'id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center', 'filter_key' => 'c!id_customer'),
'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'width' => 50,'icon' => $genders_icon, 'list' => $genders),
'firstname' => array('title' => $this->l('Name'), 'align' => 'center'),
'lastname' => array('title' => $this->l('Name'), 'align' => 'center'),
'email' => array('title' => $this->l('Email address'), 'width' => 150, 'align' => 'center'),
'firstname' => array('title' => $this->l('First name'), 'align' => 'center'),
'lastname' => array('title' => $this->l('Last name'), 'align' => 'center'),
'email' => array('title' => $this->l('Email address'), 'width' => 150, 'align' => 'center', 'filter_key' => 'c!email', 'orderby' => true),
'birthday' => array('title' => $this->l('Birth date'), 'width' => 150, 'align' => 'right', 'type' => 'date'),
'date_add' => array('title' => $this->l('Register date'), 'width' => 150, 'align' => 'right', 'type' => 'date'),
'orders' => array('title' => $this->l('Orders'), 'align' => 'center'),
'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool')
));
$customer_list = $group->getCustomers(false, 0, 100, true);
$helper = new HelperList();
$helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false);
$helper->token = Tools::getAdminTokenLite('AdminCustomers');
$helper->shopLinkType = '';
$helper->table = 'customer';
$helper->identifier = 'id_customer';
$helper->actions = array('edit', 'view');
$helper->show_toolbar = false;
return $helper->generateList($customer_list, $customer_fields_display);
$this->_select = 'c.*';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (a.`id_customer` = c.`id_customer`)';
$this->_where = 'AND a.`id_group` = '.(int)$group->id.' AND c.`deleted` != 1';
self::$currentIndex = self::$currentIndex.'&viewgroup';
$this->processFilter();
return parent::renderList();
}
public function renderForm()
+60 -35
View File
@@ -363,10 +363,13 @@ class AdminImportControllerCore extends AdminController
'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')),
);
break;
// @since 1.5.0
case $this->entities[$this->l('Supply Orders')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
}
// @since 1.5.0
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
switch ((int)Tools::getValue('entity'))
{
case $this->entities[$this->l('Supply Orders')]:
// required fields
$this->required_fields = array(
'id_supplier',
@@ -394,12 +397,8 @@ class AdminImportControllerCore extends AdminController
'discount_rate' => '0',
'is_template' => '0',
);
}
break;
// @since 1.5.0
case $this->entities[$this->l('Supply Order Details')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
{
break;
case $this->entities[$this->l('Supply Order Details')]:
// required fields
$this->required_fields = array(
'supply_order_reference',
@@ -423,8 +422,9 @@ class AdminImportControllerCore extends AdminController
'discount_rate' => '0',
'tax_rate' => '0',
);
}
}
break;
}
$this->separator = strval(trim(Tools::getValue('separator', ';')));
@@ -465,11 +465,25 @@ class AdminImportControllerCore extends AdminController
$this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen');
$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(
'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)),
'path_import' => _PS_ADMIN_DIR_.'/import/',
'entities' => $this->entities,
'entity' => Tools::getValue('entity'),
'entity_selected' => $entity_selected,
'csv_selected' => $csv_selected,
'files_to_import' => $files_to_import,
'languages' => Language::getLanguages(false),
'id_language' => $this->context->language->id,
@@ -497,6 +511,11 @@ class AdminImportControllerCore extends AdminController
for ($i = 0; $i < $nb_table; $i++)
$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(
'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'),
'fields_value' => array(
@@ -506,6 +525,7 @@ class AdminImportControllerCore extends AdminController
'iso_lang' => Tools::getValue('iso_lang'),
'truncate' => Tools::getValue('truncate'),
'forceIDs' => Tools::getValue('forceIDs'),
'regenerate' => Tools::getValue('regenerate'),
'match_ref' => Tools::getValue('match_ref'),
'separator' => $this->separator,
'multiple_value_separator' => $this->multiple_value_separator
@@ -795,7 +815,7 @@ class AdminImportControllerCore extends AdminController
* @param string entity 'products' or 'categories'
* @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');
$watermark_types = explode(',', Configuration::get('WATERMARK_TYPES'));
@@ -823,11 +843,14 @@ class AdminImportControllerCore extends AdminController
{
ImageManager::resize($tmpfile, $path.'.jpg');
$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))
Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity));
if ($regenerate)
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
{
@@ -976,7 +999,7 @@ class AdminImportControllerCore extends AdminController
}
//copying images of categories
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.');
// If both failed, mysql error
if (!$res)
@@ -1438,7 +1461,7 @@ class AdminImportControllerCore extends AdminController
{
// associate image to selected 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();
$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())
{
$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);
$image->delete();
@@ -2720,7 +2743,6 @@ class AdminImportControllerCore extends AdminController
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Products')]:
$import_type = $this->l('Categories');
$this->productImport();
$this->clearSmartyCache();
break;
@@ -2742,19 +2764,22 @@ class AdminImportControllerCore extends AdminController
$this->supplierImport();
$this->clearSmartyCache();
break;
// @since 1.5.0
case $this->entities[$import_type = $this->l('Supply Orders')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersImport();
break;
// @since 1.5.0
case $this->entities[$import_type = $this->l('Supply Order Details')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersDetailsImport();
break;
default:
$this->errors[] = $this->l('Please select what you would like to import');
}
// @since 1.5.0
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
switch ((int)Tools::getValue('entity'))
{
case $this->entities[$import_type = $this->l('Supply Orders')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersImport();
break;
case $this->entities[$import_type = $this->l('Supply Order Details')]:
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'))
$this->supplyOrdersDetailsImport();
break;
}
if ($import_type !== false)
{
$log_message = sprintf($this->l('%s import'), $import_type);
@@ -2821,4 +2846,4 @@ class AdminImportControllerCore extends AdminController
die;
}
}
}
}
@@ -58,10 +58,8 @@ class AdminInvoicesControllerCore extends AdminController
'PS_INVOICE_FREE_TEXT' => array(
'title' => $this->l('Footer text:'),
'desc' => $this->l('This text will appear at the bottom of the invoice'),
'size' => 6,
'type' => 'textareaLang',
'cols' => 40,
'rows' => 8
'size' => 50,
'type' => 'textLang',
),
'PS_INVOICE_MODEL' => array(
'title' => $this->l('Invoice model:'),
@@ -570,7 +570,7 @@ class AdminManufacturersControllerCore extends AdminController
default:
parent::initToolbar();
$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')
);
}
+3 -3
View File
@@ -651,7 +651,7 @@ class AdminModulesControllerCore extends AdminController
$this->errors[] = $this->l('Module not found');
elseif ($key == 'install' && $this->tabAccess['add'] !== '1')
$this->errors[] = Tools::displayError('You do not have permission to install this module.');
elseif ($key == 'uninstall' && ($this->tabAccess['delete'] !== '1' || !$module->getPermission('configure')))
elseif ($key == 'delete' && ($this->tabAccess['delete'] !== '1' || !$module->getPermission('configure')))
$this->errors[] = Tools::displayError('You do not have permission to delete this module.');
elseif ($key == 'configure' && ($this->tabAccess['edit'] !== '1' || !$module->getPermission('configure') || !Module::isInstalled(urldecode($name))))
$this->errors[] = Tools::displayError('You do not have permission to configure this module.');
@@ -1108,8 +1108,8 @@ class AdminModulesControllerCore extends AdminController
$modules[$km]->preferences = $modules_preferences[$modules[$km]->name];
}
unset($object);
if (isset($module->version_addons))
$upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->displayName);;
if ($module->installed && isset($module->version_addons) && $module->version_addons)
$upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->displayName);
}
// Don't display categories without modules
+4 -1
View File
@@ -805,7 +805,7 @@ class AdminOrdersControllerCore extends AdminController
if (!Validate::isLoadedObject($order))
$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.');
elseif (!Validate::isString(Tools::getValue('payment_method')))
$this->errors[] = Tools::displayError('The selected payment method is invalid.');
@@ -1342,11 +1342,14 @@ class AdminOrdersControllerCore extends AdminController
$product['warehouse_name'] = '--';
}
$gender = new Gender((int)$customer->id_gender, $this->context->language->id);
// Smarty assign
$this->tpl_view_vars = array(
'order' => $order,
'cart' => new Cart($order->id_cart),
'customer' => $customer,
'gender' => $gender,
'customer_addresses' => $customer->getAddresses($this->context->language->id),
'addresses' => array(
'delivery' => $addressDelivery,
@@ -86,6 +86,19 @@ class AdminPreferencesControllerCore extends AdminController
'type' => 'bool',
'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(
'title' => $this->l('Increase Front Office 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,
'identifier' => 'value'
),
);
));
// No HTTPS activation if you haven't already.
if (!Tools::usingSecureMode() && !Configuration::get('PS_SSL_ENABLED'))
@@ -2023,7 +2023,7 @@ class AdminProductsControllerCore extends AdminController
// Check multilingual fields validity
foreach ($rules['validateLang'] as $fieldLang => $function)
foreach ($languages as $language)
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue($fieldLang.'_'.$language['id_lang'])))
if ($this->isProductFieldUpdated($fieldLang, $language['id_lang']) && ($value = Tools::getValue($fieldLang.'_'.$language['id_lang'])))
if (!Validate::$function($value, (int)Configuration::get('PS_ALLOW_HTML_IFRAME')))
$this->errors[] = sprintf(
Tools::displayError('The %1$s field (%2$s) is invalid.'),
@@ -2437,7 +2437,7 @@ class AdminProductsControllerCore extends AdminController
}
else
$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')
);
@@ -262,6 +262,24 @@ class AdminSuppliersControllerCore extends AdminController
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()
{
$products = $this->object->getProductsLite($this->context->language->id);
+3
View File
@@ -52,6 +52,9 @@ class CartControllerCore extends FrontController
{
parent::init();
// Send noindex to avoid ghost carts by bots
header("X-Robots-Tag: noindex, nofollow", true);
// Get page main parameters
$this->id_product = (int)Tools::getValue('id_product', null);
$this->id_product_attribute = (int)Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
@@ -372,6 +372,7 @@ class ParentOrderControllerCore extends FrontController
'currencyFormat' => $this->context->currency->format,
'currencyBlank' => $this->context->currency->blank,
'show_option_allow_separate_package' => $show_option_allow_separate_package,
'smallSize' => Image::getSize(ImageType::getFormatedName('small')),
));
+7
View File
@@ -88,6 +88,13 @@ class InstallControllerHttpSystem extends InstallControllerHttp
'mysql_support' => $this->l('MySQL support is not activated')
)
),
array(
'title' => $this->l('Files'),
'success' => 1,
'checks' => array(
'files' => $this->l('All files are not successfuly uploaded on your server')
)
),
array(
'title' => $this->l('Recursive write permissions on files and folders:'),
'success' => 1,
+4 -4
View File
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<entity_quick_access>
<quick_access id="Home" name="Home"/>
<quick_access id="My_Shop" name="My Shop"/>
<quick_access id="New_category" name="New category"/>
<quick_access id="New_product" name="New product"/>
<quick_access id="New_voucher" name="New voucher"/>
<quick_access id="My_Shop" name="Minha Loja"/>
<quick_access id="New_category" name="Nova Categoria"/>
<quick_access id="New_product" name="Novo Produto"/>
<quick_access id="New_voucher" name="Novo Cupom"/>
</entity_quick_access>
+2 -2
View File
@@ -374,7 +374,7 @@ class InstallModelInstall extends InstallAbstractModel
if (file_exists(_PS_TMP_IMG_DIR_))
foreach (scandir(_PS_TMP_IMG_DIR_) as $file)
if ($file[0] != '.' && $file != 'index.php')
Tools::deleteDirectory(_PS_TMP_IMG_DIR_.DIRECTORY_SEPARATOR.$file);
Tools::deleteFile(_PS_TMP_IMG_DIR_.$file);
$default_data = array(
'shop_name' => 'My Shop',
@@ -465,6 +465,7 @@ class InstallModelInstall extends InstallAbstractModel
$employee->passwd = md5(_COOKIE_KEY_.$data['admin_password']);
$employee->last_passwd_gen = date('Y-m-d h:i:s', strtotime('-360 minutes'));
$employee->bo_theme = 'default';
$employee->default_tab = 1;
$employee->active = true;
$employee->id_profile = 1;
$employee->id_lang = Configuration::get('PS_LANG_DEFAULT');
@@ -520,7 +521,6 @@ class InstallModelInstall extends InstallAbstractModel
'blockcontact',
'blockcontactinfos',
'blockcurrencies',
'blockcustomerprivacy',
'blocklanguages',
'blockmanufacturer',
'blockmyaccount',
+1 -1
View File
@@ -75,7 +75,7 @@ function migrate_orders()
WHERE name = "PS_GIFT_WRAPPING_TAX"') / 100);
$cpt = 0;
$flush_limit = 1000;
$flush_limit = 500;
while ($order = Db::getInstance()->nextRow($order_res))
{
$sum_total_products = 0;
+1 -1
View File
@@ -29,6 +29,6 @@ function remove_tab($tabname)
Db::getInstance()->execute('
DELETE t, l
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).'"');
}
+5 -1
View File
@@ -10,4 +10,8 @@ ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_descrip
/* 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:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */;
/* PHP:remove_tab(AdminRangePrice); */;
/* PHP:remove_tab(AdminRangeWeight); */;
UPDATE `PREFIX_employee` SET default_tab = 1 WHERE default_tab = 0;
+1 -1
View File
@@ -1576,7 +1576,7 @@ var ProductMultishop = new function()
ProductMultishop.checkField($('input[name=\'multishop_check[id_tax_rules_group]\']').prop('checked'), 'id_tax_rules_group');
ProductMultishop.checkField($('input[name=\'multishop_check[unit_price]\']').prop('checked'), 'unit_price', 'unit_price');
ProductMultishop.checkField($('input[name=\'multishop_check[on_sale]\']').prop('checked'), 'on_sale');
ProductMultishop.checkField($('input[name=\'multishop_check[on_sale]\']').prop('checked'), 'ecotax');
ProductMultishop.checkField($('input[name=\'multishop_check[ecotax]\']').prop('checked'), 'ecotax');
};
this.checkAllSeo = function()
+1
View File
@@ -751,6 +751,7 @@ function doAdminAjax(data, success_func, error_func)
{
url : 'index.php',
data : data,
type : 'POST',
success : function(data){
if (success_func)
return success_func(data);
+4 -4
View File
@@ -153,12 +153,13 @@ function displaySummary()
$('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();
});
$('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();
});
@@ -272,7 +273,6 @@ function bind_inputs()
});
$('tr.fees td input:checkbox').off('change').on('change', function () {
if($(this).is(':checked'))
{
$(this).closest('tr').children('td').each( function () {
@@ -389,7 +389,7 @@ function hideFees()
function showFees()
{
$('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
tr = $(this).parent('tr');
-16844
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -7,9 +7,9 @@
<language iso_code="es" />
</languages>
<taxes>
<tax id="1" name="IVA BO 13%" rate="19" />
<tax id="1" name="IVA BO 13%" rate="13" />
<taxRulesGroup name="BO Standard rate (19%)">
<taxRulesGroup name="BO Standard rate (13%)">
<taxRule iso_code_country="bo" id_tax="1" />
</taxRulesGroup>
</taxes>
+10 -5
View File
@@ -9,19 +9,24 @@
</languages>
<taxes>
<tax id="1" name="增值税 CN 17%" rate="17" />
<tax id="2" name="增值税 CN 6%" rate="6" />
<tax id="3" name="增值税 CN 3%" rate="3" />
<tax id="2" name="增值税 CN 13%" rate="13" />
<tax id="3" name="增值税 CN 6%" rate="6" />
<tax id="4" name="增值税 CN 3%" rate="3" />
<taxRulesGroup name="CN Standard Rate (17%)">
<taxRule iso_code_country="cn" id_tax="1" />
</taxRulesGroup>
<taxRulesGroup name="CN Reduced Rate (6%)">
<taxRulesGroup name="CN Reduced Rate (13%)">
<taxRule iso_code_country="cn" id_tax="2" />
</taxRulesGroup>
<taxRulesGroup name="CN Super Reduced Rate (6%)">
<taxRule iso_code_country="cn" id_tax="3" />
</taxRulesGroup>
<taxRulesGroup name="CN Super Reduced Rate (3%)">
<taxRule iso_code_country="cn" id_tax="3" />
<taxRule iso_code_country="cn" id_tax="4" />
</taxRulesGroup>
</taxes>
<states>
@@ -67,4 +72,4 @@
<unit type="base_distance" value="里" />
<unit type="long_distance" value="市里" />
</units>
</localizationPack>
</localizationPack>
+1 -1
View File
@@ -8,7 +8,7 @@
<language iso_code="tr" />
</languages>
<taxes>
<tax id="1" name="ΦΠΑ CY 15%" rate="15" />
<tax id="1" name="ΦΠΑ CY 17%" rate="17" />
<tax id="2" name="ΦΠΑ CY 8%" rate="8" />
<tax id="3" name="ΦΠΑ CY 5%" rate="5" />
+5
View File
@@ -8,10 +8,15 @@
</languages>
<taxes>
<tax id="1" name="VAT EG 10%" rate="10" />
<tax id="2" name="VAT EG 15%" rate="15" />
<taxRulesGroup name="EG Standard Rate (10%)">
<taxRule iso_code_country="eg" id_tax="1" />
</taxRulesGroup>
<taxRulesGroup name="EG Communication Services (15%)">
<taxRule iso_code_country="eg" id_tax="2" />
</taxRulesGroup>
</taxes>
<units>
<unit type="weight" value="kg" />
+3 -3
View File
@@ -7,9 +7,9 @@
<language iso_code="fi" />
</languages>
<taxes>
<tax id="1" name="ALV FI 23%" rate="23" />
<tax id="2" name="ALV FI 13%" rate="13" />
<tax id="3" name="ALV FI 9%" rate="9" />
<tax id="1" name="ALV FI 24%" rate="24" />
<tax id="2" name="ALV FI 14%" rate="14" />
<tax id="3" name="ALV FI 10%" rate="10" />
<taxRulesGroup name="FI Standard Rate (23%)">
<taxRule iso_code_country="be" id_tax="1" />
+2 -2
View File
@@ -10,9 +10,9 @@
<currency name="Dollar" iso_code="FJD" iso_code_num="242" sign="$" blank="0" conversion_rate="2.57483" format="1" decimals="1" />
</currencies>
<taxes>
<tax id="1" name="VAT FJ 12.5%" rate="12.5" />
<tax id="1" name="VAT FJ 15%" rate="15" />
<taxRulesGroup name="FJ Standard Rate (12.5%)">
<taxRulesGroup name="FJ Standard Rate (15%)">
<taxRule iso_code_country="fj" id_tax="1" />
</taxRulesGroup>
</taxes>
+4 -64
View File
@@ -8,8 +8,8 @@
</languages>
<taxes>
<tax id="1" name="ΦΠΑ GR 23%" rate="23" />
<tax id="2" name="ΦΠΑ GR 11%" rate="11" />
<tax id="3" name="ΦΠΑ GR 5.5%" rate="5.5" />
<tax id="2" name="ΦΠΑ GR 13%" rate="13" />
<tax id="3" name="ΦΠΑ GR 6.5%" rate="6.5" />
<tax id="4" name="ΦΠΑ GR 16%" rate="16" />
<tax id="5" name="ΦΠΑ GR 8%" rate="8" />
<tax id="6" name="ΦΠΑ GR 4%" rate="4" />
@@ -44,7 +44,7 @@
<taxRule iso_code_country="uk" id_tax="1" />
</taxRulesGroup>
<taxRulesGroup name="GR Reduced Rate (11%)">
<taxRulesGroup name="GR Reduced Rate (13%)">
<taxRule iso_code_country="be" id_tax="2" />
<taxRule iso_code_country="bg" id_tax="2" />
<taxRule iso_code_country="cz" id_tax="2" />
@@ -74,7 +74,7 @@
<taxRule iso_code_country="uk" id_tax="2" />
</taxRulesGroup>
<taxRulesGroup name="GR Super Reduced Rate (5.5%)">
<taxRulesGroup name="GR Super Reduced Rate (6.5%)">
<taxRule iso_code_country="be" id_tax="3" />
<taxRule iso_code_country="bg" id_tax="3" />
<taxRule iso_code_country="cz" id_tax="3" />
@@ -193,66 +193,6 @@
<taxRule iso_code_country="se" id_tax="6" />
<taxRule iso_code_country="uk" id_tax="6" />
</taxRulesGroup>
<taxRulesGroup name="GR Foodstuff Rate (11%)">
<taxRule iso_code_country="be" id_tax="2" />
<taxRule iso_code_country="bg" id_tax="2" />
<taxRule iso_code_country="cz" id_tax="2" />
<taxRule iso_code_country="dk" id_tax="2" />
<taxRule iso_code_country="de" id_tax="2" />
<taxRule iso_code_country="ee" id_tax="2" />
<taxRule iso_code_country="gr" id_tax="2" />
<taxRule iso_code_country="es" id_tax="2" />
<taxRule iso_code_country="fr" id_tax="2" />
<taxRule iso_code_country="ie" id_tax="2" />
<taxRule iso_code_country="it" id_tax="2" />
<taxRule iso_code_country="cy" id_tax="2" />
<taxRule iso_code_country="lv" id_tax="2" />
<taxRule iso_code_country="lt" id_tax="2" />
<taxRule iso_code_country="lu" id_tax="2" />
<taxRule iso_code_country="hu" id_tax="2" />
<taxRule iso_code_country="mt" id_tax="2" />
<taxRule iso_code_country="nl" id_tax="2" />
<taxRule iso_code_country="at" id_tax="2" />
<taxRule iso_code_country="pl" id_tax="2" />
<taxRule iso_code_country="pt" id_tax="2" />
<taxRule iso_code_country="ro" id_tax="2" />
<taxRule iso_code_country="si" id_tax="2" />
<taxRule iso_code_country="sk" id_tax="2" />
<taxRule iso_code_country="fi" id_tax="2" />
<taxRule iso_code_country="se" id_tax="2" />
<taxRule iso_code_country="uk" id_tax="2" />
</taxRulesGroup>
<taxRulesGroup name="GR Books Rate (5.5%)">
<taxRule iso_code_country="be" id_tax="3" />
<taxRule iso_code_country="bg" id_tax="3" />
<taxRule iso_code_country="cz" id_tax="3" />
<taxRule iso_code_country="dk" id_tax="3" />
<taxRule iso_code_country="de" id_tax="3" />
<taxRule iso_code_country="ee" id_tax="3" />
<taxRule iso_code_country="gr" id_tax="3" />
<taxRule iso_code_country="es" id_tax="3" />
<taxRule iso_code_country="fr" id_tax="3" />
<taxRule iso_code_country="ie" id_tax="3" />
<taxRule iso_code_country="it" id_tax="3" />
<taxRule iso_code_country="cy" id_tax="3" />
<taxRule iso_code_country="lv" id_tax="3" />
<taxRule iso_code_country="lt" id_tax="3" />
<taxRule iso_code_country="lu" id_tax="3" />
<taxRule iso_code_country="hu" id_tax="3" />
<taxRule iso_code_country="mt" id_tax="3" />
<taxRule iso_code_country="nl" id_tax="3" />
<taxRule iso_code_country="at" id_tax="3" />
<taxRule iso_code_country="pl" id_tax="3" />
<taxRule iso_code_country="pt" id_tax="3" />
<taxRule iso_code_country="ro" id_tax="3" />
<taxRule iso_code_country="si" id_tax="3" />
<taxRule iso_code_country="sk" id_tax="3" />
<taxRule iso_code_country="fi" id_tax="3" />
<taxRule iso_code_country="se" id_tax="3" />
<taxRule iso_code_country="uk" id_tax="3" />
</taxRulesGroup>
</taxes>
<units>
<unit type="weight" value="kg" />
+3 -3
View File
@@ -7,11 +7,11 @@
<language iso_code="hu" />
</languages>
<taxes>
<tax id="1" name="ÁFA HU 25%" rate="25" />
<tax id="1" name="ÁFA HU 27%" rate="27" />
<tax id="2" name="ÁFA HU 18%" rate="18" />
<tax id="3" name="ÁFA HU 5%" rate="5" />
<taxRulesGroup name="HU Standard Rate (25%)">
<taxRulesGroup name="HU Standard Rate (27%)">
<taxRule iso_code_country="be" id_tax="1" />
<taxRule iso_code_country="bg" id_tax="1" />
<taxRule iso_code_country="cz" id_tax="1" />
@@ -101,7 +101,7 @@
<taxRule iso_code_country="uk" id_tax="3" />
</taxRulesGroup>
<taxRulesGroup name="HU Foodstuff Rate (25%)">
<taxRulesGroup name="HU Foodstuff Rate (27%)">
<taxRule iso_code_country="be" id_tax="1" />
<taxRule iso_code_country="bg" id_tax="1" />
<taxRule iso_code_country="cz" id_tax="1" />
+32 -2
View File
@@ -9,11 +9,12 @@
<currency name="Euro" iso_code="EUR" iso_code_num="978" sign="€" blank="1" conversion_rate="1.00" format="2" decimals="1" />
</currencies>
<taxes>
<tax id="1" name="VAT IE 21%" rate="21" />
<tax id="1" name="VAT IE 23%" rate="23" />
<tax id="2" name="VAT IE 13.5%" rate="13.5" />
<tax id="3" name="VAT IE 4.8%" rate="4.8" />
<tax id="4" name="VAT IE 9%" rate="9" />
<taxRulesGroup name="IE Standard Rate (21%)">
<taxRulesGroup name="IE Standard Rate (23%)">
<taxRule iso_code_country="be" id_tax="1" />
<taxRule iso_code_country="bg" id_tax="1" />
<taxRule iso_code_country="cz" id_tax="1" />
@@ -73,6 +74,35 @@
<taxRule iso_code_country="uk" id_tax="2" />
</taxRulesGroup>
<taxRulesGroup name="IE Reduced Rate (9%)">
<taxRule iso_code_country="be" id_tax="4" />
<taxRule iso_code_country="bg" id_tax="4" />
<taxRule iso_code_country="cz" id_tax="4" />
<taxRule iso_code_country="dk" id_tax="4" />
<taxRule iso_code_country="de" id_tax="4" />
<taxRule iso_code_country="ee" id_tax="4" />
<taxRule iso_code_country="gr" id_tax="4" />
<taxRule iso_code_country="es" id_tax="4" />
<taxRule iso_code_country="fr" id_tax="4" />
<taxRule iso_code_country="ie" id_tax="4" />
<taxRule iso_code_country="it" id_tax="4" />
<taxRule iso_code_country="cy" id_tax="4" />
<taxRule iso_code_country="lv" id_tax="4" />
<taxRule iso_code_country="lt" id_tax="4" />
<taxRule iso_code_country="lu" id_tax="4" />
<taxRule iso_code_country="hu" id_tax="4" />
<taxRule iso_code_country="mt" id_tax="4" />
<taxRule iso_code_country="nl" id_tax="4" />
<taxRule iso_code_country="at" id_tax="4" />
<taxRule iso_code_country="pl" id_tax="4" />
<taxRule iso_code_country="pt" id_tax="4" />
<taxRule iso_code_country="ro" id_tax="4" />
<taxRule iso_code_country="si" id_tax="4" />
<taxRule iso_code_country="sk" id_tax="4" />
<taxRule iso_code_country="fi" id_tax="4" />
<taxRule iso_code_country="se" id_tax="4" />
<taxRule iso_code_country="uk" id_tax="4" />
</taxRulesGroup>
<taxRulesGroup name="IE Super Reduced Rate (4.8%)">
<taxRule iso_code_country="be" id_tax="3" />
<taxRule iso_code_country="bg" id_tax="3" />
+51
View File
@@ -19,4 +19,55 @@
<unit type="short_distance" value="曲尺" />
<unit type="base_distance" value="丈" />
</units>
<state>
<state name="Aichi" iso_code="JP-23" country="JP" zone="Asia"/>
<state name="Akita" iso_code="JP-05" country="JP" zone="Asia"/>
<state name="Aomori" iso_code="JP-02" country="JP" zone="Asia"/>
<state name="Chiba" iso_code="JP-12" country="JP" zone="Asia"/>
<state name="Ehime" iso_code="JP-38" country="JP" zone="Asia"/>
<state name="Fukui" iso_code="JP-18" country="JP" zone="Asia"/>
<state name="Fukuoka" iso_code="JP-40" country="JP" zone="Asia"/>
<state name="Fukushima" iso_code="JP-07" country="JP" zone="Asia"/>
<state name="Gifu" iso_code="JP-21" country="JP" zone="Asia"/>
<state name="Gunma" iso_code="JP-10" country="JP" zone="Asia"/>
<state name="Hiroshima" iso_code="JP-34" country="JP" zone="Asia"/>
<state name="Hokkaido" iso_code="JP-01" country="JP" zone="Asia"/>
<state name="Hyōgo" iso_code="JP-28" country="JP" zone="Asia"/>
<state name="Ibaraki" iso_code="JP-08" country="JP" zone="Asia"/>
<state name="Ishikawa" iso_code="JP-17" country="JP" zone="Asia"/>
<state name="Iwate" iso_code="JP-03" country="JP" zone="Asia"/>
<state name="Kagawa" iso_code="JP-37" country="JP" zone="Asia"/>
<state name="Kagoshima" iso_code="JP-46" country="JP" zone="Asia"/>
<state name="Kanagawa" iso_code="JP-14" country="JP" zone="Asia"/>
<state name="Kōchi" iso_code="JP-39" country="JP" zone="Asia"/>
<state name="Kumamoto" iso_code="JP-43" country="JP" zone="Asia"/>
<state name="Kyoto" iso_code="JP-26" country="JP" zone="Asia"/>
<state name="Mie" iso_code="JP-24" country="JP" zone="Asia"/>
<state name="Miyagi" iso_code="JP-04" country="JP" zone="Asia"/>
<state name="Miyazaki" iso_code="JP-45" country="JP" zone="Asia"/>
<state name="Nagano" iso_code="JP-20" country="JP" zone="Asia"/>
<state name="Nagasaki" iso_code="JP-42" country="JP" zone="Asia"/>
<state name="Nara" iso_code="JP-29" country="JP" zone="Asia"/>
<state name="Niigata" iso_code="JP-15" country="JP" zone="Asia"/>
<state name="Ōita" iso_code="JP-44" country="JP" zone="Asia"/>
<state name="Okayama" iso_code="JP-33" country="JP" zone="Asia"/>
<state name="Okinawa" iso_code="JP-47" country="JP" zone="Asia"/>
<state name="Osaka" iso_code="JP-27" country="JP" zone="Asia"/>
<state name="Saga" iso_code="JP-41" country="JP" zone="Asia"/>
<state name="Saitama" iso_code="JP-11" country="JP" zone="Asia"/>
<state name="Shiga" iso_code="JP-25" country="JP" zone="Asia"/>
<state name="Shimane" iso_code="JP-32" country="JP" zone="Asia"/>
<state name="Shizuoka" iso_code="JP-22" country="JP" zone="Asia"/>
<state name="Tochigi" iso_code="JP-09" country="JP" zone="Asia"/>
<state name="Tokushima" iso_code="JP-36" country="JP" zone="Asia"/>
<state name="Tokyo" iso_code="JP-13" country="JP" zone="Asia"/>
<state name="Tottori" iso_code="JP-31" country="JP" zone="Asia"/>
<state name="Toyama" iso_code="JP-16" country="JP" zone="Asia"/>
<state name="Wakayama" iso_code="JP-30" country="JP" zone="Asia"/>
<state name="Yamagata" iso_code="JP-06" country="JP" zone="Asia"/>
<state name="Yamaguchi" iso_code="JP-35" country="JP" zone="Asia"/>
<state name="Yamanashi" iso_code="JP-19" country="JP" zone="Asia"/>
</state>
</localizationPack>
+2 -1
View File
@@ -464,7 +464,8 @@ var ajaxCart = {
var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0);
var content = '<dt class="hidden" id="cart_block_product_' + domIdProduct + '">';
content += '<span class="quantity-formated"><span class="quantity">' + this.quantity + '</span>x</span>';
var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name);
var min = this.name.indexOf(';', 10);
var name = (this.name.length > 12 ? this.name.substring(0, ((min - 10) <= 7) ? min : 10) + '...' : this.name);
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';
if (typeof(this.is_gift) == 'undefined' || this.is_gift == 0)
@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<li {if isset($last) && $last == 'true'}class="last"{/if}>
<li class="category_{$node.id}{if isset($last) && $last == 'true'} last{/if}">
<a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if}
title="{$node.desc|strip_tags|trim|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a>
{if $node.children|@count > 0}
+1 -1
View File
@@ -53,7 +53,7 @@ class BlockCurrencies extends Module
if (Configuration::get('PS_CATALOG_MODE'))
return false;
if (!count(Currency::getCurrencies()))
if (!Currency::isMultiCurrencyActivated())
return false;
$this->smarty->assign('blockcurrencies_sign', $this->context->currency->sign);
+2 -2
View File
@@ -230,11 +230,11 @@ function initLayered()
function paginationButton() {
$('#pagination a').not(':hidden').each(function () {
if ($(this).attr('href').search('&p=') == -1) {
if ($(this).attr('href').search(/&|\?p=/) == -1) {
var page = 1;
}
else {
var page = $(this).attr('href').replace(/^.*&p=(\d+).*$/, '$1');
var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1');
}
var location = window.location.href.replace(/#.*$/, '');
$(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
+2 -2
View File
@@ -1771,7 +1771,7 @@ class BlockLayered extends Module
$root_category = array('id_category' => '0', 'name' => $this->l('Root'));
$helper = new Helper();
$html .= $helper->renderCategoryTree(null, $selected_cat, 'categoryBox');
$html .= $helper->renderCategoryTree(null, $selected_cat, 'categoryBox', false, false, array(), true);
$html .= '
<br />
@@ -1930,7 +1930,7 @@ class BlockLayered extends Module
$(\'label a#inline\').fancybox({
\'hideOnContentClick\': false,
\'onClosed\': function() {
\'beforeClose\': function() {
lock_treeview_hidding = false;
$(\'#categories-treeview\').parent().parent().hide();
updCatCounter();
+3 -3
View File
@@ -218,9 +218,9 @@ class Editorial extends Module
if ($input['name'] != 'body_homepage_logo')
$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">' : '');
if ($helper->fields_value['image'])
$helper->fields_value['size'] = filesize(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') / 1000;
$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['body_homepage_logo'])
$helper->fields_value['body_homepage_logo']['size'] = filesize(dirname(__FILE__).'/homepage_logo_'.(int)$id_shop.'.jpg') / 1000;
$this->_html .= $helper->generateForm($this->fields_form);
return $this->_html;
+2 -1
View File
@@ -85,7 +85,8 @@ class LoyaltyModule extends ObjectModel
$total = 0;
if (Validate::isLoadedObject($cart))
{
$context = Context::getContext();
$currentContext = Context::getContext();
$context = clone $currentContext;
$context->cart = $cart;
$context->customer = new Customer($context->cart->id_customer);
$context->language = new Language($context->cart->id_lang);
+7 -3
View File
@@ -54,7 +54,7 @@ class MailAlert extends ObjectModel
),
);
public static function customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop = null, $id_lang = null)
public static function customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop = null, $id_lang = null, $guest_email = '')
{
if ($id_shop == null)
$id_shop = Context::getContext()->shop->id;
@@ -64,11 +64,15 @@ class MailAlert extends ObjectModel
$customer = new Customer($id_customer);
$customer_email = $customer->email;
$guest_email = pSQL($guest_email);
$id_customer = (int)$id_customer;
$customer_email = pSQL($customer_email);
$where = $id_customer == 0 ? "customer_email = '$guest_email'" : "(id_customer=$id_customer OR customer_email='$customer_email')";
$sql = '
SELECT *
FROM `'._DB_PREFIX_.self::$definition['table'].'`
WHERE (`id_customer` = '.(int)$id_customer.' OR `customer_email` = \''.pSQL($customer_email).'\')
WHERE '.$where.'
AND `id_product` = '.(int)$id_product.'
AND `id_product_attribute` = '.(int)$id_product_attribute.'
AND `id_shop` = '.(int)$id_shop;
@@ -97,7 +97,7 @@ class MailalertsActionsModuleFrontController extends ModuleFrontController
$id_lang = (int)$context->language->id;
$product = new Product($id_product, false, $id_lang, $id_shop, $context);
$mailAlert = MailAlert::customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop);
$mailAlert = MailAlert::customerHasNotification($id_customer, $id_product, $id_product_attribute, $id_shop, null, $customer_email);
if ($mailAlert)
die('2');
@@ -70,7 +70,7 @@ $(function() {
$.fancybox.close();
var buttons = {};
buttons[productcomment_ok] = "productcommentRefreshPage";
fancyChooseBox(productcomment_added, productcomment_title, buttons);
fancyChooseBox(moderation_active ? productcomment_added_moderation : productcomment_added, productcomment_title, buttons);
}
else
{
+2 -1
View File
@@ -755,7 +755,8 @@ class ProductComments extends Module
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
'nbComments' => (int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')),
'productcomments_controller_url' => $this->context->link->getModuleLink('productcomments'),
'productcomments_url_rewriting_activated' => Configuration::get('PS_REWRITING_SETTINGS', 0)
'productcomments_url_rewriting_activated' => Configuration::get('PS_REWRITING_SETTINGS', 0),
'moderation_active' => (int)Configuration::get('PRODUCT_COMMENTS_MODERATE')
));
$this->context->controller->pagination((int)ProductComment::getCommentNumber((int)Tools::getValue('id_product')));
+8 -1
View File
@@ -27,6 +27,11 @@ var productcomments_controller_url = '{$productcomments_controller_url}';
var confirm_report_message = "{l s='Are you sure you want report this comment?' mod='productcomments'}";
var secure_key = "{$secure_key}";
var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
var productcomment_added = '{l s='Your comment has been added!' mod='productcomments'}';
var productcomment_added_moderation = '{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments'}';
var productcomment_title = '{l s='New comment' mod='productcomments'}';
var productcomment_ok = '{l s='OK' mod='productcomments'}';
var moderation_active = {$moderation_active};
</script>
<div id="idTab5">
@@ -71,11 +76,13 @@ var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
</div>
{/if}
{/foreach}
{if (!$too_early AND ($logged OR $allow_guests))}
<p class="align_center">
<a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Write your review' mod='productcomments'} !</a>
</p>
{/if}
{else}
{if ($too_early == false AND ($logged OR $allow_guests))}
{if (!$too_early AND ($logged OR $allow_guests))}
<p class="align_center">
<a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
</p>
+6 -12
View File
@@ -31,23 +31,17 @@ $('document').ready(function(){
});
$('#sendEmail').click(function(){
var datas = [];
$('#send_friend_form_content').find(':input').each(function(index){
var o = {};
o.key = $(this).attr('name');
o.value = $(this).val();
if (o.value != '')
datas.push(o);
});
if (datas.length >= 3)
var name = $('#friend_name').val();
var email = $('#friend_email').val();
var id_product = $('#id_product_comment_send').val();
if (name && email && !isNaN(id_product))
{
$.ajax({
{/literal}url: "{$module_dir}sendtoafriend_ajax.php",{literal}
type: "POST",
headers: {"cache-control": "no-cache"},
data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', friend: unescape(JSON.stringify(datas).replace(/\\u/g, '%u'))},{/literal}{literal}
data: {action: 'sendToMyFriend', secure_key: '{/literal}{$stf_secure_key}{literal}', name: name, email: email, id_product: id_product},{/literal}{literal}
dataType: "json",
success: function(result) {
$.fancybox.close();
+3 -13
View File
@@ -33,19 +33,9 @@ $module = new SendToAFriend();
if (Tools::getValue('action') == 'sendToMyFriend' && Tools::getValue('secure_key') == $module->secure_key)
{
$friend_infos = Tools::jsonDecode(Tools::getValue('friend'));
$friendName = "";
$friendMail = "";
$id_product = null;
foreach ($friend_infos as $entry)
{
if ($entry->key == "friend_name")
$friendName = $entry->value;
else if ($entry->key == "friend_email")
$friendMail = $entry->value;
else if ($entry->key == "id_product")
$id_product = $entry->value;
}
$friendName = Tools::getValue('name');
$friendMail = Tools::getValue('email');
$id_product = Tools::getValue('id_product');
if (!$friendName || !$friendMail || !$id_product)
die('0');
+2 -2
View File
@@ -58,8 +58,8 @@
{if $category->description}
<div class="cat_desc">
{if strlen($category->description) > 120}
<p id="category_description_short">{$category->description|truncate:120}</p>
<p id="category_description_full" style="display:none">{$category->description}</p>
<div id="category_description_short">{$category->description|truncate:120}</div>
<div id="category_description_full" style="display:none;">{$category->description}</div>
<a href="#" onclick="$('#category_description_short').hide(); $('#category_description_full').show(); $(this).hide(); return false;" class="lnk_more">{l s='More'}</a>
{else}
<p>{$category->description}</p>
+1 -1
View File
@@ -58,7 +58,7 @@
<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">
<option value="0">{l s='-- Choose --'}</option>
{foreach from=$contacts item=contact}
<option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>
<option value="{$contact.id_contact|intval}" {if isset($smarty.request.id_contact) && $smarty.request.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>
</p>
+2 -2
View File
@@ -766,7 +766,7 @@ function multishippingMode(it)
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'type': 'ajax',
'onClosed': function()
'beforeClose': function()
{
// Reload the cart
$.ajax({
@@ -783,7 +783,7 @@ function multishippingMode(it)
});
updateCarrierSelectionAndGift();
},
'onStart': function()
'beforeLoad': function()
{
// Removing all ids on the cart to avoid conflic with the new one on the fancybox
// This action could "break" the cart design, if css rules use ids of the cart
@@ -27,9 +27,11 @@ var productcomments_controller_url = '{$productcomments_controller_url}';
var confirm_report_message = "{l s='Are you sure you want report this comment?' mod='productcomments'}";
var secure_key = "{$secure_key}";
var productcomments_url_rewrite = '{$productcomments_url_rewriting_activated}';
var productcomment_added = '{l s='Your comment has been added !' mod='productcomments'}';
var productcomment_added = '{l s='Your comment has been added!' mod='productcomments'}';
var productcomment_added_moderation = '{l s='Your comment has been added and will be available once approved by a moderator' mod='productcomments'}';
var productcomment_title = '{l s='New comment' mod='productcomments'}';
var productcomment_ok = '{l s='OK' mod='productcomments'}';
var moderation_active = {$moderation_active};
</script>
<div id="idTab5">
@@ -74,11 +76,13 @@ var productcomment_ok = '{l s='OK' mod='productcomments'}';
</div>
{/if}
{/foreach}
{if (!$too_early AND ($logged OR $allow_guests))}
<p class="align_center">
<a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Write your review' mod='productcomments'} !</a>
</p>
{/if}
{else}
{if ($too_early == false AND ($logged OR $allow_guests))}
{if (!$too_early AND ($logged OR $allow_guests))}
<p class="align_center">
<a id="new_comment_tab_btn" class="open-comment-form" href="#new_comment_form">{l s='Be the first to write your review' mod='productcomments'} !</a>
</p>
@@ -139,7 +143,7 @@ var productcomment_ok = '{l s='OK' mod='productcomments'}';
{/if}
<div id="new_comment_form_footer">
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}'></input>
<input id="id_product_comment_send" name="id_product" type="hidden" value='{$id_product_comment_form}' />
<p class="fl required"><sup>*</sup> {l s='Required fields' mod='productcomments'}</p>
<p class="fr">
<button id="submitNewMessage" name="submitMessage" type="submit">{l s='Send' mod='productcomments'}</button>&nbsp;
+4 -11
View File
@@ -433,17 +433,10 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving
{/if}
{*close if for show price*}
{/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}
<span class="exclusive">
<span></span>
{l s='Add to cart'}
</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}
<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></span>
<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
</p>
{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
<div class="clear"></div>