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

This commit is contained in:
djfm
2013-10-29 10:01:00 +00:00
111 changed files with 1828 additions and 945 deletions
+6 -14
View File
@@ -22,26 +22,18 @@
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD)
{
$error = SYS_DISABLED; $error = SYS_DISABLED;
}
elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED; $error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else if(!$upload->isFileUploaded('file')) elseif (!$upload->isFileUploaded('file'))
{
$error = ERR_FILE_NOT_UPLOADED; $error = ERR_FILE_NOT_UPLOADED;
}else if(!$upload->moveUploadedFile($_GET['folder'])) elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
{
$error = ERR_FILE_MOVE_FAILED;
}
elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
{
$error = ERR_FILE_TYPE_NOT_ALLOWED; $error = ERR_FILE_TYPE_NOT_ALLOWED;
}elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) elseif (defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE))
{
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
}else elseif (!$upload->moveUploadedFile($_GET['folder']))
$error = ERR_FILE_MOVE_FAILED;
else
{ {
include_once(CLASS_FILE); include_once(CLASS_FILE);
$path = $upload->getFilePath(); $path = $upload->getFilePath();
@@ -24,7 +24,8 @@
if(!empty($_GET['search'])) if(!empty($_GET['search']))
{ {
include_once(CLASS_SEARCH); include_once(CLASS_SEARCH);
if (!preg_match('/^'.Tools::pRegexp(realpath(dirname(__FILE__).'/'.$_GET['search_folder']), '/').'/i', _PS_ROOT_DIR_.'/img/cms'))
exit;
$search = new Search($_GET['search_folder']); $search = new Search($_GET['search_folder']);
$search->addSearchKeyword('recursive', @$_GET['search_recursively']); $search->addSearchKeyword('recursive', @$_GET['search_recursively']);
$search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']); $search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']);
@@ -78,9 +78,9 @@
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png');// // define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png');// //
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,png'); define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,jpeg,jpeg,png');
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
define('CONFIG_UPLOAD_INVALID_EXTS', ''); define('CONFIG_UPLOAD_INVALID_EXTS', '');
+3
View File
@@ -10,6 +10,9 @@
//FILESYSTEM CONFIG <br> //FILESYSTEM CONFIG <br>
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php"); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php");
if (_PS_MODE_DEMO_)
die('This functionality has been disabled.');
define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration
if(!isset($_SESSION)) if(!isset($_SESSION))
{ {
@@ -73,9 +73,9 @@
define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid
define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste
define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png,txt'); //
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');//
define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf'); define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,jpeg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf');
//define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); //
define('CONFIG_UPLOAD_INVALID_EXTS', ''); define('CONFIG_UPLOAD_INVALID_EXTS', '');
@@ -35,7 +35,7 @@
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "index.php", url: "index.php",
data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}&note="+noteContent, data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}&note="+encodeURIComponent(noteContent),
async : true, async : true,
success: function(r) { success: function(r) {
$('#note_feedback').html('').hide(); $('#note_feedback').html('').hide();
@@ -77,6 +77,7 @@
<li><a class="_blank" href="../docs/csv_import/addresses_import.csv">{l s='Sample Addresses file'}</a></li> <li><a class="_blank" href="../docs/csv_import/addresses_import.csv">{l s='Sample Addresses file'}</a></li>
<li><a class="_blank" href="../docs/csv_import/manufacturers_import.csv">{l s='Sample Manufacturers file'}</a></li> <li><a class="_blank" href="../docs/csv_import/manufacturers_import.csv">{l s='Sample Manufacturers file'}</a></li>
<li><a class="_blank" href="../docs/csv_import/suppliers_import.csv">{l s='Sample Suppliers file'}</a></li> <li><a class="_blank" href="../docs/csv_import/suppliers_import.csv">{l s='Sample Suppliers file'}</a></li>
<li><a class="_blank" href="../docs/csv_import/alias_import.csv">{l s='Sample Alias file'}</a></li>
{if $PS_ADVANCED_STOCK_MANAGEMENT} {if $PS_ADVANCED_STOCK_MANAGEMENT}
<li><a class="_blank" href="../docs/csv_import/supply_orders_import.csv">{l s='Supply Orders sample file'}</a></li> <li><a class="_blank" href="../docs/csv_import/supply_orders_import.csv">{l s='Supply Orders sample file'}</a></li>
<li><a class="_blank" href="../docs/csv_import/supply_orders_details_import.csv">{l s='Supply Orders Details sample file'}</a></li> <li><a class="_blank" href="../docs/csv_import/supply_orders_details_import.csv">{l s='Supply Orders Details sample file'}</a></li>
@@ -203,12 +204,12 @@
}); });
$("select#entity").change(function(){ $("select#entity").change(function(){
if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8) if ($("#entity > option:selected").val() == 8 || $("#entity > option:selected").val() == 9)
$("label[for=truncate],#truncate").hide(); $("label[for=truncate],#truncate").hide();
else else
$("label[for=truncate],#truncate").show(); $("label[for=truncate],#truncate").show();
if ($("#entity > option:selected").val() == 8) if ($("#entity > option:selected").val() == 9)
{ {
$(".import_supply_orders_details").show(); $(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|'); $('input[name=multiple_value_separator]').val('|');
@@ -219,14 +220,22 @@
$('input[name=multiple_value_separator]').val('{if isset($multiple_value_separator_selected)}{$multiple_value_separator_selected}{else},{/if}'); $('input[name=multiple_value_separator]').val('{if isset($multiple_value_separator_selected)}{$multiple_value_separator_selected}{else},{/if}');
} }
if ($("#entity > option:selected").val() == 1) if ($("#entity > option:selected").val() == 1)
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").show(); $("label[for=match_ref], #match_ref").show();
else else
$("label[for=match_ref], #match_ref, label[for=regenerate], #regenerate").hide(); $("label[for=match_ref], #match_ref").hide();
if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0) if ($("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 0)
$(".import_products_categories, label[for=regenerate], #regenerate").show(); $(".import_products_categories").show();
else else
$(".import_products_categories, label[for=regenerate], #regenerate").hide(); $(".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)
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 ||
$("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$("label[for=regenerate], #regenerate").show()
else
$("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 || $("#entity > option:selected").val() == 7)
$("label[for=forceIDs], #forceIDs").show(); $("label[for=forceIDs], #forceIDs").show();
else else
$("label[for=forceIDs], #forceIDs").hide(); $("label[for=forceIDs], #forceIDs").hide();
@@ -260,4 +269,4 @@
}); });
}; };
}); });
</script> </script>
@@ -59,14 +59,14 @@
<td>{$module->categoryName}</td> <td>{$module->categoryName}</td>
<td> <td>
<select name="i_{$module->name}" class="moduleFavorite" style="width:50px"> <select name="i_{$module->name}" class="moduleFavorite" style="width:50px">
<option value="" selected="selected">---</option> <option value="" selected="selected">-</option>
<option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>{l s='Yes'}</option> <option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>{l s='Yes'}</option>
<option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>{l s='No'}</option> <option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>{l s='No'}</option>
</select> </select>
</td> </td>
<td> <td>
<select name="f_{$module->name}" class="moduleFavorite" style="width:50px"> <select name="f_{$module->name}" class="moduleFavorite" style="width:50px">
<option value="" selected="selected">---</option> <option value="" selected="selected">-</option>
<option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>{l s='Yes'}</option> <option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>{l s='Yes'}</option>
<option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>{l s='No'}</option> <option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>{l s='No'}</option>
</select> </select>
@@ -46,7 +46,7 @@
</td> </td>
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td> <td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
<td> <td>
<div class="moduleDesc" id="anchor{$module->name|ucfirst}"> <div class="moduleDesc" id="anchor{$module->name|ucfirst}" title="{$module->name}">
<h3>{$module->displayName}<span style="display:none">{$module->name}</span> <h3>{$module->displayName}<span style="display:none">{$module->name}</span>
{if isset($module->type) && $module->type == 'addonsMustHave'} {if isset($module->type) && $module->type == 'addonsMustHave'}
<span class="setup must-have">{l s='Must Have'}</span> <span class="setup must-have">{l s='Must Have'}</span>
@@ -34,6 +34,7 @@
<td valign="top"> <td valign="top">
<div class="moduleDesc" id="anchor{$module->name|ucfirst}"> <div class="moduleDesc" id="anchor{$module->name|ucfirst}">
<h3> <h3>
<span style="display:none">{$module->name}</span>
{$module->displayName|truncate:36:'…'} {$module->version} {$module->displayName|truncate:36:'…'} {$module->version}
{if isset($module->id) && $module->id gt 0 } {if isset($module->id) && $module->id gt 0 }
{if $module->active} {if $module->active}
@@ -37,7 +37,7 @@
{l s='Show'} : {l s='Show'} :
<select id="show_modules" onChange="autoUrl('show_modules', '{$url_show_modules}')"> <select id="show_modules" onChange="autoUrl('show_modules', '{$url_show_modules}')">
<option value="all">{l s='All modules'}&nbsp;</option> <option value="all">{l s='All modules'}&nbsp;</option>
<option>---------------</option> <option>-</option>
{foreach $modules as $module} {foreach $modules as $module}
<option value="{$module->id|intval}" {if $display_key == $module->id}selected="selected"{/if}>{$module->displayName}</option> <option value="{$module->id|intval}" {if $display_key == $module->id}selected="selected"{/if}>{$module->displayName}</option>
@@ -715,6 +715,16 @@
$('#payment_list').html(payment_list); $('#payment_list').html(payment_list);
} }
function fixPriceFormat(price)
{
if(price.indexOf(',') > 0 && price.indexOf('.') > 0) // if contains , and .
if(price.indexOf(',') < price.indexOf('.')) // if , is before .
price = price.replace(',',''); // remove ,
price = price.replace(' ',''); // remove any spaces
price = price.replace(',','.'); // remove , if price did not cotain both , and .
return price;
}
function displaySummary(jsonSummary) function displaySummary(jsonSummary)
{ {
currency_format = jsonSummary.currency.format; currency_format = jsonSummary.currency.format;
@@ -750,13 +760,13 @@
if (!changed_shipping_price) if (!changed_shipping_price)
$('#shipping_price').html('<b>' + formatCurrency(parseFloat(jsonSummary.summary.total_shipping), currency_format, currency_sign, currency_blank) + '</b>'); $('#shipping_price').html('<b>' + formatCurrency(parseFloat(jsonSummary.summary.total_shipping), currency_format, currency_sign, currency_blank) + '</b>');
shipping_price_selected_carrier = jsonSummary.summary.total_shipping; shipping_price_selected_carrier = jsonSummary.summary.total_shipping;
$('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts_tax_exc.replace(',', '.')), currency_format, currency_sign, currency_blank)); $('#total_vouchers').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_discounts_tax_exc)), currency_format, currency_sign, currency_blank));
$('#total_shipping').html(formatCurrency(parseFloat(jsonSummary.summary.total_shipping_tax_exc.replace(',', '.')), currency_format, currency_sign, currency_blank)); $('#total_shipping').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_shipping_tax_exc)), currency_format, currency_sign, currency_blank));
$('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax.replace(',', '.')), currency_format, currency_sign, currency_blank)); $('#total_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_tax)), currency_format, currency_sign, currency_blank));
$('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax.replace(',', '.')), currency_format, currency_sign, currency_blank)); $('#total_without_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_price_without_tax)), currency_format, currency_sign, currency_blank));
$('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price.replace(',', '.')), currency_format, currency_sign, currency_blank)); $('#total_with_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_price)), currency_format, currency_sign, currency_blank));
$('#total_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_products.replace(',', '.')), currency_format, currency_sign, currency_blank)); $('#total_products').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_products)), currency_format, currency_sign, currency_blank));
id_currency = jsonSummary.cart.id_currency; id_currency = jsonSummary.cart.id_currency;
$('#id_currency option').removeAttr('selected'); $('#id_currency option').removeAttr('selected');
$('#id_currency option[value="'+id_currency+'"]').attr('selected', true); $('#id_currency option[value="'+id_currency+'"]').attr('selected', true);
@@ -751,7 +751,7 @@
<a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}"><b>{l s='Click here'}</b> {l s='to see all messages.'}</a><br> <a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}"><b>{l s='Click here'}</b> {l s='to see all messages.'}</a><br>
<div id="message" style="display: {if Tools::getValue('message')}block{else}none{/if}"> <div id="message" style="display: {if Tools::getValue('message')}block{else}none{/if}">
<select name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')"> <select name="order_message" id="order_message" onchange="orderOverwriteMessage(this, '{l s='Do you want to overwrite your existing message?'}')">
<option value="0" selected="selected">-- {l s='Choose a standard message'} --</option> <option value="0" selected="selected">- {l s='Choose a standard message'} -</option>
{foreach from=$orderMessages item=orderMessage} {foreach from=$orderMessages item=orderMessage}
<option value="{$orderMessage['message']|escape:'htmlall':'UTF-8'}">{$orderMessage['name']}</option> <option value="{$orderMessage['message']|escape:'htmlall':'UTF-8'}">{$orderMessage['name']}</option>
{/foreach} {/foreach}
@@ -103,11 +103,11 @@
<td class="col-left"><label>{l s='Manufacturer:'}</label></td> <td class="col-left"><label>{l s='Manufacturer:'}</label></td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
<select name="id_manufacturer" id="id_manufacturer"> <select name="id_manufacturer" id="id_manufacturer">
<option value="0">-- {l s='Choose (optional)'} --</option> <option value="0">- {l s='Choose (optional)'} -</option>
{if $product->id_manufacturer} {if $product->id_manufacturer}
<option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option> <option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option>
{/if} {/if}
<option disabled="disabled">----------</option> <option disabled="disabled">-</option>
</select>&nbsp;&nbsp;&nbsp; </select>&nbsp;&nbsp;&nbsp;
<a class="button bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'htmlall':'UTF-8'}&addmanufacturer"> <a class="button bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'htmlall':'UTF-8'}&addmanufacturer">
<img src="../img/admin/add.gif" alt="{l s='Create new manufacturer'}" title="{l s='Create new manufacturer'}" /> <img src="../img/admin/add.gif" alt="{l s='Create new manufacturer'}" title="{l s='Create new manufacturer'}" />
@@ -85,7 +85,7 @@
</td> </td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
<select name="attribute" id="attribute" style="width: 200px;"> <select name="attribute" id="attribute" style="width: 200px;">
<option value="0">---</option> <option value="0">-</option>
</select> </select>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
@@ -252,7 +252,7 @@
<li style="float: left; width: {$imageWidth}px;"> <li style="float: left; width: {$imageWidth}px;">
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" /> <input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
<label for="id_image_attr_{$image.id_image}" style="float: none;"> <label for="id_image_attr_{$image.id_image}" style="float: none;">
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small_default.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" /> <img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-{$imageType}.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
</label> </label>
</li> </li>
{/foreach} {/foreach}
@@ -29,6 +29,19 @@
<h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br /> <h4>{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}</h4> <div class="separation"></div><br />
<table cellpadding="5" style="width:100%"> <table cellpadding="5" style="width:100%">
<tr>
<td class="col-left">
<label>{l s='Legend:'}</label>
</td>
<td style="padding-bottom:5px;" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
<input class="updateCurrentText" size="43" type="text" {if !$product->id}disabled="disabled"{/if} id="legend_{$language.id_lang}" name="legend_{$language.id_lang}" value="{$product->name[$language.id_lang]|escape:'htmlall':'UTF-8'}"/>
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</div>
{/foreach}
</td>
</tr>
<tr> <tr>
<td class="col-left"><label class="file_upload_label">{l s='File:'}</label></td> <td class="col-left"><label class="file_upload_label">{l s='File:'}</label></td>
<td style="padding-bottom:5px;"> <td style="padding-bottom:5px;">
@@ -57,6 +70,7 @@
<thead> <thead>
<tr class="nodrag nodrop"> <tr class="nodrag nodrop">
<th style="width: 100px;">{l s='Image'}</th> <th style="width: 100px;">{l s='Image'}</th>
<th>{l s='Legend'}</th>
<th>{l s='Position'}</th> <th>{l s='Position'}</th>
{if $shops} {if $shops}
{foreach from=$shops item=shop} {foreach from=$shops item=shop}
@@ -78,9 +92,10 @@
<tr id="image_id"> <tr id="image_id">
<td style="padding: 4px;"> <td style="padding: 4px;">
<a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" class="fancybox"> <a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" class="fancybox">
<img src="{$smarty.const._THEME_PROD_DIR_}{$iso_lang}-default-small_default.jpg" alt="image_id" title="image_id" /> <img src="{$smarty.const._THEME_PROD_DIR_}{$iso_lang}-default-{$imageType}.jpg" alt="image_id" title="image_id" />
</a> </a>
</td> </td>
<td>legend</td>
<td id="td_image_id" class="pointer dragHandle center positionImage"> <td id="td_image_id" class="pointer dragHandle center positionImage">
image_position image_position
</td> </td>
@@ -101,7 +116,6 @@
</td> </td>
</tr> </tr>
</table> </table>
<script type="text/javascript"> <script type="text/javascript">
var upbutton = '{l s='Upload an image'}'; var upbutton = '{l s='Upload an image'}';
var token = '{$token}'; var token = '{$token}';
@@ -128,7 +142,7 @@
} }
else else
assoc = false; assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc); imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}enabled{else}forbbiden{/if}", assoc, "{$image->legend[$default_language]|@addcslashes:'\"'}");
{/foreach} {/foreach}
{literal} {literal}
$("#imageTable").tableDnD( $("#imageTable").tableDnD(
@@ -147,20 +161,20 @@
updateImagePosition(image_up); updateImagePosition(image_up);
} }
}); });
var filecheck = 1; var filecheck = 1;
var uploader = new qq.FileUploader( var params = new Array;
params['id_product'] = {/literal}{$id_product|intval}{literal};
params['id_category'] = {/literal}{$id_category_default|intval}{literal};
params['token'] = "{/literal}{$token}{literal}";
params['tab'] = "AdminProducts";
params['action'] = "addImage";
params['ajax'] = 1;
uploader = new qq.FileUploader(
{ {
element: document.getElementById("file-uploader"), element: document.getElementById("file-uploader"),
action: "ajax-tab.php", action: "ajax-tab.php",
debug: false, debug: false,
params: {
id_product : {/literal}{$id_product}{literal},
id_category : {/literal}{$id_category_default}{literal},
token : "{/literal}{$token}{literal}",
tab : "AdminProducts",
action : 'addImage',
ajax: 1
},
onComplete: function(id, fileName, responseJSON) onComplete: function(id, fileName, responseJSON)
{ {
var percent = ((filecheck * 100) / nbfile); var percent = ((filecheck * 100) / nbfile);
@@ -185,7 +199,7 @@
cover = "forbbiden"; cover = "forbbiden";
if (responseJSON.cover == "1") if (responseJSON.cover == "1")
cover = "enabled"; cover = "enabled";
imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops) imageLine(responseJSON.id, responseJSON.path, responseJSON.position, cover, responseJSON.shops, responseJSON.legend[{/literal}{$default_language|intval}{literal}])
$("#imageTable tr:last").after(responseJSON.html); $("#imageTable tr:last").after(responseJSON.html);
$("#countImage").html(parseInt($("#countImage").html()) + 1); $("#countImage").html(parseInt($("#countImage").html()) + 1);
$("#img" + id).remove(); $("#img" + id).remove();
@@ -198,6 +212,12 @@
}, },
onSubmit: function(id, filename) onSubmit: function(id, filename)
{ {
$('input[id^="legend_"]').each(function()
{
id = $(this).prop("id").replace("legend_", "legend[") + "]";
params[id] = $(this).val();
});
uploader.setParams(params);
$("#imageTable").show(); $("#imageTable").show();
$("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px\"href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>"); $("#listImage").append("<li id='img"+id+"'><div class=\"float\" >" + filename + "</div></div><a style=\"margin-left:10px\"href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" alt=\"\" border=\"0\"></a><p class=\"errorImg\"></p></li>");
} }
@@ -309,13 +329,14 @@
$("#img" + id).remove(); $("#img" + id).remove();
} }
function imageLine(id, path, position, cover, shops) function imageLine(id, path, position, cover, shops, legend)
{ {
line = $("#lineType").html(); line = $("#lineType").html();
line = line.replace(/image_id/g, id); line = line.replace(/image_id/g, legend);
line = line.replace(/[a-z]{2}-default/g, path); line = line.replace(/[a-z]{0,2}-default/g, path);
line = line.replace(/image_path/g, path); line = line.replace(/image_path/g, path);
line = line.replace(/image_position/g, position); line = line.replace(/image_position/g, position);
line = line.replace(/legend/g, legend);
line = line.replace(/blank/g, cover); line = line.replace(/blank/g, cover);
line = line.replace(/<tbody>/gi, ""); line = line.replace(/<tbody>/gi, "");
line = line.replace(/<\/tbody>/gi, ""); line = line.replace(/<\/tbody>/gi, "");
@@ -330,7 +351,6 @@
$("#imageList").append(line); $("#imageList").append(line);
} }
$('.fancybox').fancybox(); $('.fancybox').fancybox();
}); });
{/literal} {/literal}
@@ -375,7 +375,7 @@ $(document).ready(function () {
<div class="margin-form"> <div class="margin-form">
<input type="text" name="sp_reduction" value="0.00" size="11" /> <input type="text" name="sp_reduction" value="0.00" size="11" />
<select name="sp_reduction_type"> <select name="sp_reduction_type">
<option selected="selected">---</option> <option selected="selected">-</option>
<option value="amount">{l s='Amount'}</option> <option value="amount">{l s='Amount'}</option>
<option value="percentage">{l s='Percentage'}</option> <option value="percentage">{l s='Percentage'}</option>
</select> </select>
@@ -58,6 +58,7 @@
$('#file_missing').hide(); $('#file_missing').hide();
$('#virtual_product_name').attr('value', fileName); $('#virtual_product_name').attr('value', fileName);
$("#upload-confirmation .error").remove(); $("#upload-confirmation .error").remove();
$('#upload-confirmation div').find('span').remove()
$('#upload-confirmation div').prepend('<span>{l s='The file'}&nbsp;"<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">'+fileName+'</a>"&nbsp;{l s='has successfully been uploaded'}' + $('#upload-confirmation div').prepend('<span>{l s='The file'}&nbsp;"<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">'+fileName+'</a>"&nbsp;{l s='has successfully been uploaded'}' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" /></span>'); '<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" /></span>');
$("#upload-confirmation").show(); $("#upload-confirmation").show();
@@ -112,7 +112,7 @@
<label>{l s='Filter by product:'}</label> <label>{l s='Filter by product:'}</label>
<div class="margin-left"> <div class="margin-left">
<select id="selectProduct" name="selectProduct" style="width: 200px;" onfocus="fillProducts();" onchange="updateConversionRate(this.value);"> <select id="selectProduct" name="selectProduct" style="width: 200px;" onfocus="fillProducts();" onchange="updateConversionRate(this.value);">
<option value="0" selected="selected">-- {l s='All'} --</option> <option value="0" selected="selected">- {l s='All'} -</option>
</select> </select>
</div> </div>
<br class="clear" /> <br class="clear" />
+40 -43
View File
@@ -34,54 +34,51 @@
<title>{$meta_title} - PrestaShop&trade;</title> <title>{$meta_title} - PrestaShop&trade;</title>
{if $display_header} {if $display_header}
<script type="text/javascript"> <script type="text/javascript">
var help_class_name = '{$controller_name}'; var help_class_name = '{$controller_name|@addcslashes:'\''}';
var iso_user = '{$iso_user}'; var iso_user = '{$iso_user|@addcslashes:'\''}';
var country_iso_code = '{$country_iso_code}'; var country_iso_code = '{$country_iso_code|@addcslashes:'\''}';
var _PS_VERSION_ = '{$smarty.const._PS_VERSION_}'; var _PS_VERSION_ = '{$smarty.const._PS_VERSION_|@addcslashes:'\''}';
var helpboxes = {$help_box|intval};
var helpboxes = {$help_box}; var roundMode = {$round_mode|intval};
var roundMode = {$round_mode}; {if isset($shop_context)}
{if isset($shop_context)} {if $shop_context == Shop::CONTEXT_ALL}
{if $shop_context == Shop::CONTEXT_ALL} var youEditFieldFor = '{l s='A modification of this field will be applied for all shops' js=1}';
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops' slashes=1 }"; {elseif $shop_context == Shop::CONTEXT_GROUP}
{elseif $shop_context == Shop::CONTEXT_GROUP} var youEditFieldFor = '{l s='A modification of this field will be applied for all shops of group' js=1} <b>{$shop_name|@addcslashes:'\''}</b>';
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops of group ' slashes=1 }<b>{$shop_name}</b>"; {else}
{else} var youEditFieldFor = '{l s='A modification of this field will be applied for the shop' js=1} <b>{$shop_name|@addcslashes:'\''}</b>';
var youEditFieldFor = "{l s='A modification of this field will be applied for the shop ' slashes=1 }<b>{$shop_name}</b>"; {/if}
{/if} {else}
{else} var youEditFieldFor = '';
var youEditFieldFor = ''; {/if}
{/if} var autorefresh_notifications = '{$autorefresh_notifications|@addcslashes:'\''}';
{* Notifications vars *} var new_order_msg = '{l s='A new order has been placed on your shop.' js=1}';
var autorefresh_notifications = '{$autorefresh_notifications}'; var order_number_msg = '{l s='Order number: ' js=1}';
var new_order_msg = '{l s='A new order has been placed on your shop.' slashes=1}'; var total_msg = '{l s='Total: ' js=1}';
var order_number_msg = '{l s='Order number: ' slashes=1}'; var from_msg = '{l s='From: ' js=1}';
var total_msg = '{l s='Total: ' slashes=1}'; var see_order_msg = '{l s='View this order' js=1}';
var from_msg = '{l s='From: ' slashes=1}'; var new_customer_msg = '{l s='A new customer registered on your shop.' js=1}';
var see_order_msg = '{l s='View this order' slashes=1}'; var customer_name_msg = '{l s='Customer name: ' js=1}';
var new_customer_msg = '{l s='A new customer registered on your shop.' slashes=1}'; var see_customer_msg = '{l s='View this customer' js=1}';
var customer_name_msg = '{l s='Customer name: ' slashes=1}'; var new_msg = '{l s='A new message posted on your shop.' js=1}';
var see_customer_msg = '{l s='View this customer' slashes=1}'; var excerpt_msg = '{l s='Excerpt: ' js=1}';
var new_msg = '{l s='A new message posted on your shop.' slashes=1}'; var see_msg = '{l s='Read this message' js=1}';
var excerpt_msg = '{l s='Excerpt: ' slashes=1}'; var token_admin_orders = '{getAdminToken tab='AdminOrders'}';
var see_msg = '{l s='Read this message' slashes=1}'; var token_admin_customers = '{getAdminToken tab='AdminCustomers'}';
var token_admin_orders = '{getAdminToken tab='AdminOrders' slashes=1}'; var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads'}';
var token_admin_customers = '{getAdminToken tab='AdminCustomers' slashes=1}'; var currentIndex = '{$currentIndex|@addcslashes:'\''}';
var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads' slashes=1}'; var choose_language_translate = '{l s='Choose language' js=1}';
var currentIndex = '{$currentIndex}';
var choose_language_translate = "{l s='Choose language' slashes=1 }";
</script> </script>
{/if} {/if}
{if isset($css_files)} {if isset($css_files)}
{foreach from=$css_files key=css_uri item=media} {foreach from=$css_files key=css_uri item=media}
<link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" /> <link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
{/foreach} {/foreach}
{/if} {/if}
{if isset($js_files)} {if isset($js_files)}
{foreach from=$js_files item=js_uri} {foreach from=$js_files item=js_uri}
<script type="text/javascript" src="{$js_uri}"></script> <script type="text/javascript" src="{$js_uri}"></script>
{/foreach} {/foreach}
{/if} {/if}
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" /> <link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" />
@@ -168,7 +168,7 @@
{/if} {/if}
>{$option->$input.options.name}</option> >{$option->$input.options.name}</option>
{elseif $option == "-"} {elseif $option == "-"}
<option value="">--</option> <option value="">-</option>
{else} {else}
<option value="{$option[$input.options.id]}" <option value="{$option[$input.options.id]}"
{if isset($input.multiple)} {if isset($input.multiple)}
@@ -24,11 +24,11 @@
*} *}
{if count($categories) && isset($categories)} {if count($categories) && isset($categories)}
<script type="text/javascript"> <script type="text/javascript">
var inputName = '{$categories.input_name}'; var inputName = '{$categories.input_name|@addcslashes:'\''}';
var use_radio = {if $categories.use_radio}1{else}0{/if}; var use_radio = {if $categories.use_radio}1{else}0{/if};
var selectedCat = '{implode value=$categories.selected_cat}'; var selectedCat = {$categories.selected_cat|@implode|intval};
var selectedLabel = '{$categories.trads.selected}'; var selectedLabel = '{$categories.trads.selected|@addcslashes:'\''}';
var home = '{$categories.trads.Root.name}'; var home = '{$categories.trads.Root.name|@addcslashes:'\''}';
var use_radio = {if $categories.use_radio}1{else}0{/if}; var use_radio = {if $categories.use_radio}1{else}0{/if};
var use_context = {if isset($categories.use_context)}1{else}0{/if}; var use_context = {if isset($categories.use_context)}1{else}0{/if};
$(document).ready(function(){ $(document).ready(function(){
@@ -187,7 +187,7 @@
{else} {else}
{if $params.type == 'bool'} {if $params.type == 'bool'}
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$key}"> <select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$key}">
<option value="">--</option> <option value="">-</option>
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option> <option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option> <option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
</select> </select>
@@ -197,7 +197,7 @@
{elseif $params.type == 'select'} {elseif $params.type == 'select'}
{if isset($params.filter_key)} {if isset($params.filter_key)}
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}> <select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
<option value="" {if $params.value == ''} selected="selected" {/if}>--</option> <option value="" {if $params.value == ''} selected="selected" {/if}>-</option>
{if isset($params.list) && is_array($params.list)} {if isset($params.list) && is_array($params.list)}
{foreach $params.list AS $option_value => $option_display} {foreach $params.list AS $option_value => $option_display}
<option value="{$option_value}" {if $option_display == $params.value || $option_value == $params.value} selected="selected"{/if}>{$option_display}</option> <option value="{$option_value}" {if $option_display == $params.value || $option_value == $params.value} selected="selected"{/if}>{$option_display}</option>
+2 -2
View File
@@ -1500,7 +1500,7 @@ abstract class AdminTabCore
case 'bool': case 'bool':
echo ' echo '
<select name="'.$this->table.'Filter_'.$key.'"> <select name="'.$this->table.'Filter_'.$key.'">
<option value="">--</option> <option value="">-</option>
<option value="1"'.($value == 1 ? ' selected="selected"' : '').'>'.$this->l('Yes').'</option> <option value="1"'.($value == 1 ? ' selected="selected"' : '').'>'.$this->l('Yes').'</option>
<option value="0"'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option> <option value="0"'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option>
</select>'; </select>';
@@ -1524,7 +1524,7 @@ abstract class AdminTabCore
if (isset($params['filter_key'])) if (isset($params['filter_key']))
{ {
echo '<select onchange="$(\'#submitFilter'.$this->table.'\').focus();$(\'#submitFilter'.$this->table.'\').click();" name="'.$this->table.'Filter_'.$params['filter_key'].'" '.(isset($params['width']) ? 'style="width: '.$params['width'].'px"' : '').'> echo '<select onchange="$(\'#submitFilter'.$this->table.'\').focus();$(\'#submitFilter'.$this->table.'\').click();" name="'.$this->table.'Filter_'.$params['filter_key'].'" '.(isset($params['width']) ? 'style="width: '.$params['width'].'px"' : '').'>
<option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>--</option>'; <option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>-</option>';
if (isset($params['select']) && is_array($params['select'])) if (isset($params['select']) && is_array($params['select']))
foreach ($params['select'] as $optionValue => $optionDisplay) foreach ($params['select'] as $optionValue => $optionDisplay)
{ {
+16
View File
@@ -124,5 +124,21 @@ class AliasCore extends ObjectModel
{ {
return Configuration::get('PS_ALIAS_FEATURE_ACTIVE'); return Configuration::get('PS_ALIAS_FEATURE_ACTIVE');
} }
/**
* This method is allow to know if a alias exist for AdminImportController
* @since 1.5.6.0
* @return bool
*/
public static function aliasExists($id_alias)
{
$row = Db::getInstance()->getRow('
SELECT `id_alias`
FROM '._DB_PREFIX_.'alias a
WHERE a.`id_alias` = '.(int)$id_alias
);
return isset($row['id_alias']);
}
} }
+1 -1
View File
@@ -3219,7 +3219,7 @@ class CartCore extends ObjectModel
public function getWsCartRows() public function getWsCartRows()
{ {
return Db::getInstance()->executeS(' return Db::getInstance()->executeS('
SELECT id_product, id_product_attribute, quantity SELECT id_product, id_product_attribute, quantity, id_address_delivery
FROM `'._DB_PREFIX_.'cart_product` FROM `'._DB_PREFIX_.'cart_product`
WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id
); );
+10
View File
@@ -255,6 +255,16 @@ class CartRuleCore extends ObjectModel
else else
$cart_rule['quantity_for_user'] = 0; $cart_rule['quantity_for_user'] = 0;
foreach ($result as $cart_rule)
if ($cart_rule['shop_restriction'])
{
$cartRuleShops = Db::getInstance()->executeS('SELECT id_shop FROM '._DB_PREFIX_.'cart_rule_shop WHERE id_cart_rule = '.(int)$cart_rule['id_cart_rule']);
foreach ($cartRuleShops as $cartRuleShop)
if (Shop::isFeatureActive() && ($cartRuleShop['id_shop'] == Context::getContext()->shop->id))
continue 2;
unset($result[$key]);
}
// Retrocompatibility with 1.4 discounts // Retrocompatibility with 1.4 discounts
foreach ($result as &$cart_rule) foreach ($result as &$cart_rule)
{ {
+31 -10
View File
@@ -312,16 +312,37 @@ class FeatureCore extends ObjectModel
*/ */
public static function cleanPositions() public static function cleanPositions()
{ {
return Db::getInstance()->execute(' //Reordering positions to remove "holes" in them (after delete for instance)
UPDATE `'._DB_PREFIX_.'feature` f $sql = "SELECT id_feature, position FROM "._DB_PREFIX_."feature ORDER BY id_feature";
LEFT JOIN ( $db = Db::getInstance();
SELECT @i := @i +1 AS rank, id_feature, position $r = $db->executeS($sql, false);
FROM `'._DB_PREFIX_.'feature` $shiftTable = array(); //List of update queries (one query is necessary for each "hole" in the table)
JOIN (SELECT @i :=1) dummy $currentDelta = 0;
ORDER by position $minId = 0;
) AS f2 $maxId = 0;
USING (id_feature) $futurePosition = 1;
SET f.position = f2.rank - 1'); while ($line = $db->nextRow($r)) {
$delta = $futurePosition - $line['position']; //Difference between current position and future position
if ($delta != $currentDelta) {
$shiftTable[] = array('minId' => $minId, 'maxId' => $maxId, 'delta' => $currentDelta);
$currentDelta = $delta;
$minId = $line['id_feature'];
}
$maxId = $line['id_feature'];
$futurePosition++;
}
$shiftTable[] = array('minId' => $minId, 'maxId' => $maxId, 'delta' => $currentDelta);
//Executing generated queries
foreach ($shiftTable as $line) {
$delta = $line['delta'];
if ($delta == 0) continue;
$delta = $delta > 0 ? '+' . (int)$delta : (int)$delta;
$minId = (int)$line['minId'];
$maxId = (int)$line['maxId'];
$sql = "UPDATE "._DB_PREFIX_."feature SET position = position $delta WHERE id_feature >= $minId AND id_feature <= $maxId";
Db::getInstance()->execute($sql);
}
} }
/** /**
+15 -9
View File
@@ -128,30 +128,36 @@ class FeatureValueCore extends ObjectModel
return $tab['value']; return $tab['value'];
} }
public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null) public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null, $custom = false)
{ {
$id_feature_value = false;
if (!is_null($id_product) && $id_product) if (!is_null($id_product) && $id_product)
{ {
$id_feature_value = Db::getInstance()->getValue(' $id_feature_value = Db::getInstance()->getValue('
SELECT `id_feature_value` SELECT fp.`id_feature_value`
FROM '._DB_PREFIX_.'feature_product FROM '._DB_PREFIX_.'feature_product fp
WHERE `id_feature` = '.(int)$id_feature.' INNER JOIN '._DB_PREFIX_.'feature_value fv USING (`id_feature_value`)
AND `id_product` = '.(int)$id_product); WHERE fp.`id_feature` = '.(int)$id_feature.'
AND fv.`custom` = '.(int)$custom.'
AND fp.`id_product` = '.(int)$id_product);
if ($id_feature_value && !is_null($id_lang) && $id_lang) if ($custom && $id_feature_value && !is_null($id_lang) && $id_lang)
Db::getInstance()->execute(' Db::getInstance()->execute('
UPDATE '._DB_PREFIX_.'feature_value_lang UPDATE '._DB_PREFIX_.'feature_value_lang
SET `value` = \''.pSQL($value).'\' SET `value` = \''.pSQL($value).'\'
WHERE `id_feature_value` = '.(int)$id_feature_value.' WHERE `id_feature_value` = '.(int)$id_feature_value.'
AND `value` != \''.pSQL($value).'\'
AND `id_lang` = '.(int)$id_lang); AND `id_lang` = '.(int)$id_lang);
} }
else
if (!$custom)
$id_feature_value = Db::getInstance()->getValue(' $id_feature_value = Db::getInstance()->getValue('
SELECT fv.`id_feature_value` SELECT fv.`id_feature_value`
FROM '._DB_PREFIX_.'feature_value fv FROM '._DB_PREFIX_.'feature_value fv
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`) LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value` AND fvl.`id_lang` = '.(int)$id_lang.')
WHERE `value` = \''.pSQL($value).'\' WHERE `value` = \''.pSQL($value).'\'
AND fv.`id_feature` = '.(int)$id_feature.' AND fv.`id_feature` = '.(int)$id_feature.'
AND fv.`custom` = 0
GROUP BY fv.`id_feature_value`'); GROUP BY fv.`id_feature_value`');
if ($id_feature_value) if ($id_feature_value)
@@ -160,7 +166,7 @@ class FeatureValueCore extends ObjectModel
// Feature doesn't exist, create it // Feature doesn't exist, create it
$feature_value = new FeatureValue(); $feature_value = new FeatureValue();
$feature_value->id_feature = (int)$id_feature; $feature_value->id_feature = (int)$id_feature;
$feature_value->custom = 0; $feature_value->custom = (bool)$custom;
foreach (Language::getLanguages() as $language) foreach (Language::getLanguages() as $language)
$feature_value->value[$language['id_lang']] = $value; $feature_value->value[$language['id_lang']] = $value;
$feature_value->add(); $feature_value->add();
+12 -2
View File
@@ -102,6 +102,11 @@ class QqUploadedFileForm
$image = new Image(); $image = new Image();
$image->id_product = (int)$product->id; $image->id_product = (int)$product->id;
$image->position = Image::getHighestPosition($product->id) + 1; $image->position = Image::getHighestPosition($product->id) + 1;
$legends = Tools::getValue('legend');
if (is_array($legends))
foreach ($legends as $key => $legend)
if (!empty($legend))
$image->legend[(int)$key] = $legend;
if (!Image::getCover($image->id_product)) if (!Image::getCover($image->id_product))
$image->cover = 1; $image->cover = 1;
else else
@@ -136,7 +141,7 @@ class QqUploadedFileForm
if (!$image->update()) if (!$image->update())
return array('error' => Tools::displayError('Error while updating status')); return array('error' => Tools::displayError('Error while updating status'));
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName()); $img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName(), 'legend' => $image->legend);
return array('success' => $img); return array('success' => $img);
} }
@@ -184,6 +189,11 @@ class QqUploadedFileXhr
$image = new Image(); $image = new Image();
$image->id_product = (int)($product->id); $image->id_product = (int)($product->id);
$image->position = Image::getHighestPosition($product->id) + 1; $image->position = Image::getHighestPosition($product->id) + 1;
$legends = Tools::getValue('legend');
if (is_array($legends))
foreach ($legends as $key => $legend)
if (!empty($legend))
$image->legend[(int)$key] = $legend;
if (!Image::getCover($image->id_product)) if (!Image::getCover($image->id_product))
$image->cover = 1; $image->cover = 1;
else else
@@ -223,7 +233,7 @@ class QqUploadedFileXhr
if (!$image->update()) if (!$image->update())
return array('error' => Tools::displayError('Error while updating status')); return array('error' => Tools::displayError('Error while updating status'));
$img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName()); $img = array('id_image' => $image->id, 'position' => $image->position, 'cover' => $image->cover, 'name' => $this->getName(), 'legend' => $image->legend);
return array('success' => $img); return array('success' => $img);
} }
+4
View File
@@ -40,6 +40,9 @@ class ImageCore extends ObjectModel
/** @var boolean Image is cover */ /** @var boolean Image is cover */
public $cover; public $cover;
/** @var string Legend */
public $legend;
/** @var string image extension */ /** @var string image extension */
public $image_format = 'jpg'; public $image_format = 'jpg';
@@ -66,6 +69,7 @@ class ImageCore extends ObjectModel
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true), 'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true),
'legend' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
), ),
); );
+9 -5
View File
@@ -127,16 +127,20 @@ class ImageTypeCore extends ObjectModel
* @param string $name * @param string $name
* @param string $type * @param string $type
*/ */
public static function getByNameNType($name, $type = null) public static function getByNameNType($name, $type = null, $order = null)
{ {
if (!isset(self::$images_types_name_cache[$name.'_'.$type])) if (!isset(self::$images_types_name_cache[$name.'_'.$type.'_'.$order]))
{ {
self::$images_types_name_cache[$name.'_'.$type] = Db::getInstance()->getRow(' self::$images_types_name_cache[$name.'_'.$type.'_'.$order] = Db::getInstance()->getRow('
SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes` SELECT `id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`
FROM `'._DB_PREFIX_.'image_type` FROM `'._DB_PREFIX_.'image_type`
WHERE `name` = \''.pSQL($name).'\' '.(!is_null($type) ? 'AND `'.pSQL($type).'` = 1' : '')); WHERE
`name` LIKE \''.pSQL($name).'\''
.(!is_null($type) ? ' AND `'.pSQL($type).'` = 1' : '')
.(!is_null($order) ? ' ORDER BY `'.bqSQL($order).'` ASC' : '')
);
} }
return self::$images_types_name_cache[$name.'_'.$type]; return self::$images_types_name_cache[$name.'_'.$type.'_'.$order];
} }
public static function getFormatedName($name) public static function getFormatedName($name)
+1 -1
View File
@@ -62,7 +62,7 @@ class LoggerCore extends ObjectModel
'fields' => array( 'fields' => array(
'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true), 'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'error_code' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'error_code' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true), 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true),
'object_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'object_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), 'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
+2 -2
View File
@@ -1139,7 +1139,7 @@ abstract class ObjectModelCore
{ {
$vars = get_class_vars($class_name); $vars = get_class_vars($class_name);
foreach ($vars['shopIDs'] as $id_shop) foreach ($vars['shopIDs'] as $id_shop)
$or[] = ' main.id_shop = '.(int)$id_shop.' '; $or[] = '(main.id_shop = '.(int)$id_shop.(isset($this->def['fields']['id_shop_group']) ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').')';
$prepend = ''; $prepend = '';
if (count($or)) if (count($or))
@@ -1658,4 +1658,4 @@ abstract class ObjectModelCore
{ {
$this->update_fields = $fields; $this->update_fields = $fields;
} }
} }
+7 -7
View File
@@ -536,6 +536,13 @@ abstract class PaymentModuleCore extends Module
if ($order_status->logable) if ($order_status->logable)
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']); ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
// Set the order state
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
$new_history->addWithemail(true, $extra_vars);
// Switch to back order if needed
if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState()) if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState())
{ {
$history = new OrderHistory(); $history = new OrderHistory();
@@ -544,13 +551,6 @@ abstract class PaymentModuleCore extends Module
$history->addWithemail(); $history->addWithemail();
} }
// Set order state in order history ONLY even if the "out of stock" status has not been yet reached
// So you migth have two order states
$new_history = new OrderHistory();
$new_history->id_order = (int)$order->id;
$new_history->changeIdOrderState((int)$id_order_state, $order, true);
$new_history->addWithemail(true, $extra_vars);
unset($order_detail); unset($order_detail);
// Order is reloaded because the status just changed // Order is reloaded because the status just changed
+1
View File
@@ -3590,6 +3590,7 @@ class ProductCore extends ObjectModel
if ($result3) if ($result3)
{ {
$result3['id_feature_value'] = $new_id_feature_value; $result3['id_feature_value'] = $new_id_feature_value;
$result3['value'] = pSQL($result3['value']);
$return &= Db::getInstance()->insert('feature_value_lang', $result3); $return &= Db::getInstance()->insert('feature_value_lang', $result3);
} }
} }
+43 -18
View File
@@ -74,11 +74,22 @@ class ProductSaleCore
$groups = FrontController::getCurrentCustomerGroups(); $groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; $interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
//Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage
$sql = 'SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups;
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
$ids = array();
foreach ($products as $product)
$ids[$product['id_product']] = 1;
$ids = array_keys($ids);
sort($ids);
$ids = count($ids) > 0 ? implode(',', $ids) : 'NULL';
$prefix = ''; //Main query
if ($order_by == 'date_add') if ($order_by == 'date_add')
$prefix = 'p.';
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
@@ -103,13 +114,8 @@ class ProductSaleCore
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
'.Product::sqlStock('p').' '.Product::sqlStock('p').'
WHERE product_shop.`active` = 1 WHERE product_shop.`active` = 1
AND product_shop.`visibility` != \'none\' AND p.`visibility` != \'none\'
AND p.`id_product` IN ( AND p.`id_product` IN ('.$ids.')
SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups.'
)
GROUP BY product_shop.id_product GROUP BY product_shop.id_product
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
@@ -141,11 +147,27 @@ class ProductSaleCore
$groups = FrontController::getCurrentCustomerGroups(); $groups = FrontController::getCurrentCustomerGroups();
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
//Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage
$sql = 'SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups.' AND cp.`id_product` IS NOT NULL';
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
$ids = array();
foreach ($products as $product)
$ids[$product['id_product']] = 1;
$ids = array_keys($ids);
sort($ids);
$ids = count($ids) > 0 ? implode(',', $ids) : 'NULL';
//Main query
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`, $sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`,
ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, p.quantity, p.customizable,
IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, p.out_of_stock
FROM `'._DB_PREFIX_.'product_sale` ps FROM `'._DB_PREFIX_.'product_sale` ps
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
'.Shop::addSqlAssociation('product', 'p').' '.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (ps.`id_product` = pa.`id_product` AND pa.default_on = 1)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON p.`id_product` = pl.`id_product` ON p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
@@ -156,16 +178,12 @@ class ProductSaleCore
ON cl.`id_category` = product_shop.`id_category_default` ON cl.`id_category` = product_shop.`id_category_default`
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
WHERE product_shop.`active` = 1 WHERE product_shop.`active` = 1
AND product_shop.`visibility` != \'none\' AND p.`visibility` != \'none\'
AND p.`id_product` IN ( AND p.`id_product` IN ('.$ids.')
SELECT cp.`id_product`
FROM `'._DB_PREFIX_.'category_group` cg
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
WHERE cg.`id_group` '.$sql_groups.'
)
GROUP BY product_shop.id_product GROUP BY product_shop.id_product
ORDER BY sales DESC ORDER BY sales DESC
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql)) if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
return false; return false;
@@ -173,6 +191,13 @@ class ProductSaleCore
{ {
$row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']); $row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
$row['id_image'] = Product::defineProductImage($row, $id_lang); $row['id_image'] = Product::defineProductImage($row, $id_lang);
$row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
$row['price_tax_exc'] = Product::getPriceStatic(
(int)$row['id_product'],
false,
((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)$row['id_product_attribute'] : null),
(Product::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6)
);
} }
return $result; return $result;
} }
+24 -13
View File
@@ -94,7 +94,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::add($autodate, $nullValues)) if (parent::add($autodate, $nullValues))
{ {
// Flush cache when we adding a new specific price // Flush cache when we adding a new specific price
self::$_specificPriceCache = array(); SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache(); Product::flushPriceCache();
// Set cache of feature detachable to true // Set cache of feature detachable to true
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1'); Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1');
@@ -108,7 +108,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::update($null_values)) if (parent::update($null_values))
{ {
// Flush cache when we updating a new specific price // Flush cache when we updating a new specific price
self::$_specificPriceCache = array(); SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache(); Product::flushPriceCache();
return true; return true;
} }
@@ -120,7 +120,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::delete()) if (parent::delete())
{ {
// Flush cache when we deletind a new specific price // Flush cache when we deletind a new specific price
self::$_specificPriceCache = array(); SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache(); Product::flushPriceCache();
// Refresh cache of feature detachable // Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table'])); Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
@@ -180,9 +180,9 @@ class SpecificPriceCore extends ObjectModel
if (!SpecificPrice::isFeatureActive()) if (!SpecificPrice::isFeatureActive())
return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES')); return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'));
if (!isset(self::$_cache_priorities[(int)$id_product])) if (!isset(SpecificPrice::$_cache_priorities[(int)$id_product]))
{ {
self::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SpecificPrice::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `priority`, `id_specific_price_priority` SELECT `priority`, `id_specific_price_priority`
FROM `'._DB_PREFIX_.'specific_price_priority` FROM `'._DB_PREFIX_.'specific_price_priority`
WHERE `id_product` = '.(int)$id_product.' WHERE `id_product` = '.(int)$id_product.'
@@ -190,7 +190,7 @@ class SpecificPriceCore extends ObjectModel
'); ');
} }
$priority = self::$_cache_priorities[(int)$id_product]; $priority = SpecificPrice::$_cache_priorities[(int)$id_product];
if (!$priority) if (!$priority)
$priority = Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'); $priority = Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES');
@@ -209,11 +209,11 @@ class SpecificPriceCore extends ObjectModel
*/ */
$key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$id_customer.'-'.(int)$real_quantity); $key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$id_customer.'-'.(int)$real_quantity);
if (!array_key_exists($key, self::$_specificPriceCache)) if (!array_key_exists($key, SpecificPrice::$_specificPriceCache))
{ {
$now = date('Y-m-d H:i:s'); $now = date('Y-m-d H:i:s');
self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' $query = '
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).' SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price` FROM `'._DB_PREFIX_.'specific_price`
WHERE `id_product` IN (0, '.(int)$id_product.') WHERE `id_product` IN (0, '.(int)$id_product.')
AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.') AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.')
@@ -228,11 +228,22 @@ class SpecificPriceCore extends ObjectModel
AND AND
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`) (`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
) )
AND id_cart IN (0, '.(int)$id_cart.')'. AND id_cart IN (0, '.(int)$id_cart.') ';
(($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.max(1, (int)$real_quantity)).'
ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC'); if ($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION'))
$query .= ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')';
else
{
$qty_to_use = $id_cart ? (int)$quantity : (int)$real_quantity;
$query .= 'AND `from_quantity` <= '.max(1, $qty_to_use);
}
$query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC';
SpecificPrice::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query);
} }
return self::$_specificPriceCache[$key]; return SpecificPrice::$_specificPriceCache[$key];
} }
public static function setPriorities($priorities) public static function setPriorities($priorities)
+83 -52
View File
@@ -357,13 +357,11 @@ class ToolsCore
if (Validate::isLanguageIsoCode($string)) if (Validate::isLanguageIsoCode($string))
{ {
$lang = new Language(Language::getIdByIso($string)); $lang = new Language(Language::getIdByIso($string));
if (Validate::isLoadedObject($lang) && $lang->active) if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop())
{ {
$language = new Language((int)$lang->id); Context::getContext()->language = $lang;
if (Validate::isLoadedObject($language))
Context::getContext()->language = $language;
$cookie->id_lang = (int)$lang->id; $cookie->id_lang = (int)$lang->id;
} }
} }
} }
@@ -1106,63 +1104,94 @@ class ToolsCore
/* One source among others: /* One source among others:
http://www.tachyonsoft.com/uc0000.htm http://www.tachyonsoft.com/uc0000.htm
http://www.tachyonsoft.com/uc0001.htm http://www.tachyonsoft.com/uc0001.htm
http://www.tachyonsoft.com/uc0004.htm
*/ */
$patterns = array( $patterns = array(
/* Lowercase */ /* Lowercase */
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}]/u', /* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}\x{0430}]/u',
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}]/u', /* b */ '/[\x{0431}]/u',
/* d */ '/[\x{010F}\x{0111}]/u', /* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}\x{0446}]/u',
/* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}]/u', /* d */ '/[\x{010F}\x{0111}\x{0434}]/u',
/* g */ '/[\x{011F}\x{0121}\x{0123}]/u', /* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}\x{0435}\x{044D}]/u',
/* h */ '/[\x{0125}\x{0127}]/u', /* f */ '/[\x{0444}]/u',
/* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}]/u', /* g */ '/[\x{011F}\x{0121}\x{0123}\x{0433}\x{0491}]/u',
/* j */ '/[\x{0135}]/u', /* h */ '/[\x{0125}\x{0127}]/u',
/* k */ '/[\x{0137}\x{0138}]/u', /* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}\x{0438}\x{0456}]/u',
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}]/u', /* j */ '/[\x{0135}\x{0439}]/u',
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}]/u', /* k */ '/[\x{0137}\x{0138}\x{043A}]/u',
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}]/u', /* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}\x{043B}]/u',
/* r */ '/[\x{0155}\x{0157}\x{0159}]/u', /* m */ '/[\x{043C}]/u',
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}]/u', /* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}\x{043D}]/u',
/* ss*/ '/[\x{00DF}]/u', /* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}\x{043E}]/u',
/* t */ '/[\x{0163}\x{0165}\x{0167}]/u', /* p */ '/[\x{043F}]/u',
/* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}]/u', /* r */ '/[\x{0155}\x{0157}\x{0159}\x{0440}]/u',
/* w */ '/[\x{0175}]/u', /* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}\x{0441}]/u',
/* y */ '/[\x{00FF}\x{0177}\x{00FD}]/u', /* ss */ '/[\x{00DF}]/u',
/* z */ '/[\x{017A}\x{017C}\x{017E}]/u', /* t */ '/[\x{0163}\x{0165}\x{0167}\x{0442}]/u',
/* ae*/ '/[\x{00E6}]/u', /* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}\x{0443}]/u',
/* oe*/ '/[\x{0153}]/u', /* v */ '/[\x{0432}]/u',
/* w */ '/[\x{0175}]/u',
/* y */ '/[\x{00FF}\x{0177}\x{00FD}\x{044B}]/u',
/* z */ '/[\x{017A}\x{017C}\x{017E}\x{0437}]/u',
/* ae */ '/[\x{00E6}]/u',
/* ch */ '/[\x{0447}]/u',
/* kh */ '/[\x{0445}]/u',
/* oe */ '/[\x{0153}]/u',
/* sh */ '/[\x{0448}]/u',
/* shh*/ '/[\x{0449}]/u',
/* ya */ '/[\x{044F}]/u',
/* ye */ '/[\x{0454}]/u',
/* yi */ '/[\x{0457}]/u',
/* yo */ '/[\x{0451}]/u',
/* yu */ '/[\x{044E}]/u',
/* zh */ '/[\x{0436}]/u',
/* Uppercase */ /* Uppercase */
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u', /* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}\x{0410}]/u',
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}]/u', /* B */ '/[\x{0411}]]/u',
/* D */ '/[\x{010E}\x{0110}]/u', /* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}\x{0426}]/u',
/* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}]/u', /* D */ '/[\x{010E}\x{0110}\x{0414}]/u',
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}]/u', /* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}\x{0415}\x{042D}]/u',
/* H */ '/[\x{0124}\x{0126}]/u', /* F */ '/[\x{0424}]/u',
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}]/u', /* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}\x{0413}\x{0490}]/u',
/* J */ '/[\x{0134}]/u', /* H */ '/[\x{0124}\x{0126}]/u',
/* K */ '/[\x{0136}]/u', /* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}\x{0418}\x{0406}]/u',
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}]/u', /* J */ '/[\x{0134}\x{0419}]/u',
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}]/u', /* K */ '/[\x{0136}\x{041A}]/u',
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}]/u', /* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}\x{041B}]/u',
/* R */ '/[\x{0154}\x{0156}\x{0158}]/u', /* M */ '/[\x{041C}]/u',
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}]/u', /* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}\x{041D}]/u',
/* T */ '/[\x{0162}\x{0164}\x{0166}]/u', /* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}\x{041E}]/u',
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}]/u', /* P */ '/[\x{041F}]/u',
/* W */ '/[\x{0174}]/u', /* R */ '/[\x{0154}\x{0156}\x{0158}\x{0420}]/u',
/* Y */ '/[\x{0176}]/u', /* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}\x{0421}]/u',
/* Z */ '/[\x{0179}\x{017B}\x{017D}]/u', /* T */ '/[\x{0162}\x{0164}\x{0166}\x{0422}]/u',
/* AE*/ '/[\x{00C6}]/u', /* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}\x{0423}]/u',
/* OE*/ '/[\x{0152}]/u'); /* V */ '/[\x{0412}]/u',
/* W */ '/[\x{0174}]/u',
/* Y */ '/[\x{0176}\x{042B}]/u',
/* Z */ '/[\x{0179}\x{017B}\x{017D}\x{0417}]/u',
/* AE */ '/[\x{00C6}]/u',
/* CH */ '/[\x{0427}]/u',
/* KH */ '/[\x{0425}]/u',
/* OE */ '/[\x{0152}]/u',
/* SH */ '/[\x{0428}]/u',
/* SHH*/ '/[\x{0429}]/u',
/* YA */ '/[\x{042F}]/u',
/* YE */ '/[\x{0404}]/u',
/* YI */ '/[\x{0407}]/u',
/* YO */ '/[\x{0401}]/u',
/* YU */ '/[\x{042E}]/u',
/* ZH */ '/[\x{0416}]/u');
// ö to oe // ö to oe
// å to aa // å to aa
// ä to ae // ä to ae
$replacements = array( $replacements = array(
'a', 'c', 'd', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'w', 'z', 'ae', 'oe', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 'ss', 't', 'u', 'v', 'w', 'y', 'z', 'ae', 'ch', 'kh', 'oe', 'sh', 'shh', 'ya', 'ye', 'yi', 'yo', 'yu', 'zh',
'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'W', 'Y', 'Z', 'AE', 'OE' 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'Y', 'Z', 'AE', 'CH', 'KH', 'OE', 'SH', 'SHH', 'YA', 'YE', 'YI', 'YO', 'YU', 'ZH'
); );
return preg_replace($patterns, $replacements, $str); return preg_replace($patterns, $replacements, $str);
@@ -1691,13 +1720,15 @@ class ToolsCore
fwrite($write_fd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n"); fwrite($write_fd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n");
if ($disable_modsec) if ($disable_modsec)
fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n"); fwrite($write_fd, "<IfModule mod_security.c>\nSecFilterEngine Off\nSecFilterScanPOST Off\n</IfModule>\n\n");
// RewriteEngine // RewriteEngine
fwrite($write_fd, "<IfModule mod_rewrite.c>\n"); fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
// Ensure HTTP_MOD_REWRITE variable is set in environment // Ensure HTTP_MOD_REWRITE variable is set in environment
fwrite($write_fd, "<IfModule mod_env.c>\n");
fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n"); fwrite($write_fd, "SetEnv HTTP_MOD_REWRITE On\n");
fwrite($write_fd, "</IfModule>\n\n");
// Disable multiviews ? // Disable multiviews ?
if ($disable_multiviews) if ($disable_multiviews)
+8 -3
View File
@@ -1940,7 +1940,10 @@ class AdminControllerCore extends Controller
$this->context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); $this->context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
elseif ($this->context->shop->id != $shop_id) elseif ($this->context->shop->id != $shop_id)
$this->context->shop = new Shop($shop_id); $this->context->shop = new Shop($shop_id);
// Replace current default country
$this->context->country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT'));
$this->initBreadcrumbs(); $this->initBreadcrumbs();
} }
@@ -2189,8 +2192,10 @@ class AdminControllerCore extends Controller
if (preg_match('/[.!]/', $order_by)) if (preg_match('/[.!]/', $order_by))
{ {
$order_by_split = preg_split('/[.!]/', $order_by); $order_by_split = preg_split('/[.!]/', $order_by);
$order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`'; $order_by = bqSQL($order_by_split[0]).'.`'.bqSQL($order_by_split[1]).'`';
} }
elseif ($order_by)
$order_by = '`'.bqSQL($order_by).'`';
$this->_orderWay = Tools::strtoupper($order_way); $this->_orderWay = Tools::strtoupper($order_way);
@@ -2284,7 +2289,7 @@ class AdminControllerCore extends Controller
(isset($this->_filter) ? $this->_filter : '').$where_shop.' (isset($this->_filter) ? $this->_filter : '').$where_shop.'
'.(isset($this->_group) ? $this->_group.' ' : '').' '.(isset($this->_group) ? $this->_group.' ' : '').'
'.$having_clause.' '.$having_clause.'
ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). ORDER BY '.((str_replace('`', '', $order_by) == $this->identifier) ? 'a.' : '').$order_by.' '.pSQL($order_way).
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : ''). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : ''); (($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
+6 -8
View File
@@ -213,20 +213,18 @@ class HelperCore
$html = ' $html = '
<script type="text/javascript"> <script type="text/javascript">
var inputName = "'.$input_name.'"; var inputName = \''.addcslashes($input_name, '\'').'\';'."\n";
';
if (count($selected_cat) > 0) if (count($selected_cat) > 0)
{ {
if (isset($selected_cat[0])) if (isset($selected_cat[0]))
$html .= 'var selectedCat = "'.implode(',', $selected_cat).'";'; $html .= ' var selectedCat = '.(int)implode(',', $selected_cat).';'."\n";
else else
$html .= 'var selectedCat = "'.implode(',', array_keys($selected_cat)).'";'; $html .= ' var selectedCat = '.(int)implode(',', array_keys($selected_cat)).';'."\n";
} }
else else
$html .= 'var selectedCat = "";'; $html .= ' var selectedCat = \'\';'."\n";
$html .= ' $html .= ' var selectedLabel = \''.$translations['selected'].'\';
var selectedLabel = \''.$translations['selected'].'\'; var home = \''.addcslashes($root['name'], '\'').'\';
var home = \''.$root['name'].'\';
var use_radio = '.(int)$use_radio.';'; var use_radio = '.(int)$use_radio.';';
if (!$use_in_popup) if (!$use_in_popup)
$html .= ' $html .= '
+1
View File
@@ -1753,6 +1753,7 @@ abstract class ModuleCore
@unlink($file); @unlink($file);
@file_put_contents($file, $xml); @file_put_contents($file, $xml);
} }
@chmod($file, 0664);
} }
} }
+4 -2
View File
@@ -73,8 +73,10 @@ function bqSQL($string)
function displayFatalError() function displayFatalError()
{ {
$error = error_get_last(); $error = null;
if ($error !== NULL && in_array($error['type'], array(E_ERROR, E_PARSE))) if (function_exists('error_get_last'))
$error = error_get_last();
if ($error !== NULL && in_array($error['type'], array(E_ERROR, E_PARSE, E_COMPILE_ERROR )))
echo '[PrestaShop] Fatal error in module '.substr(basename($error['file']), 0, -4).':<br />'.$error['message']; echo '[PrestaShop] Fatal error in module '.substr(basename($error['file']), 0, -4).':<br />'.$error['message'];
} }
@@ -157,6 +157,8 @@ class AdminAttachmentsControllerCore extends AdminController
$this->errors[] = $this->l('Failed to copy the file.'); $this->errors[] = $this->l('Failed to copy the file.');
$_POST['file_name'] = $_FILES['file']['name']; $_POST['file_name'] = $_FILES['file']['name'];
@unlink($_FILES['file']['tmp_name']); @unlink($_FILES['file']['tmp_name']);
if (!sizeof($this->errors) && isset($a) && file_exists(_PS_DOWNLOAD_DIR_.$a->file))
unlink(_PS_DOWNLOAD_DIR_.$a->file);
$_POST['file'] = $uniqid; $_POST['file'] = $uniqid;
$_POST['mime'] = $_FILES['file']['type']; $_POST['mime'] = $_FILES['file']['type'];
} }
@@ -172,11 +174,14 @@ class AdminAttachmentsControllerCore extends AdminController
'<b>'.$upload_mb.'</b>' '<b>'.$upload_mb.'</b>'
); );
} }
else if (!empty($_FILES['file']['tmp_name'])) else
$this->errors[] = $this->l('Upload error. Please check your server configurations for the maximum upload size allowed.'); $this->errors[] = $this->l('Upload error. Please check your server configurations for the maximum upload size allowed.');
} }
$this->validateRules(); $this->validateRules();
} }
return parent::postProcess(); $return = parent::postProcess();
if (!$return && isset($uniqid) && file_exists(_PS_DOWNLOAD_DIR_.$uniqid))
unlink(_PS_DOWNLOAD_DIR_.$uniqid);
return $return;
} }
} }
@@ -884,7 +884,7 @@ class AdminCarrierWizardControllerCore extends AdminController
$step_number = Tools::getValue('step_number'); $step_number = Tools::getValue('step_number');
if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive()) if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive())
return array(); return array('fields' => array());
$step_fields = array( $step_fields = array(
1 => array('name', 'delay', 'grade', 'url'), 1 => array('name', 'delay', 'grade', 'url'),
@@ -903,7 +903,7 @@ class AdminCarrierWizardControllerCore extends AdminController
foreach ($definition['fields'] as $field => $def) foreach ($definition['fields'] as $field => $def)
if (!in_array($field, $step_fields[$step_number])) if (!in_array($field, $step_fields[$step_number]))
unset($definition['fields'][$field]); unset($definition['fields'][$field]);
return $definition; return $definition;
} }
@@ -304,7 +304,7 @@ class AdminCustomersControllerCore extends AdminController
'name' => 'passwd', 'name' => 'passwd',
'size' => 33, 'size' => 33,
'required' => ($obj->id ? false : true), 'required' => ($obj->id ? false : true),
'desc' => ($obj->id ? $this->l('Leave this field blank if there\'s no change') : $this->l('Minimum of five characters (only letters and numbers).').' -_') 'desc' => ($obj->id ? $this->l('Leave this field blank if there\'s no change') : $this->l('Minimum of five characters'))
), ),
array( array(
'type' => 'birthday', 'type' => 'birthday',
@@ -615,9 +615,10 @@ class AdminCustomersControllerCore extends AdminController
$carts[$i]['name'] = $carrier->name; $carts[$i]['name'] = $carrier->name;
} }
$sql = 'SELECT DISTINCT id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop $sql = 'SELECT DISTINCT cp.id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
FROM '._DB_PREFIX_.'cart_product cp FROM '._DB_PREFIX_.'cart_product cp
JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart) JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart)
JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product)
WHERE c.id_customer = '.(int)$customer->id.' WHERE c.id_customer = '.(int)$customer->id.'
AND cp.id_product NOT IN ( AND cp.id_product NOT IN (
SELECT product_id SELECT product_id
@@ -630,6 +631,8 @@ class AdminCustomersControllerCore extends AdminController
for ($i = 0; $i < $total_interested; $i++) for ($i = 0; $i < $total_interested; $i++)
{ {
$product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']); $product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']);
if (!Validate::isLoadedObject($product))
continue;
$interested[$i]['url'] = $this->context->link->getProductLink( $interested[$i]['url'] = $this->context->link->getProductLink(
$product->id, $product->id,
$product->link_rewrite, $product->link_rewrite,
@@ -643,15 +646,15 @@ class AdminCustomersControllerCore extends AdminController
} }
$connections = $customer->getLastConnections(); $connections = $customer->getLastConnections();
if (!is_array($connections))
$connections = array();
$total_connections = count($connections); $total_connections = count($connections);
for ($i = 0; $i < $total_connections; $i++) for ($i = 0; $i < $total_connections; $i++)
{ {
$connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'],null , true); $connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'],null , true);
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? $connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link');
preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) :
$this->l('Direct link');
} }
$referrers = Referrer::getReferrers($customer->id); $referrers = Referrer::getReferrers($customer->id);
$total_referrers = count($referrers); $total_referrers = count($referrers);
for ($i = 0; $i < $total_referrers; $i++) for ($i = 0; $i < $total_referrers; $i++)
@@ -190,7 +190,7 @@ class AdminEmployeesControllerCore extends AdminController
'size' => 33, 'size' => 33,
'desc' => ($obj->id ? 'desc' => ($obj->id ?
$this->l('Leave this field blank if you do not want to change your password.') : $this->l('Leave this field blank if you do not want to change your password.') :
$this->l('Minimum of eight characters (use only letters and numbers)').' -_') $this->l('Minimum of eight characters'))
), ),
array( array(
'type' => 'text', 'type' => 'text',
+3 -2
View File
@@ -438,10 +438,11 @@ class AdminImagesControllerCore extends AdminController
if (!is_dir($dir)) if (!is_dir($dir))
return false; return false;
$toDel = scandir($dir); $toDel = scandir($dir);
foreach ($toDel as $d) foreach ($toDel as $d)
foreach ($type as $imageType) foreach ($type as $imageType)
if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-(.*)\.jpg$/', $d)) if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-'.$imageType['name'].'\.jpg$/', $d))
if (file_exists($dir.$d)) if (file_exists($dir.$d))
unlink($dir.$d); unlink($dir.$d);
// delete product images using new filesystem. // delete product images using new filesystem.
+205 -84
View File
@@ -88,6 +88,7 @@ class AdminImportControllerCore extends AdminController
$this->l('Addresses'), $this->l('Addresses'),
$this->l('Manufacturers'), $this->l('Manufacturers'),
$this->l('Suppliers'), $this->l('Suppliers'),
$this->l('Alias'),
); );
// @since 1.5.0 // @since 1.5.0
@@ -246,13 +247,13 @@ class AdminImportControllerCore extends AdminController
'delete_existing_images' => array( 'delete_existing_images' => array(
'label' => $this->l('Delete existing images (0 = No, 1 = Yes)') 'label' => $this->l('Delete existing images (0 = No, 1 = Yes)')
), ),
'features' => array('label' => $this->l('Feature(Name:Value:Position)')), 'features' => array('label' => $this->l('Feature(Name:Value:Position:Customized)')),
'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')), 'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')),
'condition' => array('label' => $this->l('Condition')), 'condition' => array('label' => $this->l('Condition')),
'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')), 'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')),
'uploadable_files' => array('label' => $this->l('Uploadable files (0 = No, 1 = Yes)')), 'uploadable_files' => array('label' => $this->l('Uploadable files (0 = No, 1 = Yes)')),
'text_fields' => array('label' => $this->l('Text fields (0 = No, 1 = Yes)')), 'text_fields' => array('label' => $this->l('Text fields (0 = No, 1 = Yes)')),
'out_of_stock' => array('label' => $this->l('Out_of_stock')), 'out_of_stock' => array('label' => $this->l('Action when out of stock')),
'advanced_stock_management' => array('label' => $this->l('Advanced stock management')), 'advanced_stock_management' => array('label' => $this->l('Advanced stock management')),
'shop' => array( 'shop' => array(
'label' => $this->l('ID / Name of shop'), 'label' => $this->l('ID / Name of shop'),
@@ -360,7 +361,6 @@ class AdminImportControllerCore extends AdminController
'postcode' => 'X' 'postcode' => 'X'
); );
break; break;
case $this->entities[$this->l('Manufacturers')]: case $this->entities[$this->l('Manufacturers')]:
case $this->entities[$this->l('Suppliers')]: case $this->entities[$this->l('Suppliers')]:
//Overwrite validators AS name is not MultiLangField //Overwrite validators AS name is not MultiLangField
@@ -382,6 +382,7 @@ class AdminImportControllerCore extends AdminController
'meta_title' => array('label' => $this->l('Meta title')), 'meta_title' => array('label' => $this->l('Meta title')),
'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_keywords' => array('label' => $this->l('Meta keywords')),
'meta_description' => array('label' => $this->l('Meta description')), 'meta_description' => array('label' => $this->l('Meta description')),
'image' => array('label' => $this->l('Image URL')),
'shop' => array( 'shop' => array(
'label' => $this->l('ID / Name of group shop'), 'label' => $this->l('ID / Name of group shop'),
'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.'),
@@ -392,6 +393,23 @@ class AdminImportControllerCore extends AdminController
'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')), 'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')),
); );
break; break;
case $this->entities[$this->l('Alias')]:
//Overwrite required_fields
$this->required_fields = array(
'alias',
'search',
);
$this->available_fields = array(
'no' => array('label' => $this->l('Ignore this column')),
'id' => array('label' => $this->l('ID')),
'alias' => array('label' => $this->l('Alias *')),
'search' => array('label' => $this->l('Search *')),
'active' => array('label' => $this->l('Active')),
);
self::$default_values = array(
'active' => '1',
);
break;
} }
// @since 1.5.0 // @since 1.5.0
@@ -455,9 +473,8 @@ class AdminImportControllerCore extends AdminController
} }
$this->separator = Tools::substr(strval(trim(Tools::getValue('separator', ';'))), 0, 1); $this->separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator : ';';
$this->multiple_value_separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator', ','))), 0, 1); $this->multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : ',';
parent::__construct(); parent::__construct();
} }
@@ -552,8 +569,8 @@ class AdminImportControllerCore extends AdminController
$this->context->cookie->entity_selected = (int)Tools::getValue('entity'); $this->context->cookie->entity_selected = (int)Tools::getValue('entity');
$this->context->cookie->iso_lang_selected = base64_encode(Tools::getValue('iso_lang')); $this->context->cookie->iso_lang_selected = base64_encode(Tools::getValue('iso_lang'));
$this->context->cookie->separator_selected = base64_encode(Tools::getValue('separator')); $this->context->cookie->separator_selected = base64_encode($this->separator);
$this->context->cookie->multiple_value_separator_selected = base64_encode(Tools::getValue('multiple_value_separator')); $this->context->cookie->multiple_value_separator_selected = base64_encode($this->multiple_value_separator);
$this->context->cookie->csv_selected = base64_encode(Tools::getValue('csv')); $this->context->cookie->csv_selected = base64_encode(Tools::getValue('csv'));
$this->tpl_view_vars = array( $this->tpl_view_vars = array(
@@ -866,6 +883,12 @@ class AdminImportControllerCore extends AdminController
case 'categories': case 'categories':
$path = _PS_CAT_IMG_DIR_.(int)$id_entity; $path = _PS_CAT_IMG_DIR_.(int)$id_entity;
break; break;
case 'manufacturers':
$path = _PS_MANU_IMG_DIR_.(int)$id_entity;
break;
case 'suppliers':
$path = _PS_SUPP_IMG_DIR_.(int)$id_entity;
break;
} }
$url = str_replace(' ', '%20', trim($url)); $url = str_replace(' ', '%20', trim($url));
@@ -942,7 +965,7 @@ class AdminImportControllerCore extends AdminController
} }
elseif (isset($category->parent) && is_string($category->parent)) elseif (isset($category->parent) && is_string($category->parent))
{ {
$category_parent = Category::searchByName($default_language_id, $category->parent, true); $category_parent = Category::searchByName($id_lang, $category->parent, true);
if ($category_parent['id_category']) if ($category_parent['id_category'])
{ {
$category->id_parent = (int)$category_parent['id_category']; $category->id_parent = (int)$category_parent['id_category'];
@@ -963,7 +986,7 @@ class AdminImportControllerCore extends AdminController
{ {
$this->errors[] = sprintf( $this->errors[] = sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'), Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$category_to_create->name[$default_language_id], $category_to_create->name[$id_lang],
(isset($category_to_create->id) && !empty($category_to_create->id))? $category_to_create->id : 'null' (isset($category_to_create->id) && !empty($category_to_create->id))? $category_to_create->id : 'null'
); );
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : ''). $this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
@@ -1005,8 +1028,8 @@ class AdminImportControllerCore extends AdminController
($lang_field_error = $category->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && empty($this->errors)) ($lang_field_error = $category->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && empty($this->errors))
{ {
$category_already_created = Category::searchByNameAndParentCategoryId( $category_already_created = Category::searchByNameAndParentCategoryId(
$default_language_id, $id_lang,
$category->name[$default_language_id], $category->name[$id_lang],
$category->id_parent $category->id_parent
); );
@@ -1069,11 +1092,11 @@ class AdminImportControllerCore extends AdminController
// Get shops for each attributes // Get shops for each attributes
$info['shop'] = explode($this->multiple_value_separator, $info['shop']); $info['shop'] = explode($this->multiple_value_separator, $info['shop']);
foreach ($info['shop'] as $shop) foreach ($info['shop'] as $shop)
if (!is_numeric($shop)) if (!empty($shop) && !is_numeric($shop))
$category->addShop(Shop::getIdByName($shop)); $category->addShop(Shop::getIdByName($shop));
else elseif (!empty($shop))
$category->addShop($shop); $category->addShop($shop);
} }
} }
@@ -1121,7 +1144,7 @@ class AdminImportControllerCore extends AdminController
else else
$product = new Product(); $product = new Product();
if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product')) if (isset($product->id) && $product->id && Product::existsInDatabase((int)$product->id, 'product'))
{ {
$product->loadStockData(); $product->loadStockData();
$category_data = Product::getProductCategories((int)$product->id); $category_data = Product::getProductCategories((int)$product->id);
@@ -1145,9 +1168,9 @@ class AdminImportControllerCore extends AdminController
// link product to shops // link product to shops
$product->id_shop_list = array(); $product->id_shop_list = array();
foreach (explode($this->multiple_value_separator, $product->shop) as $shop) foreach (explode($this->multiple_value_separator, $product->shop) as $shop)
if (!is_numeric($shop)) if (!empty($shop) && !is_numeric($shop))
$product->id_shop_list[] = Shop::getIdByName($shop); $product->id_shop_list[] = Shop::getIdByName($shop);
else elseif (!empty($shop))
$product->id_shop_list[] = $shop; $product->id_shop_list[] = $shop;
if ((int)$product->id_tax_rules_group != 0) if ((int)$product->id_tax_rules_group != 0)
@@ -1270,7 +1293,7 @@ class AdminImportControllerCore extends AdminController
} }
else if (is_string($value) && !empty($value)) else if (is_string($value) && !empty($value))
{ {
$category = Category::searchByName($default_language_id, trim($value), true); $category = Category::searchByName($id_lang, trim($value), true);
if ($category['id_category']) if ($category['id_category'])
$product->id_category[] = (int)$category['id_category']; $product->id_category[] = (int)$category['id_category'];
else else
@@ -1388,8 +1411,10 @@ class AdminImportControllerCore extends AdminController
$product_shop = explode($this->multiple_value_separator, $product->shop); $product_shop = explode($this->multiple_value_separator, $product->shop);
foreach ($product_shop as $shop) foreach ($product_shop as $shop)
{ {
if (empty($shop))
continue;
$shop = trim($shop); $shop = trim($shop);
if (!is_numeric($shop)) if (!empty($shop) && !is_numeric($shop))
$shop = Shop::getIdByName($shop); $shop = Shop::getIdByName($shop);
if (in_array($shop, $shop_ids)) if (in_array($shop, $shop_ids))
@@ -1441,36 +1466,36 @@ class AdminImportControllerCore extends AdminController
$id_shop_list = array(); $id_shop_list = array();
foreach ($info['shop'] as $shop) foreach ($info['shop'] as $shop)
if (!is_numeric($shop)) if (!empty($shop) && !is_numeric($shop))
$id_shop_list[] = (int)Shop::getIdByName($shop); $id_shop_list[] = (int)Shop::getIdByName($shop);
else elseif (!empty($shop))
$id_shop_list[] = $shop; $id_shop_list[] = $shop;
if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0)) if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0))
foreach($id_shop_list as $id_shop) foreach($id_shop_list as $id_shop)
{ {
$specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0); $specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0);
if (is_array($specific_price) && isset($specific_price['id_specific_price'])) if (is_array($specific_price) && isset($specific_price['id_specific_price']))
$specific_price = new SpecificPrice((int)$specific_price['id_specific_price']); $specific_price = new SpecificPrice((int)$specific_price['id_specific_price']);
else else
$specific_price = new SpecificPrice(); $specific_price = new SpecificPrice();
$specific_price->id_product = (int)$product->id; $specific_price->id_product = (int)$product->id;
$specific_price->id_specific_price_rule = 0; $specific_price->id_specific_price_rule = 0;
$specific_price->id_shop = $id_shop; $specific_price->id_shop = $id_shop;
$specific_price->id_currency = 0; $specific_price->id_currency = 0;
$specific_price->id_country = 0; $specific_price->id_country = 0;
$specific_price->id_group = 0; $specific_price->id_group = 0;
$specific_price->price = -1; $specific_price->price = -1;
$specific_price->id_customer = 0; $specific_price->id_customer = 0;
$specific_price->from_quantity = 1; $specific_price->from_quantity = 1;
$specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100; $specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100;
$specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage'; $specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage';
$specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00'; $specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00';
$specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00'; $specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00';
if (!$specific_price->save()) if (!$specific_price->save())
$this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid')); $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
} }
if (isset($product->tags) && !empty($product->tags)) if (isset($product->tags) && !empty($product->tags))
{ {
@@ -1484,7 +1509,8 @@ class AdminImportControllerCore extends AdminController
if (is_array($product->tags) && count($product->tags)) if (is_array($product->tags) && count($product->tags))
{ {
foreach ($product->tags as $key => $tag) foreach ($product->tags as $key => $tag)
$product->tags[$key] = trim($tag); if (!empty($tag))
$product->tags[$key] = trim($tag);
$tags[$id_lang] = $product->tags; $tags[$id_lang] = $product->tags;
$product->tags = $tags; $product->tags = $tags;
} }
@@ -1492,7 +1518,7 @@ class AdminImportControllerCore extends AdminController
} }
// Delete tags for this id product, for no duplicating error // Delete tags for this id product, for no duplicating error
Tag::deleteTagsForProduct($product->id); Tag::deleteTagsForProduct($product->id);
if (!is_array($product->tags)) if (!is_array($product->tags) && !empty($product->tags))
{ {
$product->tags = AdminImportController::createMultiLangField($product->tags); $product->tags = AdminImportController::createMultiLangField($product->tags);
foreach ($product->tags as $key => $tags) foreach ($product->tags as $key => $tags)
@@ -1576,14 +1602,20 @@ class AdminImportControllerCore extends AdminController
if (isset($features['features']) && !empty($features['features'])) if (isset($features['features']) && !empty($features['features']))
foreach (explode($this->multiple_value_separator, $features['features']) as $single_feature) foreach (explode($this->multiple_value_separator, $features['features']) as $single_feature)
{ {
if (empty($single_feature))
continue;
$tab_feature = explode(':', $single_feature); $tab_feature = explode(':', $single_feature);
$feature_name = trim($tab_feature[0]); $feature_name = isset($tab_feature[0]) ? trim($tab_feature[0]) : '';
$feature_value = trim($tab_feature[1]); $feature_value = isset($tab_feature[1]) ? trim($tab_feature[1]) : '';
$position = isset($tab_feature[2]) ? $tab_feature[2]: false; $position = isset($tab_feature[2]) ? (int)$tab_feature[2] : false;
$custom = isset($tab_feature[3]) ? (int)$tab_feature[3] : false;
if(!empty($feature_name) && !empty($feature_value)) if(!empty($feature_name) && !empty($feature_value))
{ {
$id_feature = Feature::addFeatureImport($feature_name, $position); $id_feature = (int)Feature::addFeatureImport($feature_name, $position);
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value, $product->id, $id_lang); $id_product = null;
if (Tools::getValue('forceIDs') || Tools::getValue('match_ref'))
$id_product = (int)$product->id;
$id_feature_value = (int)FeatureValue::addFeatureValueImport($id_feature, $feature_value, $id_product, $id_lang, $custom);
Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value); Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value);
} }
} }
@@ -1601,7 +1633,6 @@ class AdminImportControllerCore extends AdminController
StockAvailable::setQuantity((int)$product->id, 0, $product->quantity, $this->context->shop->id); StockAvailable::setQuantity((int)$product->id, 0, $product->quantity, $this->context->shop->id);
} }
$this->closeCsvFile($handle); $this->closeCsvFile($handle);
} }
@@ -1641,11 +1672,12 @@ class AdminImportControllerCore extends AdminController
$info['shop'] = explode($this->multiple_value_separator, $info['shop']); $info['shop'] = explode($this->multiple_value_separator, $info['shop']);
$id_shop_list = array(); $id_shop_list = array();
foreach ($info['shop'] as $shop) if (is_array($info['shop']) && count($info['shop']))
if (!is_numeric($shop)) foreach ($info['shop'] as $shop)
$id_shop_list[] = Shop::getIdByName($shop); if (!empty($shop) && !is_numeric($shop))
else $id_shop_list[] = Shop::getIdByName($shop);
$id_shop_list[] = $shop; elseif (!empty($shop))
$id_shop_list[] = $shop;
if(isset($info['id_product'])) if(isset($info['id_product']))
$product = new Product((int)$info['id_product'], false, $default_language); $product = new Product((int)$info['id_product'], false, $default_language);
@@ -1719,12 +1751,14 @@ class AdminImportControllerCore extends AdminController
if(isset($info['group'])) if(isset($info['group']))
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group)
{ {
if (empty($group))
continue;
$tab_group = explode(':', $group); $tab_group = explode(':', $group);
$group = trim($tab_group[0]); $group = trim($tab_group[0]);
if (!isset($tab_group[1])) if (!isset($tab_group[1]))
$type = 'select'; $type = 'select';
else else
$type = trim($tab_group[1]); $type = trim($tab_group[1]);
// sets group // sets group
$groups_attributes[$key]['group'] = $group; $groups_attributes[$key]['group'] = $group;
@@ -1774,6 +1808,8 @@ class AdminImportControllerCore extends AdminController
if(isset($info['attribute'])) if(isset($info['attribute']))
foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute) foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute)
{ {
if (empty($attribute))
continue;
$tab_attribute = explode(':', $attribute); $tab_attribute = explode(':', $attribute);
$attribute = trim($tab_attribute[0]); $attribute = trim($tab_attribute[0]);
// if position is filled // if position is filled
@@ -1920,6 +1956,9 @@ class AdminImportControllerCore extends AdminController
$this->receiveTab(); $this->receiveTab();
$handle = $this->openCsvFile(); $handle = $this->openCsvFile();
$default_language_id = (int)Configuration::get('PS_LANG_DEFAULT'); $default_language_id = (int)Configuration::get('PS_LANG_DEFAULT');
$id_lang = Language::getIdByIso(Tools::getValue('iso_lang'));
if (!Validate::isUnsignedId($id_lang))
$id_lang = $default_language_id;
AdminImportController::setLocale(); AdminImportController::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++)
{ {
@@ -1947,31 +1986,40 @@ class AdminImportControllerCore extends AdminController
$customer_exist = true; $customer_exist = true;
$customer_groups = $customer->getGroups(); $customer_groups = $customer->getGroups();
$addresses = $customer->getAddresses((int)Configuration::get('PS_LANG_DEFAULT')); $addresses = $customer->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
foreach ($customer_groups as $key => $group)
if ($group == $customer->id_default_group)
unset($customer_groups[$key]);
} }
if (!isset($customer_groups) || count($customer_groups) == 0)
$customer_groups = array(0 => Configuration::get('PS_CUSTOMER_GROUP'));
// Group Importation // Group Importation
if (isset($info['group']) && !empty($info['group'])) if (isset($info['group']) && !empty($info['group']))
{ {
if (!isset($customer_groups)) foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group)
$customer_groups = array();
$myGroup = Group::searchByName($default_language_id, $info['group']);
if (!$myGroup)
{ {
$myGroup = new Group(); if(empty($group))
$myGroup->name = Array($default_language_id => $info['group']); continue;
$myGroup->price_display_method = 1; $id_group = false;
$myGroup->add(); $myGroup = Group::searchByName($id_lang, $group);
$myGroup = Group::searchByName($default_language_id, $info['group']); if (isset($myGroup['id_group']) && $myGroup['id_group'])
$id_group = (int)$myGroup['id_group'];
if (!$id_group)
{
$myGroup = new Group();
$myGroup->name = Array($id_lang => $group);
if ($id_lang != $default_language_id)
$myGroup->name = array_merge($myGroup->name, array($default_language_id => $group));
$myGroup->price_display_method = 1;
$myGroup->add();
if (Validate::isLoadedObject($myGroup))
$id_group = (int)$myGroup->id;
}
if ($id_group)
$customer_groups[] = (int)$id_group;
} }
if (isset($myGroup['0']['id_group']))
$customer_groups[] = $myGroup['0']['id_group'];
} }
elseif(empty($info['group']) && isset($customer->id) && $customer->id)
$customer_groups = array(0 => Configuration::get('PS_CUSTOMER_GROUP'));
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $customer); AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $customer);
if ($customer->passwd) if ($customer->passwd)
@@ -1985,6 +2033,8 @@ class AdminImportControllerCore extends AdminController
{ {
foreach ($id_shop_list as $id_shop) foreach ($id_shop_list as $id_shop)
{ {
if (empty($id_shop))
continue;
$shop = new Shop((int)$id_shop); $shop = new Shop((int)$id_shop);
$group_shop = $shop->getGroup(); $group_shop = $shop->getGroup();
if ($group_shop->share_customer) if ($group_shop->share_customer)
@@ -2006,7 +2056,7 @@ class AdminImportControllerCore extends AdminController
//set temporally for validate field //set temporally for validate field
$customer->id_shop = $default_shop->id; $customer->id_shop = $default_shop->id;
$customer->id_shop_group = $default_shop->getGroup()->id; $customer->id_shop_group = $default_shop->getGroup()->id;
$customer_groups = array_flip(array_flip($customer_groups));
$res = true; $res = true;
if (($field_error = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true && if (($field_error = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true &&
($lang_field_error = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) ($lang_field_error = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
@@ -2024,12 +2074,9 @@ class AdminImportControllerCore extends AdminController
$customer->id = $current_id_customer; $customer->id = $current_id_customer;
$res &= $customer->update(); $res &= $customer->update();
} }
else else
{ {
$res &= $customer->add(); $res &= $customer->add();
if (isset($customer_groups))
$customer->addGroups($customer_groups);
if (isset($addresses)) if (isset($addresses))
foreach ($addresses as $address) foreach ($addresses as $address)
{ {
@@ -2038,6 +2085,8 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->insert('address', $address); Db::getInstance()->insert('address', $address);
} }
} }
if ($res && isset($customer_groups))
$customer->updateGroup($customer_groups);
} }
} }
else else
@@ -2052,8 +2101,6 @@ class AdminImportControllerCore extends AdminController
else else
{ {
$res &= $customer->add(); $res &= $customer->add();
if (isset($customer_groups))
$customer->addGroups($customer_groups);
if (isset($addresses)) if (isset($addresses))
foreach ($addresses as $address) foreach ($addresses as $address)
{ {
@@ -2062,9 +2109,12 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->insert('address', $address); Db::getInstance()->insert('address', $address);
} }
} }
if ($res && isset($customer_groups))
$customer->updateGroup($customer_groups);
} }
} }
} }
unset($customer_groups);
$customer_exist = false; $customer_exist = false;
if (!$res) if (!$res)
{ {
@@ -2327,6 +2377,11 @@ class AdminImportControllerCore extends AdminController
if (!$res) if (!$res)
$res = $manufacturer->add(); $res = $manufacturer->add();
//copying images of manufacturer
if (isset($manufacturer->image) && !empty($manufacturer->image))
if (!AdminImportController::copyImg($manufacturer->id, null, $manufacturer->image, 'manufacturers', !Tools::getValue('regenerate')))
$this->warnings[] = $manufacturer->image.' '.Tools::displayError('cannot be copied.');
if ($res) if ($res)
{ {
// Associate supplier to group shop // Associate supplier to group shop
@@ -2340,6 +2395,8 @@ class AdminImportControllerCore extends AdminController
$shops = array(); $shops = array();
foreach ($manufacturer->shop as $shop) foreach ($manufacturer->shop as $shop)
{ {
if (empty($shop))
continue;
$shop = trim($shop); $shop = trim($shop);
if (!is_numeric($shop)) if (!is_numeric($shop))
$shop = ShopGroup::getIdByName($shop); $shop = ShopGroup::getIdByName($shop);
@@ -2398,6 +2455,11 @@ class AdminImportControllerCore extends AdminController
if (!$res) if (!$res)
$res = $supplier->add(); $res = $supplier->add();
//copying images of suppliers
if (isset($supplier->image) && !empty($supplier->image))
if (!AdminImportController::copyImg($supplier->id, null, $supplier->image, 'suppliers', !Tools::getValue('regenerate')))
$this->warnings[] = $supplier->image.' '.Tools::displayError('cannot be copied.');
if (!$res) if (!$res)
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf( $this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'), Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
@@ -2417,6 +2479,8 @@ class AdminImportControllerCore extends AdminController
$shops = array(); $shops = array();
foreach ($supplier->shop as $shop) foreach ($supplier->shop as $shop)
{ {
if (empty($shop))
continue;
$shop = trim($shop); $shop = trim($shop);
if (!is_numeric($shop)) if (!is_numeric($shop))
$shop = ShopGroup::getIdByName($shop); $shop = ShopGroup::getIdByName($shop);
@@ -2435,6 +2499,56 @@ class AdminImportControllerCore extends AdminController
$this->closeCsvFile($handle); $this->closeCsvFile($handle);
} }
public function aliasImport()
{
$this->receiveTab();
$handle = $this->openCsvFile();
AdminImportController::setLocale();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++)
{
if (Tools::getValue('convert'))
$line = $this->utf8EncodeArray($line);
$info = AdminImportController::getMaskedRow($line);
AdminImportController::setDefaultValues($info);
if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id'])
$alias = new Alias((int)$info['id']);
else
{
if (array_key_exists('id', $info) && (int)$info['id'] && Alias::existsInDatabase((int)$info['id'], 'alias'))
$alias = new Alias((int)$info['id']);
else
$alias = new Alias();
}
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $alias);
$res = false;
if (($field_error = $alias->validateFields(UNFRIENDLY_ERROR, true)) === true &&
($lang_field_error = $alias->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
{
if ($alias->id && $alias->aliasExists($alias->id))
$res = $alias->update();
if (!$res)
$res = $alias->add();
if (!$res)
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
$info['name'],
(isset($info['id']) ? $info['id'] : 'null')
);
}
else
{
$this->errors[] = $this->l('Alias is invalid').' ('.$alias->name.')';
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '');
}
}
$this->closeCsvFile($handle);
}
/** /**
* @since 1.5.0 * @since 1.5.0
*/ */
@@ -2782,6 +2896,9 @@ class AdminImportControllerCore extends AdminController
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d)) if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
unlink(_PS_SUPP_IMG_DIR_.$d); unlink(_PS_SUPP_IMG_DIR_.$d);
break; break;
case $this->entities[$this->l('Alias')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'alias`');
break;
} }
Image::clearTmpDir(); Image::clearTmpDir();
return true; return true;
@@ -2806,7 +2923,7 @@ class AdminImportControllerCore extends AdminController
if (Tools::isSubmit('submitFileUpload')) if (Tools::isSubmit('submitFileUpload'))
{ {
$path = _PS_ADMIN_DIR_.'/import/'.date('Ymdhis').'-'; $path = _PS_ADMIN_DIR_.'/import/'.date('YmdHis').'-';
if (isset($_FILES['file']) && !empty($_FILES['file']['error'])) if (isset($_FILES['file']) && !empty($_FILES['file']['error']))
{ {
switch ($_FILES['file']['error']) switch ($_FILES['file']['error'])
@@ -2880,6 +2997,9 @@ class AdminImportControllerCore extends AdminController
$this->supplierImport(); $this->supplierImport();
$this->clearSmartyCache(); $this->clearSmartyCache();
break; break;
case $this->entities[$import_type = $this->l('Alias')]:
$this->aliasImport();
break;
} }
// @since 1.5.0 // @since 1.5.0
@@ -2997,3 +3117,4 @@ class AdminImportControllerCore extends AdminController
} }
} }
} }
?>
+23 -5
View File
@@ -174,7 +174,7 @@ class AdminProductsControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.')'; LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.')';
$this->_select .= 'shop.name as shopname, '; $this->_select .= 'shop.name as shopname, a.id_shop_default, ';
$this->_select .= 'MAX('.$alias_image.'.id_image) id_image, cl.name `name_category`, '.$alias.'.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`'; $this->_select .= 'MAX('.$alias_image.'.id_image) id_image, cl.name `name_category`, '.$alias.'.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';
if ($join_category) if ($join_category)
@@ -331,12 +331,17 @@ class AdminProductsControllerCore extends AdminController
$nb = count($this->_list); $nb = count($this->_list);
if ($this->_list) if ($this->_list)
{ {
$context = $this->context->cloneContext();
$context->shop = clone($context->shop);
/* update product final price */ /* update product final price */
for ($i = 0; $i < $nb; $i++) for ($i = 0; $i < $nb; $i++)
{ {
if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP)
$context->shop = new Shop((int)$this->_list[$i]['id_shop_default']);
// convert price with the currency from context // convert price with the currency from context
$this->_list[$i]['price'] = Tools::convertPrice($this->_list[$i]['price'], $this->context->currency, true, $this->context); $this->_list[$i]['price'] = Tools::convertPrice($this->_list[$i]['price'], $this->context->currency, true, $this->context);
$this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null, 2, null, false, true, 1, true); $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null, 2, null, false, true, 1, true, null, null, null, $nothing, true, true, $context);
} }
} }
@@ -1336,7 +1341,6 @@ class AdminProductsControllerCore extends AdminController
if (isset($result['success'])) if (isset($result['success']))
{ {
$obj = new Image((int)$result['success']['id_image']); $obj = new Image((int)$result['success']['id_image']);
// Associate image to shop from context // Associate image to shop from context
$shops = Shop::getContextListShopID(); $shops = Shop::getContextListShopID();
$obj->associateTo($shops); $obj->associateTo($shops);
@@ -1350,6 +1354,7 @@ class AdminProductsControllerCore extends AdminController
'id'=>$obj->id, 'id'=>$obj->id,
'path' => $obj->getExistingImgPath(), 'path' => $obj->getExistingImgPath(),
'position' => $obj->position, 'position' => $obj->position,
'legend' => $obj->legend,
'cover' => $obj->cover, 'cover' => $obj->cover,
'shops' => $json_shops, 'shops' => $json_shops,
); );
@@ -3590,6 +3595,7 @@ class AdminProductsControllerCore extends AdminController
foreach ($images as $k => $image) foreach ($images as $k => $image)
$images[$k] = new Image($image['id_image']); $images[$k] = new Image($image['id_image']);
if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP) if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP)
$current_shop_id = (int)$this->context->shop->id; $current_shop_id = (int)$this->context->shop->id;
else else
@@ -3608,8 +3614,16 @@ class AdminProductsControllerCore extends AdminController
'max_image_size' => $this->max_image_size / 1024 / 1024, 'max_image_size' => $this->max_image_size / 1024 / 1024,
'up_filename' => (string)Tools::getValue('virtual_product_filename_attribute'), 'up_filename' => (string)Tools::getValue('virtual_product_filename_attribute'),
'currency' => $this->context->currency, 'currency' => $this->context->currency,
'current_shop_id' => $current_shop_id 'current_shop_id' => $current_shop_id,
'languages' => $this->_languages,
'default_language' => (int)Configuration::get('PS_LANG_DEFAULT')
)); ));
$type = ImageType::getByNameNType('%', 'products', 'height');
if (isset($type['name']))
$data->assign('imageType', $type['name']);
else
$data->assign('imageType', 'small_default');
} }
else else
$this->displayWarning($this->l('You must save the product in this shop before adding images.')); $this->displayWarning($this->l('You must save the product in this shop before adding images.'));
@@ -3666,7 +3680,11 @@ class AdminProductsControllerCore extends AdminController
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities($this->getFieldValue($product, 'available_date'), $this->context->language->id)) : '0000-00-00'); $data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities($this->getFieldValue($product, 'available_date'), $this->context->language->id)) : '0000-00-00');
$i = 0; $i = 0;
$data->assign('imageType', ImageType::getByNameNType('small_default', 'products')); $type = ImageType::getByNameNType('%', 'products', 'height');
if (isset($type['name']))
$data->assign('imageType', $type['name']);
else
$data->assign('imageType', 'small_default');
$data->assign('imageWidth', (isset($image_type['width']) ? (int)($image_type['width']) : 64) + 25); $data->assign('imageWidth', (isset($image_type['width']) ? (int)($image_type['width']) : 64) + 25);
foreach ($images as $k => $image) foreach ($images as $k => $image)
{ {
@@ -1387,7 +1387,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
true, true,
$supply_order->id); $supply_order->id);
if (!$res) if ($res)
StockAvailable::synchronize($supply_order_detail->id_product);
else
$this->errors[] = Tools::displayError($this->l('Something went wrong when adding products to the warehouse.')); $this->errors[] = Tools::displayError($this->l('Something went wrong when adding products to the warehouse.'));
$location = Warehouse::getProductLocation($supply_order_detail->id_product, $location = Warehouse::getProductLocation($supply_order_detail->id_product,
@@ -1221,6 +1221,8 @@ class AdminTranslationsControllerCore extends AdminController
// Set the path of selected theme // Set the path of selected theme
if ($this->theme_selected) if ($this->theme_selected)
define('_PS_THEME_SELECTED_DIR_', _PS_ROOT_DIR_.'/themes/'.$this->theme_selected.'/'); define('_PS_THEME_SELECTED_DIR_', _PS_ROOT_DIR_.'/themes/'.$this->theme_selected.'/');
else
define('_PS_THEME_SELECTED_DIR_', '');
// Get type of translation // Get type of translation
if (($type = Tools::getValue('type')) && !is_array($type)) if (($type = Tools::getValue('type')) && !is_array($type))
+10 -8
View File
@@ -225,19 +225,19 @@ class AddressControllerCore extends FrontController
else // Update cart address else // Update cart address
$this->context->cart->autosetProductAddress(); $this->context->cart->autosetProductAddress();
if ((bool)(Tools::getValue('select_address', false)) == true OR Tools::getValue('type') == 'invoice' && Configuration::get('PS_ORDER_PROCESS_TYPE')) if ((bool)(Tools::getValue('select_address', false)) == true OR (Tools::getValue('type') == 'invoice' && Configuration::get('PS_ORDER_PROCESS_TYPE')))
{ $this->context->cart->id_address_invoice = (int)$address->id;
$this->context->cart->id_address_invoice = (int)$address->id; elseif (Configuration::get('PS_ORDER_PROCESS_TYPE'))
$this->context->cart->update(); $this->context->cart->id_address_invoice = (int)$this->context->cart->id_address_delivery;
} $this->context->cart->update();
if ($this->ajax) if ($this->ajax)
{ {
$return = array( $return = array(
'hasError' => (bool)$this->errors, 'hasError' => (bool)$this->errors,
'errors' => $this->errors, 'errors' => $this->errors,
'id_address_delivery' => $this->context->cart->id_address_delivery, 'id_address_delivery' => (int)$this->context->cart->id_address_delivery,
'id_address_invoice' => $this->context->cart->id_address_invoice 'id_address_invoice' => (int)$this->context->cart->id_address_invoice
); );
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
} }
@@ -245,6 +245,8 @@ class AddressControllerCore extends FrontController
// Redirect to old page or current page // Redirect to old page or current page
if ($back = Tools::getValue('back')) if ($back = Tools::getValue('back'))
{ {
if ($back == Tools::secureReferrer(Tools::getValue('back')))
Tools::redirect(html_entity_decode($back));
$mod = Tools::getValue('mod'); $mod = Tools::getValue('mod');
Tools::redirect('index.php?controller='.$back.($mod ? '&back='.$mod : '')); Tools::redirect('index.php?controller='.$back.($mod ? '&back='.$mod : ''));
} }
+132 -110
View File
@@ -92,7 +92,7 @@ class AuthControllerCore extends FrontController
if (!empty($key)) if (!empty($key))
$back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key; $back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key;
if (!empty($back)) if (!empty($back))
$this->context->smarty->assign('back', Tools::safeOutput($back)); $this->context->smarty->assign('back', Tools::safeOutput(Tools::secureReferrer($back)));
if (Tools::getValue('display_guest_checkout')) if (Tools::getValue('display_guest_checkout'))
{ {
@@ -327,7 +327,7 @@ class AuthControllerCore extends FrontController
if (!$this->ajax) if (!$this->ajax)
{ {
if ($back = Tools::getValue('back')) if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back))
Tools::redirect(html_entity_decode($back)); Tools::redirect(html_entity_decode($back));
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
} }
@@ -392,7 +392,10 @@ class AuthControllerCore extends FrontController
$firstnameAddress = Tools::getValue('firstname'); $firstnameAddress = Tools::getValue('firstname');
$_POST['lastname'] = Tools::getValue('customer_lastname'); $_POST['lastname'] = Tools::getValue('customer_lastname');
$_POST['firstname'] = Tools::getValue('customer_firstname'); $_POST['firstname'] = Tools::getValue('customer_firstname');
$addresses_types = array('address');
if (!Configuration::get('PS_ORDER_PROCESS_TYPE') && Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('invoice_address'))
$addresses_types[] = 'address_invoice';
$error_phone = false; $error_phone = false;
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) if (Configuration::get('PS_ONE_PHONE_AT_LEAST'))
{ {
@@ -402,10 +405,8 @@ class AuthControllerCore extends FrontController
$error_phone = true; $error_phone = true;
} }
elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE')) elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE'))
|| (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))) || (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) || (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create')))
$error_phone = true;
elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE') && Tools::getValue('email_create')))
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) && (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')))
$error_phone = true; $error_phone = true;
} }
@@ -463,7 +464,7 @@ class AuthControllerCore extends FrontController
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
} }
if ($back = Tools::getValue('back')) if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back))
Tools::redirect(html_entity_decode($back)); Tools::redirect(html_entity_decode($back));
// redirection: if cart is not empty : redirection to the cart // redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0) if (count($this->context->cart->getProducts(true)) > 0)
@@ -480,37 +481,57 @@ class AuthControllerCore extends FrontController
} }
else // if registration type is in one step, we save the address else // if registration type is in one step, we save the address
{ {
// Preparing address
$address = new Address();
$_POST['lastname'] = $lastnameAddress; $_POST['lastname'] = $lastnameAddress;
$_POST['firstname'] = $firstnameAddress; $_POST['firstname'] = $firstnameAddress;
$address->id_customer = 1; $post_back = $_POST;
$this->errors = array_unique(array_merge($this->errors, $address->validateController())); // Preparing addresses
foreach($addresses_types as $addresses_type)
// US customer: normalize the address
if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
{ {
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php'); $$addresses_type = new Address();
$normalize = new AddressStandardizationSolution; $$addresses_type->id_customer = 1;
$address->address1 = $normalize->AddressLineStandardization($address->address1);
$address->address2 = $normalize->AddressLineStandardization($address->address2); if ($addresses_type == 'address_invoice')
foreach($_POST as $key => &$post)
if (isset($_POST[$key.'_invoice']))
$post = $_POST[$key.'_invoice'];
$this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController()));
if ($addresses_type == 'address_invoice')
$_POST = $post_back;
// US customer: normalize the address
if ($$addresses_type->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
{
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
$$addresses_type->address1 = $normalize->AddressLineStandardization($$addresses_type->address1);
$$addresses_type->address2 = $normalize->AddressLineStandardization($$addresses_type->address2);
}
if (!($country = new Country($$addresses_type->id_country)) || !Validate::isLoadedObject($country))
$this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country');
$postcode = Tools::getValue('postcode');
/* Check zip code format */
if ($country->zip_code_format && !$country->checkZipCode($postcode))
$this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format))));
elseif(empty($postcode) && $country->need_zip_code)
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
elseif ($postcode && !Validate::isPostCode($postcode))
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
elseif (!$country->need_identification_number)
$$addresses_type->dni = null;
if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount'))
if (!($country = new Country($$addresses_type->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country))
$this->errors[] = Tools::displayError('The Country is invalid');
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0;
$id_state = isset($$addresses_type) && is_object($$addresses_type) ? (int)$$addresses_type->id_state: 0;
if ((Tools::isSubmit('submitAccount')|| Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state)
$this->errors[] = Tools::displayError('This country requires you to choose a State.');
} }
if (!($country = new Country($address->id_country)) || !Validate::isLoadedObject($country))
$this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country');
$postcode = Tools::getValue('postcode');
/* Check zip code format */
if ($country->zip_code_format && !$country->checkZipCode($postcode))
$this->errors[] = sprintf(Tools::displayError('The Zip/Postal code you\'ve entered is invalid. It must follow this format: %s'), str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format))));
elseif(empty($postcode) && $country->need_zip_code)
$this->errors[] = Tools::displayError('A Zip / Postal code is required.');
elseif ($postcode && !Validate::isPostCode($postcode))
$this->errors[] = Tools::displayError('The Zip / Postal code is invalid.');
if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
$this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
elseif (!$country->need_identification_number)
$address->dni = null;
} }
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
@@ -529,88 +550,89 @@ class AuthControllerCore extends FrontController
if (!count($this->errors)) if (!count($this->errors))
{ {
// if registration type is in one step, we save the address $customer->active = 1;
if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) // New Guest customer
if (!($country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country)) if (Tools::isSubmit('is_new_customer'))
die(Tools::displayError()); $customer->is_guest = !Tools::getValue('is_new_customer', 1);
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0; else
$id_state = isset($address) && is_object($address) ? (int)$address->id_state: 0; $customer->is_guest = 0;
if ((Tools::isSubmit('submitAccount')|| Tools::isSubmit('submitGuestAccount')) && $contains_state && !$id_state) if (!$customer->add())
$this->errors[] = Tools::displayError('This country requires you to choose a State.'); $this->errors[] = Tools::displayError('An error occurred while creating your account.');
else else
{ {
$customer->active = 1; foreach($addresses_types as $addresses_type)
// New Guest customer
if (Tools::isSubmit('is_new_customer'))
$customer->is_guest = !Tools::getValue('is_new_customer', 1);
else
$customer->is_guest = 0;
if (!$customer->add())
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
else
{ {
$address->id_customer = (int)$customer->id; $$addresses_type->id_customer = (int)$customer->id;
$this->errors = array_unique(array_merge($this->errors, $address->validateController())); if ($addresses_type == 'address_invoice')
if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$address->add()) foreach($_POST as $key => &$post)
if (isset($_POST[$key.'_invoice']))
$post = $_POST[$key.'_invoice'];
$this->errors = array_unique(array_merge($this->errors, $$addresses_type->validateController()));
if ($addresses_type == 'address_invoice')
$_POST = $post_back;
if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$$addresses_type->add())
$this->errors[] = Tools::displayError('An error occurred while creating your address.'); $this->errors[] = Tools::displayError('An error occurred while creating your address.');
}
if (!count($this->errors))
{
if (!$customer->is_guest)
{
$this->context->customer = $customer;
$customer->cleanGroups();
// we add the guest customer in the default customer group
$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
if (!$this->sendConfirmationMail($customer))
$this->errors[] = Tools::displayError('The email cannot be sent.');
}
else else
{ {
if (!$customer->is_guest) $customer->cleanGroups();
{ // we add the guest customer in the guest customer group
$this->context->customer = $customer; $customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP')));
$customer->cleanGroups();
// we add the guest customer in the default customer group
$customer->addGroups(array((int)Configuration::get('PS_CUSTOMER_GROUP')));
if (!$this->sendConfirmationMail($customer))
$this->errors[] = Tools::displayError('The email cannot be sent.');
}
else
{
$customer->cleanGroups();
// we add the guest customer in the guest customer group
$customer->addGroups(array((int)Configuration::get('PS_GUEST_GROUP')));
}
$this->updateContext($customer);
$this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)$customer->id);
$this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)$customer->id);
// If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
$this->context->cart->update();
// Avoid articles without delivery address on the cart
$this->context->cart->autosetProductAddress();
Hook::exec('actionCustomerAccountAdd', array(
'_POST' => $_POST,
'newCustomer' => $customer
));
if ($this->ajax)
{
$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'isSaved' => true,
'id_customer' => (int)$this->context->cookie->id_customer,
'id_address_delivery' => $this->context->cart->id_address_delivery,
'id_address_invoice' => $this->context->cart->id_address_invoice,
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
// if registration type is in two steps, we redirect to register address
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
Tools::redirect('index.php?controller=address');
if ($back = Tools::getValue('back'))
Tools::redirect(html_entity_decode($back));
// redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
} }
$this->updateContext($customer);
$this->context->cart->id_address_delivery = (int)Address::getFirstCustomerAddressId((int)$customer->id);
$this->context->cart->id_address_invoice = (int)Address::getFirstCustomerAddressId((int)$customer->id);
if (isset($address_invoice) && Validate::isLoadedObject($address_invoice))
$this->context->cart->id_address_invoice = (int)$address_invoice->id;
// If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
$this->context->cart->update();
// Avoid articles without delivery address on the cart
$this->context->cart->autosetProductAddress();
Hook::exec('actionCustomerAccountAdd', array(
'_POST' => $_POST,
'newCustomer' => $customer
));
if ($this->ajax)
{
$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'isSaved' => true,
'id_customer' => (int)$this->context->cookie->id_customer,
'id_address_delivery' => $this->context->cart->id_address_delivery,
'id_address_invoice' => $this->context->cart->id_address_invoice,
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
// if registration type is in two steps, we redirect to register address
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
Tools::redirect('index.php?controller=address');
if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back))
Tools::redirect(html_entity_decode($back));
// redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
} }
} }
} }
+2 -2
View File
@@ -58,8 +58,8 @@ class OrderControllerCore extends ParentOrderController
{ {
$this->step = 0; $this->step = 0;
$this->errors[] = sprintf( $this->errors[] = sprintf(
Tools::displayError('A minimum purchase total of %s is required in order to validate your order.'), Tools::displayError('A minimum purchase total of %1s (tax excl.) is required in order to validate your order, current purchase total is %2s (tax excl.).'),
Tools::displayPrice($minimal_purchase, $currency) Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency)
); );
} }
if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3))) if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3)))
+15
View File
@@ -445,6 +445,21 @@ class OrderOpcControllerCore extends ParentOrderController
'phone_mobile_invoice' => Tools::htmlentitiesUTF8($address_invoice->phone_mobile), 'phone_mobile_invoice' => Tools::htmlentitiesUTF8($address_invoice->phone_mobile),
'id_country_invoice' => (int)($address_invoice->id_country), 'id_country_invoice' => (int)($address_invoice->id_country),
'id_state_invoice' => (int)($address_invoice->id_state), 'id_state_invoice' => (int)($address_invoice->id_state),
'id_address_invoice' => $id_address_invoice,
'invoice_company' => Tools::htmlentitiesUTF8($address_invoice->company),
'invoice_lastname' => Tools::htmlentitiesUTF8($address_invoice->lastname),
'invoice_firstname' => Tools::htmlentitiesUTF8($address_invoice->firstname),
'invoice_vat_number' => Tools::htmlentitiesUTF8($address_invoice->vat_number),
'invoice_dni' => Tools::htmlentitiesUTF8($address_invoice->dni),
'invoice_address' => $this->context->cart->id_address_invoice !== $this->context->cart->id_address_delivery,
'invoice_address1' => Tools::htmlentitiesUTF8($address_invoice->address1),
'invoice_address2' => Tools::htmlentitiesUTF8($address_invoice->address2),
'invoice_postcode' => Tools::htmlentitiesUTF8($address_invoice->postcode),
'invoice_city' => Tools::htmlentitiesUTF8($address_invoice->city),
'invoice_phone' => Tools::htmlentitiesUTF8($address_invoice->phone),
'invoice_phone_mobile' => Tools::htmlentitiesUTF8($address_invoice->phone_mobile),
'invoice_id_country' => (int)($address_invoice->id_country),
'invoice_id_state' => (int)($address_invoice->id_state),
); );
} }
+12 -3
View File
@@ -149,7 +149,7 @@ class ParentOrderControllerCore extends FrontController
if ((Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 && Tools::getValue('step') == 1) || Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) if ((Configuration::get('PS_ORDER_PROCESS_TYPE') == 0 && Tools::getValue('step') == 1) || Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
$this->addJS(_THEME_JS_DIR_.'order-address.js'); $this->addJS(_THEME_JS_DIR_.'order-address.js');
$this->addJqueryPlugin('fancybox'); $this->addJqueryPlugin('fancybox');
if ((int)(Configuration::get('PS_BLOCK_CART_AJAX')) || Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) if ((int)(Configuration::get('PS_BLOCK_CART_AJAX')) || Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 || Tools::getValue('step') == 2)
{ {
$this->addJqueryPlugin('typewatch'); $this->addJqueryPlugin('typewatch');
$this->addJS(_THEME_JS_DIR_.'cart-summary.js'); $this->addJS(_THEME_JS_DIR_.'cart-summary.js');
@@ -464,8 +464,17 @@ class ParentOrderControllerCore extends FrontController
{ {
$address = new Address($this->context->cart->id_address_delivery); $address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id); $id_zone = Address::getZoneById($address->id);
if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)($this->context->cart->id_address_invoice))) $bad_delivery = false;
Tools::redirect('index.php?controller=order&step=1'); if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)))
{
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 && Dispatcher::getInstance()->getController() != 'order-opc')
{
$back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping')));
$params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url);
Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params));
}
Tools::redirect('index.php?controller=order&step=1');
}
$carriers = $this->context->cart->simulateCarriersOutput(); $carriers = $this->context->cart->simulateCarriersOutput();
$checked = $this->context->cart->simulateCarrierSelectedOutput(); $checked = $this->context->cart->simulateCarrierSelectedOutput();
$delivery_option_list = $this->context->cart->getDeliveryOptionList(); $delivery_option_list = $this->context->cart->getDeliveryOptionList();
+2 -17
View File
@@ -63,23 +63,8 @@ class PdfInvoiceControllerCore extends FrontController
$order_invoice_list = $this->order->getInvoicesCollection(); $order_invoice_list = $this->order->getInvoicesCollection();
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list)); Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
$pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id); $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty);
$pdf->render(); $pdf->render();
} }
}
/**
* Returns the invoice template associated to the country iso_code
* @param string $iso_user
*/
public function getTemplate($iso_country)
{
$template = _PS_THEME_PDF_DIR_.'/invoice.tpl';
$iso_template = _PS_THEME_PDF_DIR_.'/invoice.'.$iso_country.'.tpl';
if (file_exists($iso_template))
$template = $iso_template;
return $template;
}
}
+3
View File
@@ -0,0 +1,3 @@
id;Alias *;Search *;Active (0/1)
3;microsft,micro;microsoft;1
4;adbe,adaub;adobe;1
1 id Alias * Search * Active (0/1)
2 3 microsft,micro microsoft 1
3 4 adbe,adaub adobe 1
+3 -3
View File
@@ -1,3 +1,3 @@
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL
1;1;Apple Computer, Inc;;;;; 1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg
2;1;Shure Incorporated;;;;; 2;1;Shure Incorporated;;;;;http://youdomain.com/img.jpg
1 id id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL Active (0/1) Name* Description Short description Meta-title Meta-keywords Meta-description
2 1 1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg 1 Apple Computer, Inc
3 2 2;1;Shure Incorporated;;;;;http://youdomain.com/img.jpg 1 Shure Incorporated
+2 -2
View File
@@ -1,3 +1,3 @@
ID;Active (0/1);Name*;Categories (x,y,z,…);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Width;Height;Depth;Weight;Quantity;Minimum quantity;Visibility;Additional shipping cost;Unity;Unity price ratio;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Available for order (0 = No, 1 = Yes);Product available date;Product creation date;Show price (0 = No, 1 = Yes);Image URLs (x,y,z,...);Delete existing images (0 = No, 1 = Yes);Feature (Name:Value:Position);Available online only (0 = No, 1 = Yes);Condition (new,used,refurbished);Customizable;File fields;Text fields;Out of stock;Advanced stock management;ID / Name of shop ID;Active (0/1);Name*;Categories (x,y,z,…);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Width;Height;Depth;Weight;Quantity;Minimum quantity;Visibility;Additional shipping cost;Unity;Unity price ratio;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Available for order (0 = No, 1 = Yes);Product available date;Product creation date;Show price (0 = No, 1 = Yes);Image URLs (x,y,z,...);Delete existing images (0 = No, 1 = Yes);Feature (Name:Value:Position);Available online only (0 = No, 1 = Yes);Condition (new,used,refurbished);Customizable;File fields;Text fields;Out of stock;Advanced stock management;ID / Name of shop
1;1;iPod Nano;Home, iPods;49;1;40;0;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;5605055055056;560505505555;0;0,1;0,2;0,3;0.5;800;1;both;0.00;;0.00;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;Meta title;Meta keywords;Meta description;ipod-nano;In stock;Out stock;1;;;1;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;0;Music:Rock:1;0;new;0;0;0;2;0;1 1;1;iPod Nano;Home, iPods;49;1;40;0;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;5605055055056;560505505555;0;1;2;3;0.5;800;1;both;0.00;;0.00;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;Meta title;Meta keywords;Meta description;ipod-nano;In stock;Out stock;1;;;1;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;0;Music:Rock:1;0;new;0;0;0;2;0;1
2;1;iPod shuffle;Home, iPods;66.05;1;50;0;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;5605055055057;560505505556;0;0,1;0,2;0,3;0.5;800;1;both;0.00;;0.00;iPod shuffle, the world’s most wearabl….;You want listen to music;ipod, shuffle;Meta title;Meta keywords;Meta description;ipod-shuffle;In stock;Out stock;1;;;1;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;0;Music:Blues:2;0;new;0;0;0;2;0;1 2;1;iPod shuffle;Home, iPods;66.05;1;50;0;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;5605055055057;560505505556;0;1;2;3;0.5;800;1;both;0.00;;0.00;iPod shuffle, the world’s most wearabl….;You want listen to music;ipod, shuffle;Meta title;Meta keywords;Meta description;ipod-shuffle;In stock;Out stock;1;;;1;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;0;Music:Blues:2;0;new;0;0;0;2;0;1
1 ID Active (0/1) Name* Categories (x,y,z,…) Price tax excl. Or Price tax excl Tax rules id Wholesale price On sale (0/1) Discount amount Discount percent Discount from (yyy-mm-dd) Discount to (yyy-mm-dd) Reference # Supplier reference # Supplier Manufacturer EAN13 UPC Ecotax Width Height Depth Weight Quantity Minimum quantity Visibility Additional shipping cost Unity Unity price ratio Short description Description Tags (x,y,z,...) Meta-title Meta-keywords Meta-description URL rewritten Text when in-stock Text if back-order allowed Available for order (0 = No, 1 = Yes) Product available date Product creation date Show price (0 = No, 1 = Yes) Image URLs (x,y,z,...) Delete existing images (0 = No, 1 = Yes) Feature (Name:Value:Position) Available online only (0 = No, 1 = Yes) Condition (new,used,refurbished) Customizable File fields Text fields Out of stock Advanced stock management ID / Name of shop
2 1 1 iPod Nano Home, iPods 49 1 40 0 92458844 54778855 AppleStore Apple Computer, Inc 5605055055056 560505505555 0 0,1 1 0,2 2 0,3 3 0.5 800 1 both 0.00 0.00 New design. New features. Now i…. Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de... apple, ipod, nano Meta title Meta keywords Meta description ipod-nano In stock Out stock 1 1 http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg 0 Music:Rock:1 0 new 0 0 0 2 0 1
3 2 1 iPod shuffle Home, iPods 66.05 1 50 0 92458845 54778855 AppleStore Apple Computer, Inc 5605055055057 560505505556 0 0,1 1 0,2 2 0,3 3 0.5 800 1 both 0.00 0.00 iPod shuffle, the world’s most wearabl…. You want listen to music ipod, shuffle Meta title Meta keywords Meta description ipod-shuffle In stock Out stock 1 1 http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg 0 Music:Blues:2 0 new 0 0 0 2 0 1
+3 -3
View File
@@ -1,3 +1,3 @@
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL
1;1;Applestore;;;;; 1;1;Applestore;;;;;http://youdomain.com/img.jpg
2;1;Shure Online Store;;;;; 2;1;Shure Online Store;;;;;http://youdomain.com/img.jpg
1 id id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL Active (0/1) Name* Description Short description Meta-title Meta-keywords Meta-description
2 1 1;1;Applestore;;;;;http://youdomain.com/img.jpg 1 Applestore
3 2 2;1;Shure Online Store;;;;;http://youdomain.com/img.jpg 1 Shure Online Store
+4 -1
View File
@@ -95,6 +95,10 @@ abstract class InstallControllerHttp
final public static function execute() final public static function execute()
{ {
$session = InstallSession::getInstance();
if (!$session->last_step || $session->last_step == 'welcome')
Autoload::getInstance()->generateIndex();
if (Tools::getValue('compile_templates')) if (Tools::getValue('compile_templates'))
{ {
require_once (_PS_INSTALL_CONTROLLERS_PATH_.'http/smarty_compile.php'); require_once (_PS_INSTALL_CONTROLLERS_PATH_.'http/smarty_compile.php');
@@ -111,7 +115,6 @@ abstract class InstallControllerHttp
self::$instances[$step] = new $classname($step); self::$instances[$step] = new $classname($step);
} }
$session = InstallSession::getInstance();
if (!$session->last_step || !in_array($session->last_step, self::$steps)) if (!$session->last_step || !in_array($session->last_step, self::$steps))
$session->last_step = self::$steps[0]; $session->last_step = self::$steps[0];
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -66,7 +66,7 @@ echo '
<body> <body>
<form action="translate.php" method="post"> <form action="translate.php" method="post">
<select name="iso" onchange="document.location = \'translate.php?iso=\'+this.value;"> <select name="iso" onchange="document.location = \'translate.php?iso=\'+this.value;">
<option>-- Choose your language --</option>'; <option>- Choose your language -</option>';
foreach ($languages as $language) foreach ($languages as $language)
if (file_exists('../langs/'.$language.'/install.php')) if (file_exists('../langs/'.$language.'/install.php'))
echo '<option value="'.htmlspecialchars($language, ENT_COMPAT, 'utf-8').'" '.($iso == $language ? 'selected="selected"' : '').'>'.htmlspecialchars($language, ENT_NOQUOTES, 'utf-8').'</option>'."\n"; echo '<option value="'.htmlspecialchars($language, ENT_COMPAT, 'utf-8').'" '.($iso == $language ? 'selected="selected"' : '').'>'.htmlspecialchars($language, ENT_NOQUOTES, 'utf-8').'</option>'."\n";
+1 -1
View File
@@ -142,7 +142,7 @@ var default_iso = '<?php echo $this->session->shop_country ?>';
<?php if ($this->displayError('admin_password')): ?> <?php if ($this->displayError('admin_password')): ?>
<?php echo $this->displayError('admin_password') ?> <?php echo $this->displayError('admin_password') ?>
<?php else: ?> <?php else: ?>
<p class="userInfos aligned"><?php echo $this->l('Must be letters and numbers with at least 8 characters') ?></p> <p class="userInfos aligned"><?php echo $this->l('Must be at least 8 characters') ?></p>
<?php endif; ?> <?php endif; ?>
</div> </div>
@@ -39,9 +39,27 @@ function update_customer_default_group()
$str_old = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', '.(int)_PS_DEFAULT_CUSTOMER_GROUP_.');'; $str_old = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', '.(int)_PS_DEFAULT_CUSTOMER_GROUP_.');';
$str_new = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', '.(int)$ps_customer_group.');'; $str_new = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', '.(int)$ps_customer_group.');';
$content = str_replace($str_old, $str_new, $content); $content = str_replace($str_old, $str_new, $content);
$carriers = Db::getInstance()->executeS('
SELECT `id_carrier`
FROM `'._DB_PREFIX_.'carrier`
WHERE `deleted` = 0');
$groups = Db::getInstance()->executeS('
SELECT `value` as id_group
FROM `'._DB_PREFIX_.'configuration`
WHERE `name` IN (\'PS_UNIDENTIFIED_GROUP\', \'PS_GUEST_GROUP\')');
$result = false; $result = false;
if (count($carriers) && is_array($carriers) && count($groups) && is_array($groups))
foreach ($carriers as $carrier)
foreach ($groups as $group)
Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'carrier_group`
VALUES ('.(int)$carrier['id_carrier'].', '.(int)$group['id_group'].')');
if(file_exists($filename) && is_writable($filename)) if(file_exists($filename) && is_writable($filename))
$result = (bool)@file_put_contents($filename, $content); $result &= (bool)@file_put_contents($filename, $content);
if($result === true && file_exists($filename) && file_exists($filename_old)) if($result === true && file_exists($filename) && file_exists($filename_old))
{ {
@unlink($filename_old); @unlink($filename_old);
+6
View File
@@ -1103,6 +1103,12 @@ product_tabs['Pack'] = new function(){
} }
} }
product_tabs['Images'] = new function(){
this.onReady = function(){
displayFlags(languages, id_language, allowEmployeeFormLang);
}
}
product_tabs['Features'] = new function(){ product_tabs['Features'] = new function(){
this.onReady = function(){ this.onReady = function(){
displayFlags(languages, id_language, allowEmployeeFormLang); displayFlags(languages, id_language, allowEmployeeFormLang);
+64 -34
View File
@@ -36,51 +36,81 @@ function str2url(str, encoding, ucfirst)
else else
{ {
/* Lowercase */ /* Lowercase */
str = str.replace(/[\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u0101\u0103\u0105]/g, 'a'); str = str.replace(/[\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u0101\u0103\u0105\u0430]/g, 'a');
str = str.replace(/[\u00E7\u0107\u0109\u010D]/g, 'c'); str = str.replace(/[\u0431]/g, 'b');
str = str.replace(/[\u010F\u0111]/g, 'd'); str = str.replace(/[\u00E7\u0107\u0109\u010D\u0446]/g, 'c');
str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u0113\u0115\u0117\u0119\u011B]/g, 'e'); str = str.replace(/[\u010F\u0111\u0434]/g, 'd');
str = str.replace(/[\u011F\u0121\u0123]/g, 'g'); str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u0113\u0115\u0117\u0119\u011B\u0435\u044D]/g, 'e');
str = str.replace(/[\u0444]/g, 'f');
str = str.replace(/[\u011F\u0121\u0123\u0433\u0491]/g, 'g');
str = str.replace(/[\u0125\u0127]/g, 'h'); str = str.replace(/[\u0125\u0127]/g, 'h');
str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u0129\u012B\u012D\u012F\u0131]/g, 'i'); str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u0129\u012B\u012D\u012F\u0131\u0438\u0456]/g, 'i');
str = str.replace(/[\u0135]/g, 'j'); str = str.replace(/[\u0135\u0439]/g, 'j');
str = str.replace(/[\u0137\u0138]/g, 'k'); str = str.replace(/[\u0137\u0138\u043A]/g, 'k');
str = str.replace(/[\u013A\u013C\u013E\u0140\u0142]/g, 'l'); str = str.replace(/[\u013A\u013C\u013E\u0140\u0142\u043B]/g, 'l');
str = str.replace(/[\u00F1\u0144\u0146\u0148\u0149\u014B]/g, 'n'); str = str.replace(/[\u043C]/g, 'm');
str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u014D\u014F\u0151]/g, 'o'); str = str.replace(/[\u00F1\u0144\u0146\u0148\u0149\u014B\u043D]/g, 'n');
str = str.replace(/[\u0155\u0157\u0159]/g, 'r'); str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u014D\u014F\u0151\u043E]/g, 'o');
str = str.replace(/[\u015B\u015D\u015F\u0161]/g, 's'); str = str.replace(/[\u043F]/g, 'p');
str = str.replace(/[\u0155\u0157\u0159\u0440]/g, 'r');
str = str.replace(/[\u015B\u015D\u015F\u0161\u0441]/g, 's');
str = str.replace(/[\u00DF]/g, 'ss'); str = str.replace(/[\u00DF]/g, 'ss');
str = str.replace(/[\u0163\u0165\u0167]/g, 't'); str = str.replace(/[\u0163\u0165\u0167\u0442]/g, 't');
str = str.replace(/[\u00F9\u00FA\u00FB\u00FC\u0169\u016B\u016D\u016F\u0171\u0173]/g, 'u'); str = str.replace(/[\u00F9\u00FA\u00FB\u00FC\u0169\u016B\u016D\u016F\u0171\u0173\u0443]/g, 'u');
str = str.replace(/[\u0432]/g, 'v');
str = str.replace(/[\u0175]/g, 'w'); str = str.replace(/[\u0175]/g, 'w');
str = str.replace(/[\u00FF\u0177\u00FD]/g, 'y'); str = str.replace(/[\u00FF\u0177\u00FD\u044B]/g, 'y');
str = str.replace(/[\u017A\u017C\u017E]/g, 'z'); str = str.replace(/[\u017A\u017C\u017E\u0437]/g, 'z');
str = str.replace(/[\u00E6]/g, 'ae'); str = str.replace(/[\u00E6]/g, 'ae');
str = str.replace(/[\u0447]/g, 'ch');
str = str.replace(/[\u0445]/g, 'kh');
str = str.replace(/[\u0153]/g, 'oe'); str = str.replace(/[\u0153]/g, 'oe');
str = str.replace(/[\u0448]/g, 'sh');
str = str.replace(/[\u0449]/g, 'ssh');
str = str.replace(/[\u044F]/g, 'ya');
str = str.replace(/[\u0454]/g, 'ye');
str = str.replace(/[\u0457]/g, 'yi');
str = str.replace(/[\u0451]/g, 'yo');
str = str.replace(/[\u044E]/g, 'yu');
str = str.replace(/[\u0436]/g, 'zh');
/* Uppercase */ /* Uppercase */
str = str.replace(/[\u0100\u0102\u0104\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5]/g, 'A'); str = str.replace(/[\u0100\u0102\u0104\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u0410]/g, 'A');
str = str.replace(/[\u00C7\u0106\u0108\u010A\u010C]/g, 'C'); str = str.replace(/[\u0411]/g, 'B');
str = str.replace(/[\u010E\u0110]/g, 'D'); str = str.replace(/[\u00C7\u0106\u0108\u010A\u010C\u0426]/g, 'C');
str = str.replace(/[\u00C8\u00C9\u00CA\u00CB\u0112\u0114\u0116\u0118\u011A]/g, 'E'); str = str.replace(/[\u010E\u0110\u0414]/g, 'D');
str = str.replace(/[\u011C\u011E\u0120\u0122]/g, 'G'); str = str.replace(/[\u00C8\u00C9\u00CA\u00CB\u0112\u0114\u0116\u0118\u011A\u0415\u042D]/g, 'E');
str = str.replace(/[\u0424]/g, 'F');
str = str.replace(/[\u011C\u011E\u0120\u0122\u0413\u0490]/g, 'G');
str = str.replace(/[\u0124\u0126]/g, 'H'); str = str.replace(/[\u0124\u0126]/g, 'H');
str = str.replace(/[\u0128\u012A\u012C\u012E\u0130]/g, 'I'); str = str.replace(/[\u0128\u012A\u012C\u012E\u0130\u0418\u0406]/g, 'I');
str = str.replace(/[\u0134]/g, 'J'); str = str.replace(/[\u0134\u0419]/g, 'J');
str = str.replace(/[\u0136]/g, 'K'); str = str.replace(/[\u0136\u041A]/g, 'K');
str = str.replace(/[\u0139\u013B\u013D\u0139\u0141]/g, 'L'); str = str.replace(/[\u0139\u013B\u013D\u0139\u0141\u041B]/g, 'L');
str = str.replace(/[\u00D1\u0143\u0145\u0147\u014A]/g, 'N'); str = str.replace(/[\u041C]/g, 'M');
str = str.replace(/[\u00D3\u014C\u014E\u0150]/g, 'O'); str = str.replace(/[\u00D1\u0143\u0145\u0147\u014A\u041D]/g, 'N');
str = str.replace(/[\u0154\u0156\u0158]/g, 'R'); str = str.replace(/[\u00D3\u014C\u014E\u0150\u041E]/g, 'O');
str = str.replace(/[\u015A\u015C\u015E\u0160]/g, 'S'); str = str.replace(/[\u041F]/g, 'P');
str = str.replace(/[\u0162\u0164\u0166]/g, 'T'); str = str.replace(/[\u0154\u0156\u0158\u0420]/g, 'R');
str = str.replace(/[\u00D9\u00DA\u00DB\u00DC\u0168\u016A\u016C\u016E\u0170\u0172]/g, 'U'); str = str.replace(/[\u015A\u015C\u015E\u0160\u0421]/g, 'S');
str = str.replace(/[\u0162\u0164\u0166\u0422]/g, 'T');
str = str.replace(/[\u00D9\u00DA\u00DB\u00DC\u0168\u016A\u016C\u016E\u0170\u0172\u0423]/g, 'U');
str = str.replace(/[\u0412]/g, 'V');
str = str.replace(/[\u0174]/g, 'W'); str = str.replace(/[\u0174]/g, 'W');
str = str.replace(/[\u0176]/g, 'Y'); str = str.replace(/[\u0176\u042B]/g, 'Y');
str = str.replace(/[\u0179\u017B\u017D]/g, 'Z'); str = str.replace(/[\u0179\u017B\u017D\u0417]/g, 'Z');
str = str.replace(/[\u00C6]/g, 'AE'); str = str.replace(/[\u00C6]/g, 'AE');
str = str.replace(/[\u0427]/g, 'CH');
str = str.replace(/[\u0425]/g, 'KH');
str = str.replace(/[\u0152]/g, 'OE'); str = str.replace(/[\u0152]/g, 'OE');
str = str.replace(/[\u0428]/g, 'SH');
str = str.replace(/[\u0429]/g, 'SHH');
str = str.replace(/[\u042F]/g, 'YA');
str = str.replace(/[\u0404]/g, 'YE');
str = str.replace(/[\u0407]/g, 'YI');
str = str.replace(/[\u0401]/g, 'YO');
str = str.replace(/[\u042E]/g, 'YU');
str = str.replace(/[\u0416]/g, 'ZH');
str = str.toLowerCase(); str = str.toLowerCase();
+1 -1
View File
@@ -1072,9 +1072,9 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
var queryString = qq.obj2url(params, this._options.action); var queryString = qq.obj2url(params, this._options.action);
xhr.open("POST", queryString, true); xhr.open("POST", queryString, true);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
xhr.setRequestHeader("Content-Type", "application/octet-stream");
xhr.send(file); xhr.send(file);
}, },
_onComplete: function(id, xhr){ _onComplete: function(id, xhr){
+2 -2
View File
@@ -385,7 +385,7 @@ function getAnchorListHTML(id, target) {
html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"' html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"'
+ ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"' + ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"'
+ '>' + '>'
+ '<option value="">---</option>' + '<option value="">-</option>'
+ html + html
+ '</select>'; + '</select>';
@@ -494,7 +494,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
if (typeof(onchange_func) != "undefined") if (typeof(onchange_func) != "undefined")
html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);'; html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';
html += '"><option value="">---</option>'; html += '"><option value="">-</option>';
for (var i=0; i<tinyMCELinkList.length; i++) for (var i=0; i<tinyMCELinkList.length; i++)
html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>'; html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
+1 -1
View File
@@ -413,7 +413,7 @@
var html = ""; var html = "";
html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">'; html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">';
html += '<option value="">---</option>'; html += '<option value="">-</option>';
for (var i=0; i<tinyMCEMediaList.length; i++) for (var i=0; i<tinyMCEMediaList.length; i++)
html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>'; html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
+2 -2
View File
@@ -385,7 +385,7 @@ function getAnchorListHTML(id, target) {
html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"' html = '<select id="' + id + '" name="' + id + '" class="mceAnchorList"'
+ ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"' + ' onchange="this.form.' + target + '.value=this.options[this.selectedIndex].value"'
+ '>' + '>'
+ '<option value="">---</option>' + '<option value="">-</option>'
+ html + html
+ '</select>'; + '</select>';
@@ -494,7 +494,7 @@ function getLinkListHTML(elm_id, target_form_element, onchange_func) {
if (typeof(onchange_func) != "undefined") if (typeof(onchange_func) != "undefined")
html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);'; html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';
html += '"><option value="">---</option>'; html += '"><option value="">-</option>';
for (var i=0; i<tinyMCELinkList.length; i++) for (var i=0; i<tinyMCELinkList.length; i++)
html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>'; html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
+1 -1
View File
@@ -413,7 +413,7 @@
var html = ""; var html = "";
html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">'; html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">';
html += '<option value="">---</option>'; html += '<option value="">-</option>';
for (var i=0; i<tinyMCEMediaList.length; i++) for (var i=0; i<tinyMCEMediaList.length; i++)
html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>'; html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
+10 -10
View File
@@ -175,7 +175,7 @@ var ajaxCart = {
}, },
// add a product in the cart via ajax // add a product in the cart via ajax
add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist){ add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, wishlist){
if (addedFromProductPage && !checkCustomizations()) if (addedFromProductPage && !checkCustomizations())
{ {
alert(fieldRequired); alert(fieldRequired);
@@ -204,9 +204,9 @@ var ajaxCart = {
data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''), data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''),
success: function(jsonData,textStatus,jqXHR) success: function(jsonData,textStatus,jqXHR)
{ {
// add appliance to whishlist module // add appliance to wishlist module
if (whishlist && !jsonData.errors) if (wishlist && !jsonData.errors)
WishlistAddProductCart(whishlist[0], idProduct, idCombination, whishlist[1]); WishlistAddProductCart(wishlist[0], idProduct, idCombination, wishlist[1]);
// add the picture to the cart // add the picture to the cart
var $element = $(callerElement).parent().parent().find('a.product_image img,a.product_img_link img'); var $element = $(callerElement).parent().parent().find('a.product_image img,a.product_img_link img');
@@ -333,7 +333,7 @@ var ajaxCart = {
// If the cart is now empty, show the 'no product in the cart' message and close detail // If the cart is now empty, show the 'no product in the cart' message and close detail
if($('#cart_block dl.products dt').length == 0) if($('#cart_block dl.products dt').length == 0)
{ {
$("#cart_block").stop(true, true).slideUp(200); $("#header #cart_block").stop(true, true).slideUp(200);
$('#cart_block_no_products:hidden').slideDown(450); $('#cart_block_no_products:hidden').slideDown(450);
$('#cart_block dl.products').remove(); $('#cart_block dl.products').remove();
} }
@@ -699,25 +699,25 @@ $(document).ready(function(){
cart_qty = parseInt($('.ajax_cart_quantity').html()); cart_qty = parseInt($('.ajax_cart_quantity').html());
/* roll over cart */ /* roll over cart */
var cart_block = new HoverWatcher('#cart_block'); var cart_block = new HoverWatcher('#header #cart_block');
var shopping_cart = new HoverWatcher('#shopping_cart'); var shopping_cart = new HoverWatcher('#shopping_cart');
$("#shopping_cart a:first").hover( $("#shopping_cart a:first").hover(
function() { function() {
$(this).css('border-radius', '3px 3px 0px 0px'); $(this).css('border-radius', '3px 3px 0px 0px');
if (ajaxCart.nb_total_products > 0 || cart_qty > 0) if (ajaxCart.nb_total_products > 0 || cart_qty > 0)
$("#header_right #cart_block").stop(true, true).slideDown(450); $("#header #cart_block").stop(true, true).slideDown(450);
}, },
function() { function() {
$('#shopping_cart a').css('border-radius', '3px'); $('#shopping_cart a').css('border-radius', '3px');
setTimeout(function() { setTimeout(function() {
if (!shopping_cart.isHoveringOver() && !cart_block.isHoveringOver()) if (!shopping_cart.isHoveringOver() && !cart_block.isHoveringOver())
$("#header_right #cart_block").stop(true, true).slideUp(450); $("#header #cart_block").stop(true, true).slideUp(450);
}, 200); }, 200);
} }
); );
$("#header_right #cart_block").hover( $("#header #cart_block").hover(
function() { function() {
$('#shopping_cart a').css('border-radius', '3px 3px 0px 0px'); $('#shopping_cart a').css('border-radius', '3px 3px 0px 0px');
}, },
@@ -725,7 +725,7 @@ $(document).ready(function(){
$('#shopping_cart a').css('border-radius', '3px'); $('#shopping_cart a').css('border-radius', '3px');
setTimeout(function() { setTimeout(function() {
if (!shopping_cart.isHoveringOver()) if (!shopping_cart.isHoveringOver())
$("#header_right #cart_block").stop(true, true).slideUp(450); $("#header #cart_block").stop(true, true).slideUp(450);
}, 200); }, 200);
} }
); );
+7 -3
View File
@@ -364,15 +364,20 @@ class BlockCMSModel extends ObjectModel
return Db::getInstance()->executeS($sql); return Db::getInstance()->executeS($sql);
} }
public static function getCMSBlockPages($id_block) public static function getCMSBlockPages($id_block, $id_shop = false)
{ {
$id_shop = ($id_shop !== false) ? $id_shop : Context::getContext()->shop->id;
$sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite` $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_block_page` bcp FROM `'._DB_PREFIX_.'cms_block_page` bcp
INNER JOIN `'._DB_PREFIX_.'cms_lang` cl INNER JOIN `'._DB_PREFIX_.'cms_lang` cl
ON (bcp.`id_cms` = cl.`id_cms`) ON (bcp.`id_cms` = cl.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms` c INNER JOIN `'._DB_PREFIX_.'cms` c
ON (bcp.`id_cms` = c.`id_cms`) ON (bcp.`id_cms` = c.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms_shop` cs
ON (c.`id_cms` = cs.`id_cms`)
WHERE bcp.`id_cms_block` = '.(int)$id_block.' WHERE bcp.`id_cms_block` = '.(int)$id_block.'
AND cs.`id_shop` = '.(int)$id_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcp.`is_category` = 0 AND bcp.`is_category` = 0
AND c.`active` = 1 AND c.`active` = 1
@@ -534,8 +539,7 @@ class BlockCMSModel extends ObjectModel
{ {
$key = (int)$cmsCategory['id_cms_block']; $key = (int)$cmsCategory['id_cms_block'];
$content[$key]['display_store'] = $cmsCategory['display_store']; $content[$key]['display_store'] = $cmsCategory['display_store'];
$content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block']); $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block'], $id_shop);
$links = array(); $links = array();
if (count($content[$key]['cms'])) if (count($content[$key]['cms']))
{ {
@@ -111,12 +111,13 @@ class BlockNewProducts extends Module
{ {
if (!$this->isCached('blocknewproducts.tpl', $this->getCacheId())) if (!$this->isCached('blocknewproducts.tpl', $this->getCacheId()))
{ {
if (!Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) if (!Configuration::get('NEW_PRODUCTS_NBR'))
return; return;
$newProducts = Product::getNewProducts((int) $params['cookie']->id_lang, 0, (int) Configuration::get('NEW_PRODUCTS_NBR')); $newProducts = false;
if (!$newProducts) if (Configuration::get('PS_NB_DAYS_NEW_PRODUCT'))
$newProducts = Product::getNewProducts((int) $params['cookie']->id_lang, 0, (int)Configuration::get('NEW_PRODUCTS_NBR'));
if (!$newProducts && !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))
return; return;
$this->smarty->assign(array( $this->smarty->assign(array(
'new_products' => $newProducts, 'new_products' => $newProducts,
'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
@@ -159,4 +160,4 @@ class BlockNewProducts extends Module
{ {
$this->_clearCache('blocknewproducts.tpl'); $this->_clearCache('blocknewproducts.tpl');
} }
} }
+3 -2
View File
@@ -19,7 +19,8 @@
* needs please refer to http://www.prestashop.com for more information. * needs please refer to http://www.prestashop.com for more information.
* *
* @author PrestaShop SA <contact@prestashop.com> * @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA * @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
@@ -63,7 +64,7 @@ class blocksharefb extends Module
if (isset($id_product) && $id_product != '') if (isset($id_product) && $id_product != '')
{ {
$product_infos = new Product((int)$id_product, true, $cookie->id_lang); $product_infos = $this->context->controller->getProduct();
$smarty->assign(array( $smarty->assign(array(
'product_link' => urlencode($link->getProductLink($product_infos)), 'product_link' => urlencode($link->getProductLink($product_infos)),
'product_title' => urlencode($product_infos->name), 'product_title' => urlencode($product_infos->name),
+1 -1
View File
@@ -123,7 +123,7 @@ class BlockSpecials extends Module
)); ));
} }
return $this->display(__FILE__, 'blockspecials.tpl', $this->getCacheId('blockspecials|'.$random)); return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null));
} }
public function hookLeftColumn($params) public function hookLeftColumn($params)
+67 -35
View File
@@ -291,51 +291,83 @@ class Blocktopmenu extends Module
<br/> <br/>
<a href="#" id="removeItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Remove').'</a> <a href="#" id="removeItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Remove').'</a>
</td> </td>
<td style="vertical-align:top;padding:5px 15px;">
<h4 style="margin-top:5px;">'.$this->l('Change order').':</h4>
<a href="#" id="menuOrderUp" class="button" style="font-size:20px;display:block;">&uarr;</a><br/>
<a href="#" id="menuOrderDown" class="button" style="font-size:20px;display:block;">&darr;</a><br/>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="clear">&nbsp;</div> <div class="clear">&nbsp;</div>
<script type="text/javascript"> <script type="text/javascript">
function add()
{
$("#availableItems option:selected").each(function(i){
var val = $(this).val();
var text = $(this).text();
text = text.replace(/(^\s*)|(\s*$)/gi,"");
if (val == "PRODUCT")
{
val = prompt("'.$this->l('Set ID product').'");
if (val == null || val == "" || isNaN(val))
return;
text = "'.$this->l('Product ID').' "+val;
val = "PRD"+val;
}
$("#items").append("<option value=\""+val+"\">"+text+"</option>");
});
serialize();
return false;
}
function remove()
{
$("#items option:selected").each(function(i){
$(this).remove();
});
serialize();
return false;
}
function serialize()
{
var options = "";
$("#items option").each(function(i){
options += $(this).val() + ",";
});
$("#itemsInput").val(options.substr(0, options.length - 1));
}
function move(up)
{
var tomove = $("#items option:selected");
if (tomove.length >1)
{
alert(\''.Tools::htmlentitiesUTF8($this->l('Please select just one item')).'\');
return false;
}
if (up)
tomove.prev().insertAfter(tomove);
else
tomove.next().insertBefore(tomove);
serialize();
return false;
}
$(document).ready(function(){ $(document).ready(function(){
$("#addItem").click(add); $("#addItem").click(add);
$("#availableItems").dblclick(add); $("#availableItems").dblclick(add);
$("#removeItem").click(remove); $("#removeItem").click(remove);
$("#items").dblclick(remove); $("#items").dblclick(remove);
function add() $("#menuOrderUp").click(function(e){
{ e.preventDefault();
$("#availableItems option:selected").each(function(i){ move(true);
var val = $(this).val(); });
var text = $(this).text(); $("#menuOrderDown").click(function(e){
text = text.replace(/(^\s*)|(\s*$)/gi,""); e.preventDefault();
if (val == "PRODUCT") move();
{ });
val = prompt("'.$this->l('Set ID product').'");
if (val == null || val == "" || isNaN(val))
return;
text = "'.$this->l('Product ID').' "+val;
val = "PRD"+val;
}
$("#items").append("<option value=\""+val+"\">"+text+"</option>");
});
serialize();
return false;
}
function remove()
{
$("#items option:selected").each(function(i){
$(this).remove();
});
serialize();
return false;
}
function serialize()
{
var options = "";
$("#items option").each(function(i){
options += $(this).val()+",";
});
$("#itemsInput").val(options.substr(0, options.length - 1));
}
}); });
</script> </script>
<label for="s">'.$this->l('Search Bar').'</label> <label for="s">'.$this->l('Search Bar').'</label>
+5
View File
@@ -68,6 +68,11 @@ if ($context->customer->isLogged())
$combination_imgs = $obj->getCombinationImages($context->language->id); $combination_imgs = $obj->getCombinationImages($context->language->id);
if (isset($combination_imgs[$products[$i]['id_product_attribute']][0])) if (isset($combination_imgs[$products[$i]['id_product_attribute']][0]))
$products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image']; $products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
else
{
$cover = Product::getCover($obj->id);
$products[$i]['cover'] = $obj->id.'-'.$cover['id_image'];
}
} }
else else
{ {
+5
View File
@@ -62,6 +62,11 @@ if (empty($token) === false)
$combination_imgs = $obj->getCombinationImages($context->language->id); $combination_imgs = $obj->getCombinationImages($context->language->id);
if (isset($combination_imgs[$products[$i]['id_product_attribute']][0])) if (isset($combination_imgs[$products[$i]['id_product_attribute']][0]))
$products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image']; $products[$i]['cover'] = $obj->id.'-'.$combination_imgs[$products[$i]['id_product_attribute']][0]['id_image'];
else
{
$cover = Product::getCover($obj->id);
$products[$i]['cover'] = $obj->id.'-'.$cover['id_image'];
}
} }
else else
{ {
+1
View File
@@ -117,6 +117,7 @@ class CrossSelling extends Module
{ {
$this->context->controller->addCSS(($this->_path).'crossselling.css', 'all'); $this->context->controller->addCSS(($this->_path).'crossselling.css', 'all');
$this->context->controller->addJS(($this->_path).'js/crossselling.js'); $this->context->controller->addJS(($this->_path).'js/crossselling.js');
$this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll'));
} }
/** /**
+2 -2
View File
@@ -196,8 +196,8 @@ class DateOfDelivery extends Module
$id_carrier = (int)OrderInvoice::getCarrierId($order_invoice->id); $id_carrier = (int)OrderInvoice::getCarrierId($order_invoice->id);
$return = ''; $return = '';
if ($datesDelivery = $this->_getDatesOfDelivery($id_carrier, $oos, $order_invoice->date_add)) if (($datesDelivery = $this->_getDatesOfDelivery($id_carrier, $oos, $order_invoice->date_add)) && isset($datesDelivery[0][0]) && isset($datesDelivery[1][0]))
$return = sprintf($this->l('Approximate date of delivery is between %1$s and %2$s'), $datesDelivery[0], $datesDelivery[1]); $return = sprintf($this->l('Approximate date of delivery is between %1$s and %2$s'), $datesDelivery[0][0], $datesDelivery[1][0]);
return $return; return $return;
} }
+5 -2
View File
@@ -26,6 +26,9 @@
include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php'); require_once(dirname(__FILE__).'/../../init.php');
if (!Module::getInstanceByName('feeder')->active)
exit;
// Get data // Get data
$number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10); $number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10);
$orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby')); $orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby'));
@@ -64,7 +67,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
if (is_array($image) AND sizeof($image)) if (is_array($image) AND sizeof($image))
{ {
$imageObj = new Image($image[0]['id_image']); $imageObj = new Image($image[0]['id_image']);
echo "<![CDATA[<img src='"._PS_BASE_URL_._THEME_PROD_DIR_.$imageObj->getExistingImgPath()."-small_default.jpg' title='".str_replace('&', '', $product['name'])."' alt='thumb' />"; echo "<![CDATA[<img src='".$link->getImageLink($product['link_rewrite'], $image[0]['id_image'], 'small_default')."' title='".str_replace('&', '', $product['name'])."' alt='thumb' />";
$cdata = false; $cdata = false;
} }
if ($cdata) if ($cdata)
@@ -76,4 +79,4 @@ echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
} }
?> ?>
</channel> </channel>
</rss> </rss>
+1 -1
View File
@@ -705,7 +705,7 @@ class HomeSlider extends Module
cursor: "move", cursor: "move",
update: function() { update: function() {
var order = $(this).sortable("serialize") + "&action=updateSlidesPosition"; var order = $(this).sortable("serialize") + "&action=updateSlidesPosition";
$.post("'._PS_BASE_URL_.__PS_BASE_URI__.'modules/'.$this->name.'/ajax_'.$this->name.'.php?secure_key='.$this->secure_key.'", order); $.post("'.$this->context->shop->physical_uri.$this->context->shop->virtual_uri.'modules/'.$this->name.'/ajax_'.$this->name.'.php?secure_key='.$this->secure_key.'", order);
} }
}); });
$mySlides.hover(function() { $mySlides.hover(function() {
+2 -2
View File
@@ -69,13 +69,13 @@ class importerosc extends ImportModule
$html .= '<label style=\'width:220px\'>'.$this->l('Default osCommerce language : ').'</label> $html .= '<label style=\'width:220px\'>'.$this->l('Default osCommerce language : ').'</label>
<div class="margin-form"> <div class="margin-form">
<select name=\'defaultOscLang\'><option value=\'0\'>------</option>'; <select name=\'defaultOscLang\'><option value=\'0\'>-</option>';
foreach($langagues AS $lang) foreach($langagues AS $lang)
$html .= '<option value="'.$lang['languages_id'].'">'.$lang['name'].'</option>'; $html .= '<option value="'.$lang['languages_id'].'">'.$lang['name'].'</option>';
$html .= '</select></div> $html .= '</select></div>
<label style=\'width:220px\'>'.$this->l('Default osCommerce currency : ').'</label> <label style=\'width:220px\'>'.$this->l('Default osCommerce currency : ').'</label>
<div class=\'margin-form\'> <div class=\'margin-form\'>
<select name=\'defaultOscCurrency\'><option value=\'0\'>------</option>'; <select name=\'defaultOscCurrency\'><option value=\'0\'>-</option>';
foreach($curencies AS $curency) foreach($curencies AS $curency)
$html .= '<option value=\''.$curency['currencies_id'].'\'>'.$curency['title'].'</option>'; $html .= '<option value=\''.$curency['currencies_id'].'\'>'.$curency['title'].'</option>';
$html .= '</select></div>'; $html .= '</select></div>';
+3 -1
View File
@@ -88,7 +88,9 @@ class LoyaltyModule extends ObjectModel
$currentContext = Context::getContext(); $currentContext = Context::getContext();
$context = clone $currentContext; $context = clone $currentContext;
$context->cart = $cart; $context->cart = $cart;
$context->customer = new Customer($context->cart->id_customer); // if customer is logged we do not recreate it
if(!$context->customer->isLogged(true))
$context->customer = new Customer($context->cart->id_customer);
$context->language = new Language($context->cart->id_lang); $context->language = new Language($context->cart->id_lang);
$context->shop = new Shop($context->cart->id_shop); $context->shop = new Shop($context->cart->id_shop);
$context->currency = new Currency($context->cart->id_currency, null, $context->shop->id); $context->currency = new Currency($context->cart->id_currency, null, $context->shop->id);
+1 -1
View File
@@ -2,7 +2,7 @@
<module> <module>
<name>mailalerts</name> <name>mailalerts</name>
<displayName><![CDATA[Mail alerts]]></displayName> <displayName><![CDATA[Mail alerts]]></displayName>
<version><![CDATA[2.5]]></version> <version><![CDATA[2.7]]></version>
<description><![CDATA[Sends e-mail notifications to customers and merchants.]]></description> <description><![CDATA[Sends e-mail notifications to customers and merchants.]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab> <tab><![CDATA[administration]]></tab>
+26 -6
View File
@@ -46,7 +46,7 @@ class MailAlerts extends Module
{ {
$this->name = 'mailalerts'; $this->name = 'mailalerts';
$this->tab = 'administration'; $this->tab = 'administration';
$this->version = '2.5'; $this->version = '2.7';
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
@@ -257,6 +257,21 @@ class MailAlerts extends Module
</form>'; </form>';
} }
public function getAllMessages($id)
{
$messages = Db::getInstance()->executeS('
SELECT `message`
FROM `'._DB_PREFIX_.'message`
WHERE `id_order` = '.(int)$id.'
ORDER BY `id_message` ASC
');
$result = array();
foreach ($messages as $message) {
$result[] = $message['message'];
}
return implode('<br/>', $result);
}
public function hookActionValidateOrder($params) public function hookActionValidateOrder($params)
{ {
if (!$this->_merchant_order || empty($this->_merchant_mails)) if (!$this->_merchant_order || empty($this->_merchant_mails))
@@ -272,9 +287,9 @@ class MailAlerts extends Module
$configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_COLOR'), $id_lang, null, $id_shop); $configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_COLOR'), $id_lang, null, $id_shop);
$delivery = new Address((int)$order->id_address_delivery); $delivery = new Address((int)$order->id_address_delivery);
$invoice = new Address((int)$order->id_address_invoice); $invoice = new Address((int)$order->id_address_invoice);
$order_date_text = Tools::displayDate($order->date_add, (int)$id_lang); $order_date_text = Tools::displayDate($order->date_add);
$carrier = new Carrier((int)$order->id_carrier); $carrier = new Carrier((int)$order->id_carrier);
$message = $order->getFirstMessage(); $message = $this->getAllMessages($order->id);
if (!$message || empty($message)) if (!$message || empty($message))
$message = $this->l('No message'); $message = $this->l('No message');
@@ -378,6 +393,7 @@ class MailAlerts extends Module
'{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency), '{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency),
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency),
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $currency, false),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency),
'{currency}' => $currency->sign, '{currency}' => $currency->sign,
'{message}' => $message '{message}' => $message
@@ -437,16 +453,20 @@ class MailAlerts extends Module
public function hookActionUpdateQuantity($params) public function hookActionUpdateQuantity($params)
{ {
$id_product = (int)$params['id_product']; $id_product = (int)$params['id_product'];
$product = new Product($id_product);
$product_has_attributes = $product->hasAttributes();
$id_product_attribute = (int)$params['id_product_attribute']; $id_product_attribute = (int)$params['id_product_attribute'];
$quantity = (int)$params['quantity']; $quantity = (int)$params['quantity'];
$context = Context::getContext(); $context = Context::getContext();
$id_shop = (int)$context->shop->id; $id_shop = (int)$context->shop->id;
$id_lang = (int)$context->language->id; $id_lang = (int)$context->language->id;
$product = new Product($id_product, true, $id_lang, $id_shop, $context); $product = new Product($id_product, true, $id_lang, $id_shop, $context);
$configuration = Configuration::getMultiple(array('MA_LAST_QTIES', 'PS_STOCK_MANAGEMENT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'), $id_lang, null, $id_shop); $configuration = Configuration::getMultiple(array('MA_LAST_QTIES', 'PS_STOCK_MANAGEMENT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'), null, null, $id_shop);
$ma_last_qties = (int)$configuration['MA_LAST_QTIES']; $ma_last_qties = (int)$configuration['MA_LAST_QTIES'];
if ($product->active == 1 && (int)$quantity <= $ma_last_qties && !(!$this->_merchant_oos || empty($this->_merchant_mails)) && $configuration['PS_STOCK_MANAGEMENT']) $check_oos = ($product_has_attributes && $id_product_attribute) || (!$product_has_attributes && !$id_product_attribute);
if ($check_oos && $product->active == 1 && (int)$quantity <= $ma_last_qties && !(!$this->_merchant_oos || empty($this->_merchant_mails)) && $configuration['PS_STOCK_MANAGEMENT'])
{ {
$iso = Language::getIsoById($id_lang); $iso = Language::getIsoById($id_lang);
$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);
+2 -2
View File
@@ -561,7 +561,7 @@ class ProductComments extends Module
<div class="margin-form"> <div class="margin-form">
"> ">
<select name="id_product_comment_criterion" id="id_product_comment_criterion" onchange="window.location=\''.Tools::safeOutput($this->_baseUrl).'&updateCriterion=\'+$(\'#id_product_comment_criterion option:selected\').val()"> <select name="id_product_comment_criterion" id="id_product_comment_criterion" onchange="window.location=\''.Tools::safeOutput($this->_baseUrl).'&updateCriterion=\'+$(\'#id_product_comment_criterion option:selected\').val()">
<option value="--">-- '.$this->l('Choose a criterion').' --</option>'; <option value="-">- '.$this->l('Choose a criterion').' -</option>';
foreach ($criterions as $foo) foreach ($criterions as $foo)
$this->_html .= '<option value="'.(int)($foo['id_product_comment_criterion']).'" '.($foo['id_product_comment_criterion'] == $id_criterion ? 'selected="selected"' : '').'>'.$foo['name'].'</option>'; $this->_html .= '<option value="'.(int)($foo['id_product_comment_criterion']).'" '.($foo['id_product_comment_criterion'] == $id_criterion ? 'selected="selected"' : '').'>'.$foo['name'].'</option>';
$this->_html .= '</select> $this->_html .= '</select>
@@ -705,7 +705,7 @@ class ProductComments extends Module
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'id_product_comment_form' => (int)Tools::getValue('id_product'), 'id_product_comment_form' => (int)Tools::getValue('id_product'),
'product' => new Product((int)Tools::getValue('id_product'), false, $this->context->language->id), 'product' => $this->context->controller->getProduct(),
'secure_key' => $this->secure_key, 'secure_key' => $this->secure_key,
'logged' => (int)$this->context->customer->isLogged(true), 'logged' => (int)$this->context->customer->isLogged(true),
'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'), 'allow_guests' => (int)Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS'),
@@ -186,7 +186,7 @@ class productsCategory extends Module
{ {
$this->context->controller->addCSS($this->_path.'productscategory.css', 'all'); $this->context->controller->addCSS($this->_path.'productscategory.css', 'all');
$this->context->controller->addJS($this->_path.'productscategory.js'); $this->context->controller->addJS($this->_path.'productscategory.js');
$this->context->controller->addJqueryPlugin('serialScroll'); $this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll'));
} }
public function hookAddProduct($params) public function hookAddProduct($params)
@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{if count($categoryProducts) > 0 && $categoryProducts !== false} {if isset($categoryProducts) && count($categoryProducts) > 0 && $categoryProducts !== false}
<div class="clearfix blockproductscategory"> <div class="clearfix blockproductscategory">
<h2 class="productscategory_h2">{$categoryProducts|@count} {l s='other products in the same category:' mod='productscategory'}</h2> <h2 class="productscategory_h2">{$categoryProducts|@count} {l s='other products in the same category:' mod='productscategory'}</h2>
<div id="{if count($categoryProducts) > 5}productscategory{else}productscategory_noscroll{/if}"> <div id="{if count($categoryProducts) > 5}productscategory{else}productscategory_noscroll{/if}">
+8 -4
View File
@@ -151,7 +151,7 @@ class PSCleaner extends Module
// Remove inexisting or monolanguage configuration value from configuration_lang // Remove inexisting or monolanguage configuration value from configuration_lang
$query = 'DELETE FROM `'._DB_PREFIX_.'configuration_lang` $query = 'DELETE FROM `'._DB_PREFIX_.'configuration_lang`
WHERE `id_configuration` NOT IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration`) WHERE `id_configuration` NOT IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration`)
OR `id_configuration` IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration` WHERE name IS NOT NULL AND name != "")'; OR `id_configuration` IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration` WHERE name IS NULL OR name = "")';
if ($db->Execute($query)) if ($db->Execute($query))
if ($affected_rows = $db->Affected_Rows()) if ($affected_rows = $db->Affected_Rows())
$logs[$query] = $affected_rows; $logs[$query] = $affected_rows;
@@ -300,8 +300,6 @@ class PSCleaner extends Module
array('stock', 'id_warehouse', 'warehouse', 'id_warehouse'), array('stock', 'id_warehouse', 'warehouse', 'id_warehouse'),
array('stock', 'id_product', 'product', 'id_product'), array('stock', 'id_product', 'product', 'id_product'),
array('stock_available', 'id_product', 'product', 'id_product'), array('stock_available', 'id_product', 'product', 'id_product'),
array('stock_available', 'id_shop', 'shop', 'id_shop'),
array('stock_available', 'id_shop_group', 'shop_group', 'id_shop_group'),
array('stock_mvt', 'id_stock', 'stock', 'id_stock'), array('stock_mvt', 'id_stock', 'stock', 'id_stock'),
array('tab_module_preference', 'id_employee', 'employee', 'id_employee'), array('tab_module_preference', 'id_employee', 'employee', 'id_employee'),
array('tab_module_preference', 'id_tab', 'tab', 'id_tab'), array('tab_module_preference', 'id_tab', 'tab', 'id_tab'),
@@ -367,7 +365,13 @@ class PSCleaner extends Module
if ($affected_rows = $db->Affected_Rows()) if ($affected_rows = $db->Affected_Rows())
$logs[$query] = $affected_rows; $logs[$query] = $affected_rows;
} }
// stock_available
$query = 'DELETE FROM `'._DB_PREFIX_.'stock_available` WHERE `id_shop` NOT IN (SELECT `id_shop` FROM `'._DB_PREFIX_.'shop`) AND `id_shop_group` NOT IN (SELECT `id_shop_group` FROM `'._DB_PREFIX_.'shop_group`)';
if ($db->Execute($query))
if ($affected_rows = $db->Affected_Rows())
$logs[$query] = $affected_rows;
Category::regenerateEntireNtree(); Category::regenerateEntireNtree();
// @Todo: Remove attachment files, images... // @Todo: Remove attachment files, images...
@@ -183,6 +183,8 @@ class ReferralprogramProgramModuleFrontController extends ModuleFrontController
if ((int)($stats['nb_orders']) >= $orderQuantity) if ((int)($stats['nb_orders']) >= $orderQuantity)
$canSendInvitations = true; $canSendInvitations = true;
$discountInPercent = Tools::getValue('discount_type', Configuration::get('REFERRAL_DISCOUNT_TYPE')) == 1;
// Smarty display // Smarty display
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
@@ -199,7 +201,7 @@ class ReferralprogramProgramModuleFrontController extends ModuleFrontController
'nbRevive' => $nbRevive, 'nbRevive' => $nbRevive,
'subscribeFriends' => ReferralProgramModule::getSponsorFriend((int)($this->context->customer->id), 'subscribed'), 'subscribeFriends' => ReferralProgramModule::getSponsorFriend((int)($this->context->customer->id), 'subscribed'),
'mails_exists' => (isset($mails_exists) ? $mails_exists : array()), 'mails_exists' => (isset($mails_exists) ? $mails_exists : array()),
'currencySign' => $this->context->currency->sign 'currencySign' => ($discountInPercent ? '%' : $this->context->currency->sign)
)); ));
$this->setTemplate('program.tpl'); $this->setTemplate('program.tpl');
} }
+1 -1
View File
@@ -333,7 +333,7 @@ class shopimporter extends ImportModule
<label>'.$this->l('Choose your import').' : </label> <label>'.$this->l('Choose your import').' : </label>
<div class="margin-form"> <div class="margin-form">
<select name="import_module_name" id="import_module_name"> <select name="import_module_name" id="import_module_name">
<option value="0">---</option>'; <option value="0">-</option>';
foreach($exportModules as $key => $module) foreach($exportModules as $key => $module)
(($module->name != $this->name AND $module->id) ? $html .= '<option value="'.$module->name.'">'.$module->displayName.'</option>' : '' ); (($module->name != $this->name AND $module->id) ? $html .= '<option value="'.$module->name.'">'.$module->displayName.'</option>' : '' );
+1 -1
View File
@@ -88,7 +88,7 @@ class StatsStock extends Module
<form action="'.$ru.'" method="post"> <form action="'.$ru.'" method="post">
<input type="hidden" name="submitCategory" value="1" /> <input type="hidden" name="submitCategory" value="1" />
'.$this->l('Category').' : <select name="statsstock_id_category" onchange="this.form.submit();"> '.$this->l('Category').' : <select name="statsstock_id_category" onchange="this.form.submit();">
<option value="0">-- '.$this->l('All').' --</option>'; <option value="0">- '.$this->l('All').' -</option>';
foreach (Category::getSimpleCategories($this->context->language->id) as $category) foreach (Category::getSimpleCategories($this->context->language->id) as $category)
$this->html .= '<option value="'.(int)$category['id_category'].'" '. $this->html .= '<option value="'.(int)$category['id_category'].'" '.
($this->context->cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'. ($this->context->cookie->statsstock_id_category == $category['id_category'] ? 'selected="selected"' : '').'>'.
+1 -1
View File
@@ -6,7 +6,7 @@
<description><![CDATA[Protect image by watermark.]]></description> <description><![CDATA[Protect image by watermark.]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab> <tab><![CDATA[administration]]></tab>
<confirmUninstall>Are you sure you want to delete your details ?</confirmUninstall> <confirmUninstall>Are you sure you want to delete these details?</confirmUninstall>
<is_configurable>1</is_configurable> <is_configurable>1</is_configurable>
<need_instance>1</need_instance> <need_instance>1</need_instance>
<limited_countries></limited_countries> <limited_countries></limited_countries>
+2 -2
View File
@@ -151,7 +151,7 @@
<td style="text-align: right; width: 10%"> <td style="text-align: right; width: 10%">
{if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)} {if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
-{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount} -{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
{else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)} {elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
-{$order_detail.reduction_percent}% -{$order_detail.reduction_percent}%
{else} {else}
-- --
@@ -289,4 +289,4 @@
</table> </table>
{/if} {/if}
</div> </div>
+1 -1
View File
@@ -147,7 +147,7 @@
<td style="text-align: right; width: 10%"> <td style="text-align: right; width: 10%">
{if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)} {if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
-{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount} -{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
{else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)} {elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
-{$order_detail.reduction_percent}% -{$order_detail.reduction_percent}%
{else} {else}
-- --

Some files were not shown because too many files have changed in this diff Show More