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

This commit is contained in:
Vincent Augagneur
2013-11-04 14:57:50 +01:00
178 changed files with 2839 additions and 1784 deletions
+6 -14
View File
@@ -22,26 +22,18 @@
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD)
{
$error = SYS_DISABLED;
}
elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else if(!$upload->isFileUploaded('file'))
{
elseif (!$upload->isFileUploaded('file'))
$error = ERR_FILE_NOT_UPLOADED;
}else if(!$upload->moveUploadedFile($_GET['folder']))
{
$error = ERR_FILE_MOVE_FAILED;
}
elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
{
elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS)))
$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));
}else
elseif (!$upload->moveUploadedFile($_GET['folder']))
$error = ERR_FILE_MOVE_FAILED;
else
{
include_once(CLASS_FILE);
$path = $upload->getFilePath();
@@ -24,7 +24,8 @@
if(!empty($_GET['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->addSearchKeyword('recursive', @$_GET['search_recursively']);
$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_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_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_INVALID_EXTS', '');
+3
View File
@@ -10,6 +10,9 @@
//FILESYSTEM CONFIG <br>
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
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_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_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_INVALID_EXTS', '');
@@ -53,12 +53,12 @@
{/if}
<dl class="dl-horizontal">
<dt>{l s='Sent on:'}</dt>
<dd>{$message.date_add}</dd>
<dd>{$message.date_add}&nbsp;</dd>
</dl>
{if empty($message.id_employee)}
<dl class="dl-horizontal">
<dt>{l s='Browser:'}</dt>
<dd>{$message.user_agent}</dd>
<dd>{$message.user_agent}&nbsp;</dd>
</dl>
{/if}
{if !empty($message.file_name) && $file_name}
@@ -72,33 +72,26 @@
</dd>
</dl>
{/if}
{if !empty($message.id_order) && empty($message.id_employee)}
<dl class="dl-horizontal">
{if !empty($message.id_order) && $is_valid_order_id && empty($message.id_employee)}
<dl>
<dt>{l s='Order #'}</dt>
<dd>
<a href="index.php?tab=AdminOrders&id_order={$message.id_order}&vieworder&token={getAdminToken tab='AdminOrders'}" title="{l s='View order'}">
{$message.id_order} <i class="icon-search"></i>
</a>
<dd><a href="index.php?tab=AdminOrders&id_order={$message.id_order}&vieworder&token={getAdminToken tab='AdminOrders'}" title="{l s='View order'}">{$message.id_order} <img src="../img/admin/search.gif" alt="{l s='View'}" /></a>
</dd>
</dl>
{/if}
{if !empty($message.id_product) && empty($message.id_employee)}
<dl class="dl-horizontal">
<dt>{l s='Product #'}</dt>
<dd>
<a href="index.php?tab=AdminProducts&id_product={$message.id_product}&updateproduct&token={getAdminToken tab='AdminProducts'}" title="{l s='View order'}">
{$message.id_product} <i class="icon-search"></i>
</a>
</dd>
<dd><a href="index.php?tab=AdminProducts&id_product={$message.id_product}&updateproduct&token={getAdminToken tab='AdminProducts'}" title="{l s='View order'}">{$message.id_product} <img src="../img/admin/search.gif" alt="{l s='View'}" /></a></dd>
</dl>
{/if}
<form action="{$current}&token={$token}&id_customer_thread={$message.id_customer_thread}&viewcustomer_thread" method="post" class="form-horizontal">
<dl class="dl-horizontal">
<dt> {l s='Subject:'}</dt>
<form class="form-horizontal" action="{$current}&token={$token}&id_customer_thread={$message.id_customer_thread}&viewcustomer_thread" method="post">
<input type="hidden" name="id_customer_message" value="{$message.id_customer_message}" />
<dl>
<dt>{l s='Subject:'}</dt>
<dd>
<input type="hidden" name="id_customer_message" value="{$message.id_customer_message}" />
<select name="id_contact" onchange="this.form.submit();" class="col-lg-3">
<select name="id_contact" onchange="this.form.submit();">
{foreach $contacts as $contact}
<option value="{$contact.id_contact}" {if $contact.id_contact == $message.id_contact}selected="selected"{/if}>
{$contact.name}
@@ -200,4 +193,4 @@
</form>
</div>
</div>
{/if}
{/if}
@@ -26,7 +26,6 @@
{extends file="helpers/view/view.tpl"}
{block name="override_tpl"}
<script type="text/javascript">
function saveCustomerNote()
{
@@ -67,8 +66,8 @@
</div>
<ul class="list-unstyled col-lg-6">
<li>
{l s='Gender:'}
<span><img src="{$gender_image}"/></span>
{l s='Title:'}
<span>{$gender->name}</span>
</li>
<li>
{l s='Email:'}
@@ -26,7 +26,7 @@
<div class="leadin">{block name="leadin"}{/block}</div>
{if $module_confirmation}
<div class="module_confirmation conf confirm">
{l s='Your .CSV file has been sucessfully imported into your shop.'}
{l s='Your .CSV file has been sucessfully imported into your shop. Don\'t forget to Re-build the products search index.'}
</div>
{/if}
<div style="display: none">
@@ -118,6 +118,7 @@
<a class="list-group-item" href="../docs/csv_import/addresses_import.csv" target="_blank">{l s='Sample Addresses file'}</a>
<a class="list-group-item" href="../docs/csv_import/manufacturers_import.csv" target="_blank">{l s='Sample Manufacturers file'}</a>
<a class="list-group-item" href="../docs/csv_import/suppliers_import.csv" target="_blank">{l s='Sample Suppliers file'}</a>
<a class="list-group-item" href="../docs/csv_import/alias_import.csv" target="_blank">{l s='Sample Alias file'}</a>
{if $PS_ADVANCED_STOCK_MANAGEMENT}
<a class="list-group-item" href="../docs/csv_import/supply_orders_import.csv" target="_blank">{l s='Supply Orders sample file'}</a>
<a class="list-group-item" href="../docs/csv_import/supply_orders_details_import.csv" target="_blank">{l s='Supply Orders Details sample file'}</a>
@@ -291,30 +292,35 @@
});
$("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();
else
$("label[for=truncate],#truncate").show();
if ($("#entity > option:selected").val() == 8)
{
if ($("#entity > option:selected").val() == 9)
$(".import_supply_orders_details").show();
$('input[name=multiple_value_separator]').val('|');
}
else
{
$(".import_supply_orders_details").hide();
$('input[name=multiple_value_separator]').val('{if isset($multiple_value_separator_selected)}{$multiple_value_separator_selected}{else},{/if}');
}
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
$("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)
$(".import_products_categories, label[for=regenerate], #regenerate").show();
$(".import_products_categories").show();
else
$(".import_products_categories, label[for=regenerate], #regenerate").hide();
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
$(".import_products_categories").hide();
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();
else
$("label[for=forceIDs], #forceIDs").hide();
@@ -96,14 +96,14 @@
</td>
<td>
<select name="i_{$module->name}" class="moduleFavorite">
<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="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>{l s='No'}</option>
</select>
</td>
<td>
<select name="f_{$module->name}" class="moduleFavorite">
<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="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>{l s='No'}</option>
</select>
@@ -69,10 +69,7 @@
<div class="module_name">
<span style="display:none">{$module->name}</span>
{$module->displayName}
<small>v{$module->version}</small>
{if isset($module->type) && $module->type == 'addonsMustHave'}
<span class="label label-info">{l s='Must Have'}</span>
{elseif isset($module->id) && $module->id gt 0}
@@ -86,20 +83,7 @@
{else}
<span class="label label-warning">{l s='Not installed'}</span>
{/if}
<!-- {if isset($module->id) && $module->id gt 0}
<span class="label label-success{if isset($module->active) && $module->active eq 0} off{/if}">{l s='Installed'}</span>
{else}
<span class="label label-warning">{l s='Not installed'}</span>
{/if} -->
</div>
<!-- <p class="text-muted">
{if isset($module->author) && !empty($module->author)}
{l s='Developed by'} {$module->author|truncate:20:'...'}
{/if}
{if isset($module->version_addons)}
({l s='Update'} {$module->version_addons} {l s='Available on PrestaShop Addons'})
{/if}
</p> -->
<p class="module_description">
{if isset($module->description) && $module->description ne ''}
{$module->description}
@@ -38,7 +38,7 @@
<span>
<select id="show_modules" onChange="autoUrl('show_modules', '{$url_show_modules}')" class="filter fixed-width-lg">
<option value="all">{l s='All modules'}&nbsp;</option>
<option>---------------</option>
<option>-</option>
{foreach $modules as $module}
<option value="{$module->id|intval}" {if $display_key == $module->id}selected="selected"{/if}>{$module->displayName}</option>
{/foreach}
@@ -51,7 +51,6 @@
</label>
</p>
</form>
<div id="modulePosition">
<form method="post" action="{$url_submit}" >
@@ -196,4 +195,4 @@
}
});
});
</script>
</script>
@@ -39,4 +39,4 @@
<i class="icon-truck"></i>
</a>
{/if}
</span>
</span>
@@ -689,7 +689,7 @@
var id_product = Number(this.id_product);
var id_product_attribute = Number(this.id_product_attribute);
cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity;
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="' + formatCurrency(parseFloat(this.price.replace(',', '.')), currency_format, currency_sign, currency_blank) + '" /></td><td>';
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="' + this.numeric_price + '" /></td><td>';
cart_content += (!this.id_customization ? '<div class="input-group fixed-width-md"><div class="input-group-btn"><a href="#" class="btn btn-default increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><i class="icon-caret-up"></i></a><a href="#" class="btn btn-default decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'"><i class="icon-caret-down"></i></a></div>' : '');
cart_content += (!this.id_customization ? '<input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" class="cart_quantity" value="'+this.cart_quantity+'" />' : '');
cart_content += (!this.id_customization ? '<div class="input-group-btn"><a href="#" class="delete_product btn btn-default" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><i class="icon-remove text-danger"></i></a></div></div>' : '');
@@ -748,6 +748,16 @@
$('#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)
{
currency_format = jsonSummary.currency.format;
@@ -783,13 +793,13 @@
if (!changed_shipping_price)
$('#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;
$('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts_tax_exc.replace(',', '.')), 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_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax.replace(',', '.')), 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_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price.replace(',', '.')), currency_format, currency_sign, currency_blank));
$('#total_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_products.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(fixPriceFormat(jsonSummary.summary.total_shipping_tax_exc)), 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(fixPriceFormat(jsonSummary.summary.total_price_without_tax)), 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(fixPriceFormat(jsonSummary.summary.total_products)), currency_format, currency_sign, currency_blank));
id_currency = jsonSummary.cart.id_currency;
$('#id_currency option').removeAttr('selected');
$('#id_currency option[value="'+id_currency+'"]').attr('selected', true);
@@ -65,29 +65,27 @@
<div class="row">
<div class="col-lg-3 box-stats color3" >
<i class="icon-calendar-empty"></i>
<span class="title">{l s='Date'}<br /><small>sous-titre</small></span>
<span class="title">{l s='Date'}<br /><small>{l s='subtitle'}</small></span>
<span class="value">{dateFormat date=$order->date_add full=false}</span>
</div>
<div class="col-lg-3 box-stats color2" >
<i class="icon-comments"></i>
<span class="title">{l s='Messages'}<br /><small>sous-titre</small></span>
<!-- <span class="value">{sizeof($messages)}</span> -->
<span class="title">{l s='Messages'}<br /><small>{l s='subtitle'}</small></span>
<span class="value"><a href="{$link->getAdminLink('AdminCustomerThreads')|escape:'htmlall':'UTF-8'}">{sizeof($customer_thread_message)}</a></span>
</div>
<div class="col-lg-3 box-stats color1" >
<i class="icon-ok"></i>
<span class="title">{l s='Products'}<br /><small>sous-titre</small></span>
<span class="title">{l s='Products'}<br /><small>{l s='subtitle'}</small></span>
<span class="value">{sizeof($products)}</span>
</div>
<div class="col-lg-3 box-stats color4" >
<i class="icon-money"></i>
<span class="title">{l s='Total'}<br /><small>sous-titre</small></span>
<span class="title">{l s='Total'}<br /><small>{l s='subtitle'}</small></span>
<span class="value">{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}</span>
</div>
</div>
</div>
<!-- Todo : Be smart and find the best place for Admin order hook -->
{hook h="displayAdminOrder" id_order=$order->id}
<div class="row">
@@ -534,7 +532,7 @@
<label class="control-label col-lg-3">{l s='Choose a standard message'}</label>
<div class="col-lg-9">
<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">--</option>
<option value="0" selected="selected">-</option>
{foreach from=$orderMessages item=orderMessage}
<option value="{$orderMessage['message']|escape:'htmlall':'UTF-8'}">{$orderMessage['name']}</option>
{/foreach}
@@ -852,10 +850,6 @@
</div>
</div>
<form class="container-command-top-spacing" action="{$current_index}&vieworder&token={$smarty.get.token}&id_order={$order->id}" method="post" onsubmit="return orderDeleteProduct('{l s='This product cannot be returned.'}', '{l s='Quantity to cancel is greater than quantity available.'}');">
<input type="hidden" name="id_order" value="{$order->id}" />
<div style="display: none">
@@ -1114,8 +1108,6 @@
</div>
</form>
{if (sizeof($messages))}
<div class="panel">
<h3>
@@ -92,16 +92,16 @@
<label class="control-label col-lg-3" for="id_manufacturer">{l s='Manufacturer:'}</label>
<div class="col-lg-5">
<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}
<option value="{$product->id_manufacturer}" selected="selected">{$product->manufacturer_name}</option>
{/if}
<option disabled="disabled">----------</option>
<option disabled="disabled">-</option>
</select>
</div>
<div class="col-lg-4">
<a class="btn btn-link bt-icon confirm_leave" style="margin-bottom:0" href="{$link->getAdminLink('AdminManufacturers')|escape:'htmlall':'UTF-8'}&addmanufacturer">
<i class="icon-plus-sign"></i> {l s='Create new manufacturer'} <i class="icon-external-link-sign"></i>
<i class="icon-plus-sign"></i> {l s='Create new manufacturer'} <i class="icon-external-link-sign"></i>
</a>
</div>
</div>
@@ -24,14 +24,12 @@
*}
{if isset($product->id) && !$product->is_virtual}
<div class="panel">
<script type="text/javascript">
var msg_combination_1 = '{l s='Please choose an attribute.'}';
var msg_combination_2 = '{l s='Please choose a value.'}';
var msg_combination_3 = '{l s='You can only add one combination per attribute type.'}';
var msg_new_combination = '{l s='New combination'}';
var msg_cancel_combination = '{l s='Cancel combination'}';
var attrs = new Array();
var modifyattributegroup = "{l s='Modify this attribute combination.' js=1}";
attrs[0] = new Array(0, "---");
@@ -43,10 +41,8 @@
{/foreach}
);
{/foreach}
$(document).ready(function(){
populate_attrs();
$(".datepicker").datepicker({
prevText: '',
nextText: '',
@@ -54,14 +50,11 @@
});
});
</script>
<input type="hidden" name="submitted_tabs[]" value="Combinations" />
<h3>{l s='Add or modify combinations for this product.'}</h3>
<div class="alert alert-info">
{l s='Or use the'}&nbsp;<a class="btn btn-link bt-icon confirm_leave" href="index.php?tab=AdminAttributeGenerator&id_product={$product->id}&attributegenerator&token={$token_generator}"><i class="icon-magic"></i> {l s='Product combinations generator'} <i class="icon-external-link-sign"></i></a> {l s='in order to automatically create a set of combinations.'}
</div>
{if $combination_exists}
<div class="alert alert-info" style="display:block">
{l s='Some combinations already exist. If you want to generate new combinations, the quantities for the existing combinations will be lost.'}<br/>
@@ -72,11 +65,8 @@
<br />
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Combinations"}
{/if}
<div id="add_new_combination" class="panel" style="display: none;">
<div class="panel-heading">{l s='Add or modify combinations for this product.'}</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_group">{l s='Attribute:'}</label>
<div class="col-lg-5">
@@ -89,14 +79,13 @@
</select>
</div>
</div>
<div class="row">
<label class="control-label col-lg-3" for="attribute">{l s='Value:'}</label>
<div class="col-lg-9">
<div class="form-group">
<div class="col-lg-8">
<select name="attribute" id="attribute">
<option value="0">---</option>
<option value="0">-</option>
</select>
</div>
<div class="col-lg-4">
@@ -113,9 +102,7 @@
</div>
</div>
</div>
<hr/>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_reference">
<span class="label-tooltip" data-toggle="tooltip"
@@ -126,8 +113,7 @@
<div class="col-lg-5">
<input type="text" id="attribute_reference" name="attribute_reference" value="" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_ean13">
{l s='EAN13:'}
@@ -135,8 +121,7 @@
<div class="col-lg-3">
<input maxlength="13" type="text" id="attribute_ean13" name="attribute_ean13" value="" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_upc">
{l s='UPC:'}
@@ -144,10 +129,8 @@
<div class="col-lg-3">
<input maxlength="12" type="text" id="attribute_upc" name="attribute_upc" value="" />
</div>
</div>
</div>
<hr/>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_wholesale_price">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_wholesale_price" type="default"}
@@ -165,7 +148,6 @@
</div>
<span style="display:none;" id="attribute_wholesale_price_full">({l s='Overrides wholesale price on "Information" tab'})</span>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_price_impact">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_price_impact" type="attribute_price_impact"}
@@ -223,8 +205,6 @@
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_weight_impact">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_weight_impact" type="attribute_weight_impact"}
@@ -255,7 +235,6 @@
</div>
</div>
</div>
<div id="tr_unit_impact" class="form-group">
<label class="control-label col-lg-3" for="attribute_unit_impact">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_unit_impact" type="attribute_unit_impact"}
@@ -284,7 +263,6 @@
</div>
</div>
</div>
{if $ps_use_ecotax}
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_ecotax">
@@ -303,7 +281,6 @@
</div>
</div>
{/if}
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_minimal_quantity">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_minimal_quantity" type="default"}
@@ -317,7 +294,6 @@
<input maxlength="6" name="attribute_minimal_quantity" id="attribute_minimal_quantity" type="text" value="{$minimal_quantity}" />
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="available_date_attribute">
{include file="controllers/products/multishop/checkbox.tpl" field="available_date_attribute" type="default"}
@@ -333,9 +309,7 @@
</div>
</div>
</div>
<hr/>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Image:'}</label>
<div class="col-lg-9">
@@ -344,14 +318,13 @@
<li>
<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}">
<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>
</li>
{/foreach}
</ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3" for="attribute_default">
{include file="controllers/products/multishop/checkbox.tpl" field="attribute_default" type="attribute_default"}
@@ -366,7 +339,6 @@
</p>
</div>
</div>
<div class="panel-footer">
<span id="ResetSpan">
<button type="reset" name="ResetBtn" id="ResetBtn" onclick="$('#desc-product-newCombination').click();" class="btn btn-default">
@@ -377,4 +349,4 @@
</div>
{$list}
</div>
{/if}
{/if}
@@ -33,27 +33,42 @@
</h3>
<div class="row">
<label class="control-label col-lg-5 file_upload_label">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}">
{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}
</span>
</label>
<div class="col-lg-7">
{l s='File:'}
<div id="file-uploader">
<noscript>
<p>{l s='Please enable JavaScript to use file uploader:'}</p>
</noscript>
<div class="form-group">
<label class="control-label col-lg-3 file_upload_label">
<span class="label-tooltip" data-toggle="tooltip"
title="{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}">
{if isset($id_image)}{l s='Edit this product image'}{else}{l s='Add a new image to this product'}{/if}
</span>
</label>
<div class="col-lg-9">
{l s='File:'}
<div id="file-uploader">
<noscript>
<p>{l s='Please enable JavaScript to use file uploader:'}</p>
</noscript>
</div>
<div id="progressBarImage" class="progressBarImage"></div>
<div id="showCounter" style="display:none;">
<span id="imageUpload">0</span><span id="imageTotal">0</span>
</div>
<input type="hidden" name="resizer" value="auto" />
{if Tools::getValue('id_image')}
<input type="hidden" name="id_image" value="{Tools::getValue('id_image')|intval}" />
{/if}
</div>
<div id="progressBarImage" class="progressBarImage"></div>
<div id="showCounter" style="display:none;">
<span id="imageUpload">0</span><span id="imageTotal">0</span>
</div>
<div class="form-group">
<label class="control-label col-lg-3">
{l s='Legend:'}
</label>
<div class="col-lg-9 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" 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'}"/>
<div class="help-block">{l s='Invalid characters:'} <>;=#{}</div>
</div>
{/foreach}
</div>
<input type="hidden" name="resizer" value="auto" />
{if Tools::getValue('id_image')}
<input type="hidden" name="id_image" value="{Tools::getValue('id_image')|intval}" />
{/if}
</div>
</div>
@@ -61,6 +76,7 @@
<thead>
<tr class="nodrag nodrop">
<th class="fixed-width-sm"><span class="title_box">{l s='Image'}</span></th>
<th class="fixed-width-lg"><span class="title_box">{l s='Legend'}</span></th>
<th class="center fixed-width-xs"><span class="title_box">{l s='Position'}</span></th>
{if $shops}
{foreach from=$shops item=shop}
@@ -79,9 +95,10 @@
<tr id="image_id">
<td>
<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>
</td>
<td>legend</td>
<td id="td_image_id" class="pointer dragHandle center positionImage">
image_position
</td>
@@ -129,7 +146,7 @@
}
else
assoc = false;
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}icon-check-sign{else}icon-check-empty{/if}", assoc);
imageLine({$image->id}, "{$image->getExistingImgPath()}", {$image->position}, "{if $image->cover}icon-check-sign{else}icon-check-empty{/if}", assoc, "{$image->legend[$default_language]|@addcslashes:'\"'}");
{/foreach}
{literal}
$("#imageTable").tableDnD(
@@ -149,19 +166,18 @@
}
});
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"),
action: "ajax-tab.php",
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)
{
var percent = ((filecheck * 100) / nbfile);
@@ -186,7 +202,7 @@
cover = "icon-check-empty";
if (responseJSON.cover == "1")
cover = "icon-check-sign";
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);
$("#countImage").html(parseInt($("#countImage").html()) + 1);
$("#img" + id).remove();
@@ -199,6 +215,12 @@
},
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();
$("#listImage").append("<li id='img"+id+"'><div>" + filename + "</div></div><a href=\"javascript:delQueue(" + id +");\"><img src=\"../img/admin/disabled.gif\" ></a><p class=\"errorImg\"></p></li>");
}
@@ -286,8 +308,7 @@
"ajax" : 1
});
});
//function
function updateImagePosition(json)
{
doAdminAjax(
@@ -306,13 +327,14 @@
$("#img" + id).remove();
}
function imageLine(id, path, position, cover, shops)
function imageLine(id, path, position, cover, shops, legend)
{
line = $("#lineType").html();
line = line.replace(/image_id/g, id);
line = line.replace(/[a-z]{2}-default-small_default/g, path+'-small_default');
line = line.replace(/image_id/g, legend);
line = line.replace(/[a-z]{0,2}-default-small_default/g, path+'-small_default');
line = line.replace(/image_path/g, path);
line = line.replace(/image_position/g, position);
line = line.replace(/legend/g, legend);
line = line.replace(/icon-check-empty/g, cover);
line = line.replace(/<tbody>/gi, "");
line = line.replace(/<\/tbody>/gi, "");
@@ -330,4 +352,4 @@
{/literal}
</script>
</div>
{/if}
{/if}
@@ -429,6 +429,17 @@
<div class="row">
{/if}
{foreach from=$languages item=language}
{literal}
<script type="text/javascript">
$().ready(function () {
var input_id = '{/literal}tags_{$language.id_lang}{literal}';
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag' js=1}{literal}'});
$({/literal}'#{$table}{literal}_form').submit( function() {
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
});
});
</script>
{/literal}
{if $languages|count > 1}
<div class="translatable-field lang-{$language.id_lang}">
<div class="col-lg-9">
@@ -444,7 +444,7 @@ $(document).ready(function () {
</div>
<div class="col-lg-6">
<select name="sp_reduction_type" id="sp_reduction_type">
<option selected="selected">---</option>
<option selected="selected">-</option>
<option value="amount">{l s='Amount'}</option>
<option value="percentage">{l s='Percentage'}</option>
</select>
@@ -453,7 +453,6 @@ $(document).ready(function () {
</div>
<p class="help-block">{l s='The discount is applied after the tax'}</p>
</div>
</div>
</div>
<script type="text/javascript">
@@ -58,6 +58,7 @@
$('#file_missing').hide();
$('#virtual_product_name').attr('value', fileName);
$("#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'}' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" /></span>');
$("#upload-confirmation").show();
@@ -112,7 +112,7 @@
<label class="control-label col-lg-3">{l s='Filter by product:'}</label>
<div class="col-lg-9">
<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>
</div>
</div>
@@ -127,6 +127,4 @@
<script type="text/javascript">
updateConversionRate(0);
</script>
{/block}
@@ -54,10 +54,8 @@ $(function() {
{foreach $features key=key item=feature}
{foreach $feature key=k item=val name=feature_list}
<tr>
<td><strong>{if $smarty.foreach.feature_list.first}{$key}{/if}</strong></td>
<td>
<a href="{$val.link}">{$val.value}</a>
</td>
<td><a href="{$val.link}"{if $smarty.foreach.feature_list.first}><strong>{$key}</strong>{/if}</a></td>
<td><a href="{$val.link}">{$val.value}</a></td>
</tr>
{/foreach}
{/foreach}
@@ -79,7 +77,7 @@ $(function() {
<tbody>
{foreach $modules key=key item=module}
<tr>
<td><strong><a href="{$module->linkto|escape:'htmlall':'UTF-8'}">{$module->displayName}</a></strong></td>
<td><a href="{$module->linkto|escape:'htmlall':'UTF-8'}"><strong>{$module->displayName}</strong></a></td>
<td><a href="{$module->linkto|escape:'htmlall':'UTF-8'}">{$module->description}</a></td>
</tr>
{/foreach}
@@ -99,7 +97,7 @@ $(function() {
</h3>
<table cellspacing="0" cellpadding="0" class="table">
{foreach $categories key=key item=category}
<tr class="alt_row">
<tr>
<td>{$category}</td>
</tr>
{/foreach}
@@ -145,4 +143,27 @@ $(function() {
{$orders}
</div>
{/if}
{if isset($addons) && $addons}
<div class="panel">
<h3>
{if $addons|@count == 1}
{l s='1 addon'}
{else}
{l s='%d addons' sprintf=$addons|@count}
{/if}
</h3>
<table class="table">
<tbody>
{foreach $addons key=key item=addon}
<tr>
<td><a href="{$addon.href|escape:'htmlall':'UTF-8'}" target="_blank"><strong>{$addon.title|escape:'htmlall':'UTF-8'}</strong></a></td>
<td><a href="{$addon.href|escape:'htmlall':'UTF-8'}" target="_blank">{$addon.description|truncate:256:'...'|escape:'htmlall':'UTF-8'}</a></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
{/if}
@@ -50,7 +50,7 @@
{/block}
{block name="after"}
<div class="panel" id="prestastore-content"></div>
<div class="panel clearfix" id="prestastore-content"></div>
<script type="text/javascript">
$.ajax({
type: 'POST',
+9 -9
View File
@@ -44,14 +44,14 @@
var roundMode = {$round_mode};
{if isset($shop_context)}
{if $shop_context == Shop::CONTEXT_ALL}
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops' slashes=1 }";
var youEditFieldFor = '{l s='A modification of this field will be applied for all shops' slashes=1}';
{elseif $shop_context == Shop::CONTEXT_GROUP}
var youEditFieldFor = "{l s='A modification of this field will be applied for all shops of group ' slashes=1 }<b>{$shop_name}</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}
var youEditFieldFor = "{l s='A modification of this field will be applied for the shop ' slashes=1 }<b>{$shop_name}</b>";
var youEditFieldFor = '{l s='A modification of this field will be applied for the shop' slashes=1}<b>{$shop_name}</b>';
{/if}
{else}
var youEditFieldFor = '';
{else}
var youEditFieldFor = '';
{/if}
{* Notifications vars *}
var autorefresh_notifications = '{$autorefresh_notifications}';
@@ -66,12 +66,12 @@
var new_msg = '{l s='A new message posted on your shop.' slashes=1}';
var excerpt_msg = '{l s='Excerpt: ' slashes=1}';
var see_msg = '{l s='Read this message' slashes=1}';
var token_admin_orders = '{getAdminToken tab='AdminOrders' slashes=1}';
var token_admin_customers = '{getAdminToken tab='AdminCustomers' slashes=1}';
var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads' slashes=1}';
var token_admin_orders = '{getAdminToken tab='AdminOrders'}';
var token_admin_customers = '{getAdminToken tab='AdminCustomers'}';
var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads'}';
var currentIndex = '{$currentIndex}';
var default_language = '{$default_language|intval}';
var choose_language_translate = "{l s='Choose language' slashes=1}";
var choose_language_translate = '{l s='Choose language' slashes=1}';
var admin_modules_link = '{$link->getAdminLink("AdminModules")|addslashes}';
var tab_modules_list = '{if isset($tab_modules_list) && $tab_modules_list}{$tab_modules_list|addslashes}{/if}';
</script>
@@ -178,8 +178,7 @@
<script type="text/javascript">
$().ready(function () {
var input_id = '{/literal}{if isset($input.id)}{$input.id}{else}{$input.name}{/if}{literal}';
$('#'+input_id).tagify();
$('#'+input_id).tagify({delimiters: [13,44],addTagPrompt: '{/literal}{l s='Add tag'}{literal}'});
$('#'+input_id).tagify({delimiters: [13,44], addTagPrompt: '{/literal}{l s='Add tag'}{literal}'});
$({/literal}'#{$table}{literal}_form').submit( function() {
$(this).find('#'+input_id).val($('#'+input_id).tagify('serialize'));
});
@@ -337,7 +336,7 @@
{/if}
>{$option->$input.options.name}</option>
{elseif $option == "-"}
<option value="">--</option>
<option value="">-</option>
{else}
<option value="{$option[$input.options.id]}"
{if isset($input.multiple)}
@@ -24,11 +24,11 @@
*}
{if count($categories) && isset($categories)}
<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 selectedCat = '{implode value=$categories.selected_cat}';
var selectedLabel = '{$categories.trads.selected}';
var home = '{$categories.trads.Root.name}';
var selectedCat = {$categories.selected_cat|@implode|intval};
var selectedLabel = '{$categories.trads.selected|@addcslashes:'\''}';
var home = '{$categories.trads.Root.name|@addcslashes:'\''}';
var use_radio = {if $categories.use_radio}1{else}0{/if};
var use_context = {if isset($categories.use_context)}1{else}0{/if};
$(document).ready(function(){
@@ -256,7 +256,7 @@
{else}
{if $params.type == 'bool'}
<select class="filter fixed-width-sm" 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="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
</select>
@@ -278,7 +278,7 @@
{elseif $params.type == 'select'}
{if isset($params.filter_key)}
<select class="filter" 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)}
{foreach $params.list AS $option_value => $option_display}
<option value="{$option_value}" {if (string)$option_display === (string)$params.value || (string)$option_value === (string)$params.value} selected="selected"{/if}>{$option_display}</option>
@@ -83,7 +83,7 @@
btn_submit.hide();
//bind enter key press to validate form
$('#{$table}_form').keypress(function (e) {
if (e.which == 13 && e.target.localName != 'textarea')
if (e.which == 13 && e.target.localName != 'textarea' && !e.target.hasClass('tagify'))
$('#desc-{$table}-save').click();
});
//submit the form
+2 -2
View File
@@ -1500,7 +1500,7 @@ abstract class AdminTabCore
case 'bool':
echo '
<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="0"'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option>
</select>';
@@ -1524,7 +1524,7 @@ abstract class AdminTabCore
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"' : '').'>
<option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>--</option>';
<option value=""'.(($value == 0 && $value != '') ? ' selected="selected"' : '').'>-</option>';
if (isset($params['select']) && is_array($params['select']))
foreach ($params['select'] as $optionValue => $optionDisplay)
{
+16
View File
@@ -124,5 +124,21 @@ class AliasCore extends ObjectModel
{
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']);
}
}
+12 -4
View File
@@ -49,6 +49,8 @@ class Autoload
*/
public $index = array();
public $_include_override_path = true;
protected function __construct()
{
$this->root_dir = _PS_ROOT_DIR_.'/';
@@ -120,10 +122,16 @@ class Autoload
{
$classes = array_merge(
$this->getClassesFromDir('classes/'),
$this->getClassesFromDir('override/classes/'),
$this->getClassesFromDir('controllers/'),
$this->getClassesFromDir('override/controllers/')
$this->getClassesFromDir('controllers/')
);
if ($this->_include_override_path)
$classes = array_merge(
$classes,
$this->getClassesFromDir('override/classes/'),
$this->getClassesFromDir('override/controllers/')
);
ksort($classes);
$content = '<?php return '.var_export($classes, true).'; ?>';
@@ -189,4 +197,4 @@ class Autoload
{
return isset($this->index[$classname]) ? $this->index[$classname] : null;
}
}
}
+2
View File
@@ -34,6 +34,7 @@ class CMSCore extends ObjectModel
public $link_rewrite;
public $id_cms_category;
public $position;
public $indexation;
public $active;
/**
@@ -46,6 +47,7 @@ class CMSCore extends ObjectModel
'fields' => array(
'id_cms_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'position' => array('type' => self::TYPE_INT),
'indexation' => array('type' => self::TYPE_BOOL),
'active' => array('type' => self::TYPE_BOOL),
// Lang fields
+1 -1
View File
@@ -3219,7 +3219,7 @@ class CartCore extends ObjectModel
public function getWsCartRows()
{
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`
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
$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
foreach ($result as &$cart_rule)
{
+13 -4
View File
@@ -73,7 +73,7 @@ class CurrencyCore extends ObjectModel
'sign' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 8),
'format' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'decimals' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isFloat', 'required' => true, 'shop' => true),
'conversion_rate' =>array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat', 'required' => true, 'shop' => true),
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
),
@@ -107,14 +107,23 @@ class CurrencyCore extends ObjectModel
$this->suffix = $this->format % 2 == 0 ? ' '.$this->sign : '';
}
/**
* Overriding check if currency with the same iso code already exists.
* If it's true, currency is doesn't added.
* Overriding check if currency rate is not empty and if currency with the same iso code already exists.
* If it's true, currency is not added.
*
* @see ObjectModelCore::add()
*/
public function add($autodate = true, $nullValues = false)
{
return Currency::exists($this->iso_code, $this->iso_code_num) ? false : parent::add();
if ((float)$this->conversion_rate <= 0)
return false;
return Currency::exists($this->iso_code, $this->iso_code_num) ? false : parent::add($autodate, $nullValues);
}
public function update($autodate = true, $nullValues = false)
{
if ((float)$this->conversion_rate <= 0)
return false;
return parent::update($autodate, $nullValues);
}
/**
+4 -2
View File
@@ -589,9 +589,11 @@ class CustomerCore extends ObjectModel
*/
public function updateGroup($list)
{
$this->cleanGroups();
if ($list && !empty($list))
{
$this->cleanGroups();
$this->addGroups($list);
}
else
$this->addGroups(array($this->id_default_group));
}
@@ -606,7 +608,7 @@ class CustomerCore extends ObjectModel
foreach ($groups as $group)
{
$row = array('id_customer' => (int)$this->id, 'id_group' => (int)$group);
Db::getInstance()->insert('customer_group', $row);
Db::getInstance()->insert('customer_group', $row, false, true, Db::INSERT_IGNORE);
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ class CustomerMessageCore extends ObjectModel
'fields' => array(
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'id_customer_thread' => array('type' => self::TYPE_INT),
'ip_address' => array('type' => self::TYPE_INT, 'validate' => 'isIp2Long'),
'ip_address' => array('type' => self::TYPE_STRING, 'validate' => 'isIp2Long', 'size' => 15),
'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000),
'file_name' => array('type' => self::TYPE_STRING),
'user_agent' => array('type' => self::TYPE_STRING),
+1 -1
View File
@@ -369,7 +369,7 @@ class DispatcherCore
// If there are several languages, get language from uri
if ($this->use_routes && Language::isMultiLanguageActivated())
if (preg_match('#^/([a-z]{2})/?#', $this->request_uri, $m))
if (preg_match('#^/([a-z]{2})(?:/.*)?$#', $this->request_uri, $m))
{
$_GET['isolang'] = $m[1];
$this->request_uri = substr($this->request_uri, 3);
+31 -10
View File
@@ -312,16 +312,37 @@ class FeatureCore extends ObjectModel
*/
public static function cleanPositions()
{
return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'feature` f
LEFT JOIN (
SELECT @i := @i +1 AS rank, id_feature, position
FROM `'._DB_PREFIX_.'feature`
JOIN (SELECT @i :=1) dummy
ORDER by position
) AS f2
USING (id_feature)
SET f.position = f2.rank - 1');
//Reordering positions to remove "holes" in them (after delete for instance)
$sql = "SELECT id_feature, position FROM "._DB_PREFIX_."feature ORDER BY id_feature";
$db = Db::getInstance();
$r = $db->executeS($sql, false);
$shiftTable = array(); //List of update queries (one query is necessary for each "hole" in the table)
$currentDelta = 0;
$minId = 0;
$maxId = 0;
$futurePosition = 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'];
}
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)
{
$id_feature_value = Db::getInstance()->getValue('
SELECT `id_feature_value`
FROM '._DB_PREFIX_.'feature_product
WHERE `id_feature` = '.(int)$id_feature.'
AND `id_product` = '.(int)$id_product);
SELECT fp.`id_feature_value`
FROM '._DB_PREFIX_.'feature_product fp
INNER JOIN '._DB_PREFIX_.'feature_value fv USING (`id_feature_value`)
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('
UPDATE '._DB_PREFIX_.'feature_value_lang
SET `value` = \''.pSQL($value).'\'
WHERE `id_feature_value` = '.(int)$id_feature_value.'
AND `value` != \''.pSQL($value).'\'
AND `id_lang` = '.(int)$id_lang);
}
else
if (!$custom)
$id_feature_value = Db::getInstance()->getValue('
SELECT fv.`id_feature_value`
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).'\'
AND fv.`id_feature` = '.(int)$id_feature.'
AND fv.`custom` = 0
GROUP BY fv.`id_feature_value`');
if ($id_feature_value)
@@ -160,7 +166,7 @@ class FeatureValueCore extends ObjectModel
// Feature doesn't exist, create it
$feature_value = new FeatureValue();
$feature_value->id_feature = (int)$id_feature;
$feature_value->custom = 0;
$feature_value->custom = (bool)$custom;
foreach (Language::getLanguages() as $language)
$feature_value->value[$language['id_lang']] = $value;
$feature_value->add();
+12 -2
View File
@@ -102,6 +102,11 @@ class QqUploadedFileForm
$image = new Image();
$image->id_product = (int)$product->id;
$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))
$image->cover = 1;
else
@@ -136,7 +141,7 @@ class QqUploadedFileForm
if (!$image->update())
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);
}
@@ -184,6 +189,11 @@ class QqUploadedFileXhr
$image = new Image();
$image->id_product = (int)($product->id);
$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))
$image->cover = 1;
else
@@ -223,7 +233,7 @@ class QqUploadedFileXhr
if (!$image->update())
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);
}
+1 -1
View File
@@ -325,7 +325,7 @@ class GroupCore extends ObjectModel
* @param boolean $unrestricted allows search without lang and includes first group and exact match
* @return array Corresponding groupes
*/
public static function searchByName($id_lang, $query)
public static function searchByName($query)
{
return Db::getInstance()->getRow('
SELECT g.*, gl.*
+10 -1
View File
@@ -56,6 +56,8 @@ class HookCore extends ObjectModel
*/
public static $executed_hooks = array();
public static $native_module;
/**
* @see ObjectModel::$definition
*/
@@ -416,12 +418,19 @@ class HookCore extends ObjectModel
// Look on modules list
$altern = 0;
$output = '';
if (!isset(Hook::$native_module))
Hook::$native_module = Module::getNativeModuleList();
foreach ($module_list as $array)
{
// Check errors
if ($id_module && $id_module != $array['id_module'])
continue;
if ((bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE') && !in_array($array['module'], self::$native_module))
continue;
if (!($moduleInstance = Module::getInstanceByName($array['module'])))
continue;
+4
View File
@@ -40,6 +40,9 @@ class ImageCore extends ObjectModel
/** @var boolean Image is cover */
public $cover;
/** @var string Legend */
public $legend;
/** @var string image extension */
public $image_format = 'jpg';
@@ -66,6 +69,7 @@ class ImageCore extends ObjectModel
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'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 $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`
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)
+1 -1
View File
@@ -62,7 +62,7 @@ class LoggerCore extends ObjectModel
'fields' => array(
'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'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'),
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'),
+2 -2
View File
@@ -85,11 +85,11 @@ class MetaCore extends ObjectModel
// Add modules controllers to list (this function is cool !)
foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file)
{
$filename = basename($file, '.php');
$filename = Tools::strtolower(basename($file, '.php'));
if ($filename == 'index')
continue;
$module = basename(dirname(dirname(dirname($file))));
$module = Tools::strtolower(basename(dirname(dirname(dirname($file)))));
$selected_pages[$module.' - '.$filename] = 'module-'.$module.'-'.$filename;
}
+2 -2
View File
@@ -1139,7 +1139,7 @@ abstract class ObjectModelCore
{
$vars = get_class_vars($class_name);
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 = '';
if (count($or))
@@ -1658,4 +1658,4 @@ abstract class ObjectModelCore
{
$this->update_fields = $fields;
}
}
}
+7 -7
View File
@@ -545,6 +545,13 @@ abstract class PaymentModuleCore extends Module
if ($order_status->logable)
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())
{
$history = new OrderHistory();
@@ -553,13 +560,6 @@ abstract class PaymentModuleCore extends Module
$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);
// Order is reloaded because the status just changed
+1
View File
@@ -3623,6 +3623,7 @@ class ProductCore extends ObjectModel
if ($result3)
{
$result3['id_feature_value'] = $new_id_feature_value;
$result3['value'] = pSQL($result3['value']);
$return &= Db::getInstance()->insert('feature_value_lang', $result3);
}
}
+33 -21
View File
@@ -74,11 +74,22 @@ class ProductSaleCore
$groups = FrontController::getCurrentCustomerGroups();
$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;
//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')
$prefix = 'p.';
$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.`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`)
'.Product::sqlStock('p').'
WHERE product_shop.`active` = 1
AND product_shop.`visibility` != \'none\'
AND p.`id_product` IN (
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 p.`visibility` != \'none\'
AND p.`id_product` IN ('.$ids.')
GROUP BY product_shop.id_product
ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).'
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
@@ -141,16 +147,27 @@ class ProductSaleCore
$groups = FrontController::getCurrentCustomerGroups();
$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, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, 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, p.show_price, p.available_for_order, IFNULL(stock.quantity, 0) as quantity, p.customizable,
IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, stock.out_of_stock
FROM `'._DB_PREFIX_.'product_sale` ps
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
ON (p.`id_product` = pa.`id_product`)
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').'
'.Product::sqlStock('p', 'product_attribute_shop', false, $context->shop).'
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
ON p.`id_product` = pl.`id_product`
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
@@ -161,13 +178,8 @@ class ProductSaleCore
ON cl.`id_category` = product_shop.`id_category_default`
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
WHERE product_shop.`active` = 1
AND product_shop.`visibility` != \'none\'
AND p.`id_product` IN (
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 p.`visibility` != \'none\'
AND p.`id_product` IN ('.$ids.')
GROUP BY product_shop.id_product
ORDER BY sales DESC
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
+24 -13
View File
@@ -94,7 +94,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::add($autodate, $nullValues))
{
// Flush cache when we adding a new specific price
self::$_specificPriceCache = array();
SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache();
// Set cache of feature detachable to true
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1');
@@ -108,7 +108,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::update($null_values))
{
// Flush cache when we updating a new specific price
self::$_specificPriceCache = array();
SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache();
return true;
}
@@ -120,7 +120,7 @@ class SpecificPriceCore extends ObjectModel
if (parent::delete())
{
// Flush cache when we deletind a new specific price
self::$_specificPriceCache = array();
SpecificPrice::$_specificPriceCache = array();
Product::flushPriceCache();
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table']));
@@ -180,9 +180,9 @@ class SpecificPriceCore extends ObjectModel
if (!SpecificPrice::isFeatureActive())
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`
FROM `'._DB_PREFIX_.'specific_price_priority`
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)
$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);
if (!array_key_exists($key, self::$_specificPriceCache))
if (!array_key_exists($key, SpecificPrice::$_specificPriceCache))
{
$now = date('Y-m-d H:i:s');
self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
$query = '
SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).'
FROM `'._DB_PREFIX_.'specific_price`
WHERE `id_product` IN (0, '.(int)$id_product.')
AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.')
@@ -228,11 +228,22 @@ class SpecificPriceCore extends ObjectModel
AND
(`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`)
)
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');
AND id_cart IN (0, '.(int)$id_cart.') ';
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)
+91 -54
View File
@@ -357,13 +357,11 @@ class ToolsCore
if (Validate::isLanguageIsoCode($string))
{
$lang = new Language(Language::getIdByIso($string));
if (Validate::isLoadedObject($lang) && $lang->active)
{
$language = new Language((int)$lang->id);
if (Validate::isLoadedObject($language))
Context::getContext()->language = $language;
if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop())
{
Context::getContext()->language = $lang;
$cookie->id_lang = (int)$lang->id;
}
}
}
}
@@ -674,14 +672,20 @@ class ToolsCore
public static function htmlentitiesUTF8($string, $type = ENT_QUOTES)
{
if (is_array($string))
return array_map(array('Tools', 'htmlentitiesUTF8'), $string);
{
$string = array_map(array('Tools', 'htmlentitiesUTF8'), $string);
return (string)array_shift($string);
}
return htmlentities((string)$string, $type, 'utf-8');
}
public static function htmlentitiesDecodeUTF8($string)
{
if (is_array($string))
return array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string);
{
$string = array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string);
return (string)array_shift($string);
}
return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8');
}
@@ -1107,63 +1111,94 @@ class ToolsCore
/* One source among others:
http://www.tachyonsoft.com/uc0000.htm
http://www.tachyonsoft.com/uc0001.htm
http://www.tachyonsoft.com/uc0004.htm
*/
$patterns = array(
/* Lowercase */
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}]/u',
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}]/u',
/* d */ '/[\x{010F}\x{0111}]/u',
/* e */ '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{0113}\x{0115}\x{0117}\x{0119}\x{011B}]/u',
/* g */ '/[\x{011F}\x{0121}\x{0123}]/u',
/* h */ '/[\x{0125}\x{0127}]/u',
/* i */ '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{0129}\x{012B}\x{012D}\x{012F}\x{0131}]/u',
/* j */ '/[\x{0135}]/u',
/* k */ '/[\x{0137}\x{0138}]/u',
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}]/u',
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}]/u',
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}]/u',
/* r */ '/[\x{0155}\x{0157}\x{0159}]/u',
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}]/u',
/* ss*/ '/[\x{00DF}]/u',
/* t */ '/[\x{0163}\x{0165}\x{0167}]/u',
/* u */ '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{0169}\x{016B}\x{016D}\x{016F}\x{0171}\x{0173}]/u',
/* w */ '/[\x{0175}]/u',
/* y */ '/[\x{00FF}\x{0177}\x{00FD}]/u',
/* z */ '/[\x{017A}\x{017C}\x{017E}]/u',
/* ae*/ '/[\x{00E6}]/u',
/* oe*/ '/[\x{0153}]/u',
/* a */ '/[\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{0101}\x{0103}\x{0105}\x{0430}]/u',
/* b */ '/[\x{0431}]/u',
/* c */ '/[\x{00E7}\x{0107}\x{0109}\x{010D}\x{0446}]/u',
/* d */ '/[\x{010F}\x{0111}\x{0434}]/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',
/* f */ '/[\x{0444}]/u',
/* g */ '/[\x{011F}\x{0121}\x{0123}\x{0433}\x{0491}]/u',
/* h */ '/[\x{0125}\x{0127}]/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',
/* j */ '/[\x{0135}\x{0439}]/u',
/* k */ '/[\x{0137}\x{0138}\x{043A}]/u',
/* l */ '/[\x{013A}\x{013C}\x{013E}\x{0140}\x{0142}\x{043B}]/u',
/* m */ '/[\x{043C}]/u',
/* n */ '/[\x{00F1}\x{0144}\x{0146}\x{0148}\x{0149}\x{014B}\x{043D}]/u',
/* o */ '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{014D}\x{014F}\x{0151}\x{043E}]/u',
/* p */ '/[\x{043F}]/u',
/* r */ '/[\x{0155}\x{0157}\x{0159}\x{0440}]/u',
/* s */ '/[\x{015B}\x{015D}\x{015F}\x{0161}\x{0441}]/u',
/* ss */ '/[\x{00DF}]/u',
/* t */ '/[\x{0163}\x{0165}\x{0167}\x{0442}]/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',
/* 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 */
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u',
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}]/u',
/* D */ '/[\x{010E}\x{0110}]/u',
/* E */ '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{0112}\x{0114}\x{0116}\x{0118}\x{011A}]/u',
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}]/u',
/* H */ '/[\x{0124}\x{0126}]/u',
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}]/u',
/* J */ '/[\x{0134}]/u',
/* K */ '/[\x{0136}]/u',
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}]/u',
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}]/u',
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}]/u',
/* R */ '/[\x{0154}\x{0156}\x{0158}]/u',
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}]/u',
/* T */ '/[\x{0162}\x{0164}\x{0166}]/u',
/* U */ '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{0168}\x{016A}\x{016C}\x{016E}\x{0170}\x{0172}]/u',
/* W */ '/[\x{0174}]/u',
/* Y */ '/[\x{0176}]/u',
/* Z */ '/[\x{0179}\x{017B}\x{017D}]/u',
/* AE*/ '/[\x{00C6}]/u',
/* OE*/ '/[\x{0152}]/u');
/* A */ '/[\x{0100}\x{0102}\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}\x{0410}]/u',
/* B */ '/[\x{0411}]]/u',
/* C */ '/[\x{00C7}\x{0106}\x{0108}\x{010A}\x{010C}\x{0426}]/u',
/* D */ '/[\x{010E}\x{0110}\x{0414}]/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',
/* F */ '/[\x{0424}]/u',
/* G */ '/[\x{011C}\x{011E}\x{0120}\x{0122}\x{0413}\x{0490}]/u',
/* H */ '/[\x{0124}\x{0126}]/u',
/* I */ '/[\x{0128}\x{012A}\x{012C}\x{012E}\x{0130}\x{0418}\x{0406}]/u',
/* J */ '/[\x{0134}\x{0419}]/u',
/* K */ '/[\x{0136}\x{041A}]/u',
/* L */ '/[\x{0139}\x{013B}\x{013D}\x{0139}\x{0141}\x{041B}]/u',
/* M */ '/[\x{041C}]/u',
/* N */ '/[\x{00D1}\x{0143}\x{0145}\x{0147}\x{014A}\x{041D}]/u',
/* O */ '/[\x{00D3}\x{014C}\x{014E}\x{0150}\x{041E}]/u',
/* P */ '/[\x{041F}]/u',
/* R */ '/[\x{0154}\x{0156}\x{0158}\x{0420}]/u',
/* S */ '/[\x{015A}\x{015C}\x{015E}\x{0160}\x{0421}]/u',
/* T */ '/[\x{0162}\x{0164}\x{0166}\x{0422}]/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',
/* 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 aa
// ä to ae
$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', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', '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', '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);
@@ -1697,13 +1732,15 @@ class ToolsCore
fwrite($write_fd, "AddType application/x-font-woff .woff\n");
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
fwrite($write_fd, "<IfModule mod_rewrite.c>\n");
// 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, "</IfModule>\n\n");
// Disable multiviews ?
if ($disable_multiviews)
+20 -17
View File
@@ -1543,7 +1543,7 @@ class AdminControllerCore extends Controller
'link' => $this->context->link,
'shop_name' => Configuration::get('PS_SHOP_NAME'),
'base_url' => $this->context->shop->getBaseURL(),
'tab' => $tab, // Deprecated, this tab is declared in the foreach, so it's the last tab in the foreach
'tab' => isset($tab) ? $tab : null, // Deprecated, this tab is declared in the foreach, so it's the last tab in the foreach
'current_parent_id' => (int)Tab::getCurrentParentId(),
'tabs' => $tabs,
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
@@ -2120,7 +2120,10 @@ class AdminControllerCore extends Controller
$this->context->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
elseif ($this->context->shop->id != $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();
}
@@ -2379,8 +2382,10 @@ class AdminControllerCore extends Controller
if (preg_match('/[.!]/', $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);
@@ -2474,7 +2479,7 @@ class AdminControllerCore extends Controller
(isset($this->_filter) ? $this->_filter : '').$where_shop.'
'.(isset($this->_group) ? $this->_group.' ' : '').'
'.$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 : '').
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
@@ -2526,22 +2531,20 @@ class AdminControllerCore extends Controller
public function getLanguages()
{
$cookie = $this->context->cookie;
$this->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$this->allow_employee_form_lang = (int)Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG');
if ($this->allow_employee_form_lang && !$cookie->employee_form_lang)
$cookie->employee_form_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$use_lang_from_cookie = false;
$cookie->employee_form_lang = (int)$this->context->language->id;
$lang_exists = false;
$this->_languages = Language::getLanguages(false);
if ($this->allow_employee_form_lang)
foreach ($this->_languages as $lang)
if ($cookie->employee_form_lang == $lang['id_lang'])
$use_lang_from_cookie = true;
if (!$use_lang_from_cookie)
$this->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT');
else
$this->default_form_language = (int)$cookie->employee_form_lang;
foreach ($this->_languages as $lang)
if (isset($cookie->employee_form_lang) && $cookie->employee_form_lang == $lang['id_lang'])
$lang_exists = true;
$this->default_form_language = $lang_exists ? (int)$cookie->employee_form_lang : (int)$this->context->language->id;
foreach ($this->_languages as $k => $language)
$this->_languages[$k]['is_default'] = (int)($language['id_lang'] == $this->default_form_language);
$this->_languages[$k]['is_default'] = ((int)($language['id_lang'] == $this->default_form_language));
return $this->_languages;
}
@@ -3269,4 +3272,4 @@ class AdminControllerCore extends Controller
return $return;
}
}
}
+5
View File
@@ -304,6 +304,10 @@ class FrontControllerCore extends Controller
foreach ($languages as $lang)
$meta_language[] = $lang['iso_code'];
$compared_products = array();
if (Configuration::get('PS_COMPARATOR_MAX_ITEM') && isset($this->context->cookie->id_compare))
$compared_products = CompareProduct::getCompareProducts($this->context->cookie->id_compare);
$this->context->smarty->assign(array(
// Usefull for layout.tpl
'mobile_device' => $this->context->getMobileDevice(),
@@ -342,6 +346,7 @@ class FrontControllerCore extends Controller
'PS_STOCK_MANAGEMENT' => Configuration::get('PS_STOCK_MANAGEMENT'),
'quick_view' => Configuration::get('PS_QUICK_VIEW'),
'shop_phone' => Configuration::get('PS_SHOP_PHONE'),
'compared_products' => is_array($compared_products) ? $compared_products : array()
));
// Add the tpl files directory for mobile
+6 -8
View File
@@ -214,20 +214,18 @@ class HelperCore
$html = '
<script type="text/javascript">
var inputName = "'.$input_name.'";
';
var inputName = \''.addcslashes($input_name, '\'').'\';'."\n";
if (count($selected_cat) > 0)
{
if (isset($selected_cat[0]))
$html .= 'var selectedCat = "'.implode(',', $selected_cat).'";';
$html .= ' var selectedCat = '.(int)implode(',', $selected_cat).';'."\n";
else
$html .= 'var selectedCat = "'.implode(',', array_keys($selected_cat)).'";';
$html .= ' var selectedCat = '.(int)implode(',', array_keys($selected_cat)).';'."\n";
}
else
$html .= 'var selectedCat = "";';
$html .= '
var selectedLabel = \''.$translations['selected'].'\';
var home = \''.$root['name'].'\';
$html .= ' var selectedCat = \'\';'."\n";
$html .= ' var selectedLabel = \''.$translations['selected'].'\';
var home = \''.addcslashes($root['name'], '\'').'\';
var use_radio = '.(int)$use_radio.';';
if (!$use_in_popup)
$html .= '
+6 -5
View File
@@ -455,13 +455,13 @@ class HelperListCore extends Helper
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
if (!array_key_exists('DeleteItem', self::$cache_lang))
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', false, false);
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', true, false);
if (!array_key_exists('Name', self::$cache_lang))
self::$cache_lang['Name'] = $this->l('Name:', 'Helper', false, false);
self::$cache_lang['Name'] = $this->l('Name:', 'Helper', true, false);
if (!is_null($name))
$name = '\n\n'.self::$cache_lang['Name'].' '.$name;
$name = addcslashes('\n\n'.self::$cache_lang['Name'].' '.$name, '\'');
$data = array(
$this->identifier => $id,
@@ -470,7 +470,8 @@ class HelperListCore extends Helper
);
if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\''));
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(self::$cache_lang['DeleteItem'].$name);
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
return $tpl->fetch();
@@ -523,7 +524,7 @@ class HelperListCore extends Helper
if (Tools::getIsset($this->table.'Orderby'))
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table;
$action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->table;
/* Determine current page number */
$page = (int)Tools::getValue('submitFilter'.$this->list_id);
+31 -5
View File
@@ -1247,11 +1247,7 @@ abstract class ModuleCore
$module->interest = 0;
}
usort($module_list, create_function('$a,$b', '
if ($a->displayName == $b->displayName)
return 0;
return ($a->displayName < $b->displayName) ? -1 : 1;
'));
usort($module_list, create_function('$a,$b', 'return strnatcasecmp($a->displayName, $b->displayName);'));
if ($errors)
{
@@ -1310,6 +1306,23 @@ abstract class ModuleCore
return $db->executeS('SELECT * FROM `'._DB_PREFIX_.'module` m WHERE `name` NOT IN ('.implode(',', $arr_native_modules).') ');
}
public static function getNativeModuleList()
{
$module_list_xml = _PS_ROOT_DIR_.self::CACHE_FILE_MODULES_LIST;
$native_modules = simplexml_load_file($module_list_xml);
$native_modules = $native_modules->modules;
$modules = array();
foreach ($native_modules as $native_modules_type)
if (in_array($native_modules_type['type'], array('native', 'partner')))
{
foreach ($native_modules_type->module as $module)
$modules[] = $module['name'];
}
return $modules;
}
/**
* Return installed modules
*
@@ -1593,6 +1606,18 @@ abstract class ModuleCore
return Cache::retrieve('Module::isInstalled'.$module_name);
}
public function isEnabledForShopContext()
{
$shop_list = Shop::getContextListShopID();
return (bool)Db::getInstance()->getValue('
SELECT COUNT(*) n
FROM `'._DB_PREFIX_.'module_shop`
WHERE id_module='.(int)$this->id.' AND id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).')
GROUP BY id_module
HAVING n='.(int)count(Shop::getContextListShopID())
);
}
public static function isEnabled($module_name)
{
if (!Cache::isStored('Module::isEnabled'.$module_name))
@@ -1771,6 +1796,7 @@ abstract class ModuleCore
@unlink($file);
@file_put_contents($file, $xml);
}
@chmod($file, 0664);
}
}
+1
View File
@@ -144,6 +144,7 @@ class OrderReturnCore extends ObjectModel
$data[$k]['type'] = 'Return';
$data[$k]['tracking_number'] = $or['id_order_return'];
$data[$k]['can_edit'] = false;
$data[$k]['reference'] = Order::getUniqReferenceOf($or['id_order']);
}
return $data;
}
+1 -1
View File
@@ -799,7 +799,7 @@ class ShopCore extends ObjectModel
{
if (Shop::getContext() == Shop::CONTEXT_SHOP)
$list = ($share) ? Shop::getSharedShops(Shop::getContextShopID(), $share) : array(Shop::getContextShopID());
else if (Shop::getContext() == Shop::CONTEXT_GROUP)
elseif (Shop::getContext() == Shop::CONTEXT_GROUP)
$list = Shop::getShops(true, Shop::getContextShopGroupID(), true);
else
$list = Shop::getShops(true, null, true);
+4 -1
View File
@@ -236,7 +236,10 @@ class StockMvtCore extends ObjectModel
$query->innerJoin('stock', 's', 's.id_stock = sm.id_stock');
$query->innerJoin('warehouse', 'w', 'w.id_warehouse = s.id_warehouse');
$query->where('sm.sign = 1');
$query->where('s.id_product = '.(int)$id_product.' OR s.id_product_attribute = '.(int)$id_product_attribute);
if ($id_product_attribute)
$query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute);
else
$query->where('s.id_product = '.(int)$id_product);
$query->orderBy('date_add DESC');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
+4 -2
View File
@@ -73,8 +73,10 @@ function bqSQL($string)
function displayFatalError()
{
$error = error_get_last();
if ($error !== NULL && in_array($error['type'], array(E_ERROR, E_PARSE)))
$error = null;
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'];
}
+2 -1
View File
@@ -70,7 +70,8 @@ smartyRegisterFunction($smarty, 'function', 'd', 'smartyDieObject'); // Debug on
smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate', false);
smartyRegisterFunction($smarty, 'function', 'hook', 'smartyHook');
smartyRegisterFunction($smarty, 'function', 'toolsConvertPrice', 'toolsConvertPrice');
smartyRegisterFunction($smarty, 'modifier', 'json_encode', array('Tools', 'jsonEncode'));
smartyRegisterFunction($smarty, 'modifier', 'json_decode', array('Tools', 'jsonDecode'));
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
smartyRegisterFunction($smarty, 'function', 'convertPrice', array('Product', 'convertPrice'));
smartyRegisterFunction($smarty, 'function', 'convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency'));
@@ -196,6 +196,8 @@ class AdminAttachmentsControllerCore extends AdminController
$this->errors[] = $this->l('Failed to copy the file.');
$_POST['file_name'] = $_FILES['file']['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['mime'] = $_FILES['file']['type'];
}
@@ -211,11 +213,14 @@ class AdminAttachmentsControllerCore extends AdminController
'<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->validateRules();
}
return parent::postProcess();
$return = parent::postProcess();
if (!$return && isset($uniqid) && file_exists(_PS_DOWNLOAD_DIR_.$uniqid))
unlink(_PS_DOWNLOAD_DIR_.$uniqid);
return $return;
}
}
@@ -877,7 +877,7 @@ class AdminCarrierWizardControllerCore extends AdminController
$step_number = Tools::getValue('step_number');
if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive())
return array();
return array('fields' => array());
$step_fields = array(
1 => array('name', 'delay', 'grade', 'url'),
@@ -896,7 +896,7 @@ class AdminCarrierWizardControllerCore extends AdminController
foreach ($definition['fields'] as $field => $def)
if (!in_array($field, $step_fields[$step_number]))
unset($definition['fields'][$field]);
return $definition;
}
@@ -566,6 +566,8 @@ class AdminCartsControllerCore extends AdminController
if (count($summary['products']))
foreach ($summary['products'] as &$product)
{
$product['numeric_price'] = $product['price'];
$product['numeric_total'] = $product['total'];
$product['price'] = str_replace($currency->sign, '', Tools::displayPrice($product['price'], $currency));
$product['total'] = str_replace($currency->sign, '', Tools::displayPrice($product['total'], $currency));
$product['image_link'] = $this->context->link->getImageLink($product['link_rewrite'], $product['id_image'], 'small_default');
+20
View File
@@ -162,6 +162,26 @@ class AdminCmsControllerCore extends AdminController
'cols' => 40,
'hint' => $this->l('Invalid characters:').' <>;=#{}'
),
array(
'type' => 'switch',
'label' => $this->l('Indexation (by search engines):'),
'name' => 'indexation',
'required' => false,
'class' => 't',
'is_bool' => true,
'values' => array(
array(
'id' => 'indexation_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'indexation_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Displayed:'),
@@ -339,6 +339,8 @@ class AdminCurrenciesControllerCore extends AdminController
}
if (Tools::isSubmit('submitAddcurrency') && !Tools::getValue('id_currency') && Currency::exists(Tools::getValue('iso_code'), Tools::getValue('iso_code_num')))
$this->errors[] = Tools::displayError('This currency already exists.');
if (Tools::isSubmit('submitAddcurrency') && (float)Tools::getValue('conversion_rate') <= 0)
$this->errors[] = Tools::displayError('This currency conversion rate can not be equal to 0.');
parent::initProcess();
}
@@ -393,7 +393,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$contact = new Contact((int)$ct->id_contact, (int)$ct->id_lang);
if (Validate::isLoadedObject($contact))
{
$from_name = $contact->name[(int)$ct->id_lang];
$from_name = $contact->name;
$from_email = $contact->email;
}
else
@@ -401,6 +401,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
$from_name = null;
$from_email = null;
}
if (Mail::Send(
(int)$ct->id_lang,
'reply_msg',
@@ -641,6 +642,12 @@ class AdminCustomerThreadsControllerCore extends AdminController
ENT_QUOTES, 'UTF-8')
);
$is_valid_order_id = true;
$order = new Order((int)$message['id_order']);
if (!Validate::isLoadedObject($order))
$is_valid_order_id = false;
$tpl->assign(array(
'current' => self::$currentIndex,
'token' => $this->token,
@@ -651,7 +658,8 @@ class AdminCustomerThreadsControllerCore extends AdminController
'PS_SHOP_NAME' => Configuration::get('PS_SHOP_NAME'),
'file_name' => file_exists(_PS_UPLOAD_DIR_.$message['file_name']),
'contacts' => $contacts,
'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang']))
'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])),
'is_valid_order_id' => $is_valid_order_id
));
return $tpl->fetch();
+11 -7
View File
@@ -308,7 +308,7 @@ class AdminCustomersControllerCore extends AdminController
'name' => 'passwd',
'required' => ($obj->id ? false : true),
'col' => '4',
'hint' => ($obj->id ? $this->l('Leave this field blank if there\'s no change') : $this->l('Minimum of five characters (only letters and numbers).').' -_')
'hint' => ($obj->id ? $this->l('Leave this field blank if there\'s no change') : $this->l('Minimum of five characters'))
),
array(
'type' => 'birthday',
@@ -600,7 +600,7 @@ class AdminCustomersControllerCore extends AdminController
return;
$this->context->customer = $customer;
$gender = new Gender($customer->id_gender);
$gender = new Gender($customer->id_gender, $this->context->language->id);
$gender_image = $gender->getImage();
$customer_stats = $customer->getStats();
@@ -678,9 +678,10 @@ class AdminCustomersControllerCore extends AdminController
$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
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.'
AND cp.id_product NOT IN (
SELECT product_id
@@ -693,6 +694,8 @@ class AdminCustomersControllerCore extends AdminController
for ($i = 0; $i < $total_interested; $i++)
{
$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(
$product->id,
$product->link_rewrite,
@@ -706,15 +709,15 @@ class AdminCustomersControllerCore extends AdminController
}
$connections = $customer->getLastConnections();
if (!is_array($connections))
$connections = array();
$total_connections = count($connections);
for ($i = 0; $i < $total_connections; $i++)
{
$connections[$i]['date_add'] = Tools::displayDate($connections[$i]['date_add'],null , true);
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ?
preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) :
$this->l('Direct link');
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link');
}
$referrers = Referrer::getReferrers($customer->id);
$total_referrers = count($referrers);
for ($i = 0; $i < $total_referrers; $i++)
@@ -723,6 +726,7 @@ class AdminCustomersControllerCore extends AdminController
$shop = new Shop($customer->id_shop);
$this->tpl_view_vars = array(
'customer' => $customer,
'gender' => $gender,
'gender_image' => $gender_image,
// General information of the customer
+2 -1
View File
@@ -63,7 +63,8 @@ class AdminEmailsControllerCore extends AdminController
),
'js' => array(
1 => 'onclick="$(\'#smtp\').slideUp();"',
2 => 'onclick="$(\'#smtp\').slideDown();"'
2 => 'onclick="$(\'#smtp\').slideDown();"',
3 => 'onclick="$(\'#smtp\').slideUp();"'
),
'visibility' => Shop::CONTEXT_ALL
),
@@ -216,7 +216,7 @@ class AdminEmployeesControllerCore extends AdminController
'required' => true,
'hint' => ($obj->id ?
$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(
'type' => 'text',
+2 -2
View File
@@ -303,7 +303,7 @@ class AdminHomeControllerCore extends AdminController
public function getMonthlyStatistics()
{
$currency = Tools::setCurrency($this->context->cookie);
$currency = Tools::setCurrency((object)array('id_currency' => null));
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT IFNULL(SUM(`total_paid_real` / conversion_rate), "0") as total_sales, COUNT(*) as total_orders
FROM `'._DB_PREFIX_.'orders`
@@ -400,7 +400,7 @@ class AdminHomeControllerCore extends AdminController
$chart->getCurve(1)->setPoint(strtotime($row['invoice_date'].' 02:00:00'), $row['total_converted']);
$chart->setSize(580, 170);
$chart->setTimeMode(strtotime('-7 DAYS', time()), time(), 'd');
$currency = Tools::setCurrency($this->context->cookie);
$currency = Tools::setCurrency((object)array('id_currency' => null));
$chart->getCurve(1)->setLabel($this->l('Sales + Tax').' ('.strtoupper($currency->iso_code).')');
$content .= $chart->fetch();
+3 -2
View File
@@ -427,10 +427,11 @@ class AdminImagesControllerCore extends AdminController
if (!is_dir($dir))
return false;
$toDel = scandir($dir);
foreach ($toDel as $d)
foreach ($type as $imageType)
if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-(.*)\.jpg$/', $d))
if (file_exists($dir.$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))
unlink($dir.$d);
// delete product images using new filesystem.
+254 -107
View File
@@ -89,6 +89,7 @@ class AdminImportControllerCore extends AdminController
$this->l('Addresses'),
$this->l('Manufacturers'),
$this->l('Suppliers'),
$this->l('Alias'),
);
// @since 1.5.0
@@ -247,13 +248,13 @@ class AdminImportControllerCore extends AdminController
'delete_existing_images' => array(
'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)')),
'condition' => array('label' => $this->l('Condition')),
'customizable' => array('label' => $this->l('Customizable (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)')),
'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')),
'shop' => array(
'label' => $this->l('ID / Name of shop'),
@@ -306,7 +307,8 @@ class AdminImportControllerCore extends AdminController
'firstname' => array('label' => $this->l('First Name *')),
'newsletter' => array('label' => $this->l('Newsletter (0/1)')),
'optin' => array('label' => $this->l('Opt-in (0/1)')),
'group' => array('label' => $this->l('Groupe Name')),
'group' => array('label' => $this->l('Groups (x,y,z...)')),
'id_default_group' => array('label' => $this->l('Default group ID')),
'id_shop' => array(
'label' => $this->l('ID / Name of 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.'),
@@ -361,7 +363,6 @@ class AdminImportControllerCore extends AdminController
'postcode' => 'X'
);
break;
case $this->entities[$this->l('Manufacturers')]:
case $this->entities[$this->l('Suppliers')]:
//Overwrite validators AS name is not MultiLangField
@@ -383,6 +384,7 @@ class AdminImportControllerCore extends AdminController
'meta_title' => array('label' => $this->l('Meta title')),
'meta_keywords' => array('label' => $this->l('Meta keywords')),
'meta_description' => array('label' => $this->l('Meta description')),
'image' => array('label' => $this->l('Image URL')),
'shop' => array(
'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.'),
@@ -393,6 +395,23 @@ class AdminImportControllerCore extends AdminController
'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')),
);
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
@@ -456,9 +475,8 @@ class AdminImportControllerCore extends AdminController
}
$this->separator = substr(strval(trim(Tools::getValue('separator', ';'))), 0, 1);
$this->multiple_value_separator = substr(strval(trim(Tools::getValue('multiple_value_separator', ','))), 0, 1);
$this->separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator : ';';
$this->multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : ',';
parent::__construct();
}
@@ -508,11 +526,11 @@ class AdminImportControllerCore extends AdminController
if (isset($this->context->cookie->iso_lang_selected) && $this->context->cookie->iso_lang_selected)
$id_lang_selected = (int)Language::getIdByIso(base64_decode($this->context->cookie->iso_lang_selected));
$separator_selected = $this->multiple_value_separator;
$separator_selected = $this->separator;
if (isset($this->context->cookie->separator_selected) && $this->context->cookie->separator_selected)
$separator_selected = base64_decode($this->context->cookie->separator_selected);
$multiple_value_separator_selected = $this->separator;
$multiple_value_separator_selected = $this->multiple_value_separator;
if (isset($this->context->cookie->multiple_value_separator_selected) && $this->context->cookie->multiple_value_separator_selected)
$multiple_value_separator_selected = base64_decode($this->context->cookie->multiple_value_separator_selected);
@@ -553,8 +571,8 @@ class AdminImportControllerCore extends AdminController
$this->context->cookie->entity_selected = (int)Tools::getValue('entity');
$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->multiple_value_separator_selected = base64_encode(Tools::getValue('multiple_value_separator'));
$this->context->cookie->separator_selected = base64_encode($this->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->tpl_view_vars = array(
@@ -633,7 +651,7 @@ class AdminImportControllerCore extends AdminController
$html .= '<tr id="table_'.$current_table.'_line_'.$current_line.'" style="padding: 4px">';
foreach ($line as $nb_c => $column)
if ((MAX_COLUMNS * (int)$current_table <= $nb_c) && ((int)$nb_c < MAX_COLUMNS * ((int)$current_table + 1)))
$html .= '<td>'.htmlentities(substr($column, 0, 200), ENT_QUOTES, 'UTF-8').'</td>';
$html .= '<td>'.htmlentities(Tools::substr($column, 0, 200), ENT_QUOTES, 'UTF-8').'</td>';
$html .= '</tr>';
}
$html .= '</table>';
@@ -676,6 +694,8 @@ class AdminImportControllerCore extends AdminController
protected static function rewindBomAware($handle)
{
// A rewind wrapper that skip BOM signature wrongly
if (!is_resource($handle))
return false;
rewind($handle);
if (($bom = fread($handle, 3)) != "\xEF\xBB\xBF")
rewind($handle);
@@ -871,6 +891,12 @@ class AdminImportControllerCore extends AdminController
case 'categories':
$path = _PS_CAT_IMG_DIR_.(int)$id_entity;
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));
@@ -947,7 +973,7 @@ class AdminImportControllerCore extends AdminController
}
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'])
{
$category->id_parent = (int)$category_parent['id_category'];
@@ -968,7 +994,7 @@ class AdminImportControllerCore extends AdminController
{
$this->errors[] = sprintf(
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'
);
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
@@ -1010,8 +1036,8 @@ class AdminImportControllerCore extends AdminController
($lang_field_error = $category->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && empty($this->errors))
{
$category_already_created = Category::searchByNameAndParentCategoryId(
$default_language_id,
$category->name[$default_language_id],
$id_lang,
$category->name[$id_lang],
$category->id_parent
);
@@ -1074,11 +1100,11 @@ class AdminImportControllerCore extends AdminController
// Get shops for each attributes
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
foreach ($info['shop'] as $shop)
if (!is_numeric($shop))
if (!empty($shop) && !is_numeric($shop))
$category->addShop(Shop::getIdByName($shop));
else
elseif (!empty($shop))
$category->addShop($shop);
}
}
@@ -1126,7 +1152,7 @@ class AdminImportControllerCore extends AdminController
else
$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();
$category_data = Product::getProductCategories((int)$product->id);
@@ -1150,9 +1176,9 @@ class AdminImportControllerCore extends AdminController
// link product to shops
$product->id_shop_list = array();
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);
else
elseif (!empty($shop))
$product->id_shop_list[] = $shop;
if ((int)$product->id_tax_rules_group != 0)
@@ -1275,7 +1301,7 @@ class AdminImportControllerCore extends AdminController
}
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'])
$product->id_category[] = (int)$category['id_category'];
else
@@ -1393,8 +1419,10 @@ class AdminImportControllerCore extends AdminController
$product_shop = explode($this->multiple_value_separator, $product->shop);
foreach ($product_shop as $shop)
{
if (empty($shop))
continue;
$shop = trim($shop);
if (!is_numeric($shop))
if (!empty($shop) && !is_numeric($shop))
$shop = Shop::getIdByName($shop);
if (in_array($shop, $shop_ids))
@@ -1446,36 +1474,36 @@ class AdminImportControllerCore extends AdminController
$id_shop_list = array();
foreach ($info['shop'] as $shop)
if (!is_numeric($shop))
if (!empty($shop) && !is_numeric($shop))
$id_shop_list[] = (int)Shop::getIdByName($shop);
else
elseif (!empty($shop))
$id_shop_list[] = $shop;
if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0))
foreach($id_shop_list as $id_shop)
{
$specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 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)
{
$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']))
$specific_price = new SpecificPrice((int)$specific_price['id_specific_price']);
else
$specific_price = new SpecificPrice();
$specific_price->id_product = (int)$product->id;
$specific_price->id_specific_price_rule = 0;
$specific_price->id_shop = $id_shop;
$specific_price->id_currency = 0;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->price = -1;
$specific_price->id_customer = 0;
$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_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->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00';
if (!$specific_price->save())
$this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
}
if (is_array($specific_price) && isset($specific_price['id_specific_price']))
$specific_price = new SpecificPrice((int)$specific_price['id_specific_price']);
else
$specific_price = new SpecificPrice();
$specific_price->id_product = (int)$product->id;
$specific_price->id_specific_price_rule = 0;
$specific_price->id_shop = $id_shop;
$specific_price->id_currency = 0;
$specific_price->id_country = 0;
$specific_price->id_group = 0;
$specific_price->price = -1;
$specific_price->id_customer = 0;
$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_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->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00';
if (!$specific_price->save())
$this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid'));
}
if (isset($product->tags) && !empty($product->tags))
{
@@ -1489,7 +1517,8 @@ class AdminImportControllerCore extends AdminController
if (is_array($product->tags) && count($product->tags))
{
foreach ($product->tags as $key => $tag)
$product->tags[$key] = trim($tag);
if (!empty($tag))
$product->tags[$key] = trim($tag);
$tags[$id_lang] = $product->tags;
$product->tags = $tags;
}
@@ -1497,7 +1526,7 @@ class AdminImportControllerCore extends AdminController
}
// Delete tags for this id product, for no duplicating error
Tag::deleteTagsForProduct($product->id);
if (!is_array($product->tags))
if (!is_array($product->tags) && !empty($product->tags))
{
$product->tags = AdminImportController::createMultiLangField($product->tags);
foreach ($product->tags as $key => $tags)
@@ -1581,14 +1610,20 @@ class AdminImportControllerCore extends AdminController
if (isset($features['features']) && !empty($features['features']))
foreach (explode($this->multiple_value_separator, $features['features']) as $single_feature)
{
if (empty($single_feature))
continue;
$tab_feature = explode(':', $single_feature);
$feature_name = trim($tab_feature[0]);
$feature_value = trim($tab_feature[1]);
$position = isset($tab_feature[2]) ? $tab_feature[2]: false;
$feature_name = isset($tab_feature[0]) ? trim($tab_feature[0]) : '';
$feature_value = isset($tab_feature[1]) ? trim($tab_feature[1]) : '';
$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))
{
$id_feature = Feature::addFeatureImport($feature_name, $position);
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value, $product->id, $id_lang);
$id_feature = (int)Feature::addFeatureImport($feature_name, $position);
$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);
}
}
@@ -1606,7 +1641,6 @@ class AdminImportControllerCore extends AdminController
StockAvailable::setQuantity((int)$product->id, 0, $product->quantity, $this->context->shop->id);
}
$this->closeCsvFile($handle);
}
@@ -1646,11 +1680,12 @@ class AdminImportControllerCore extends AdminController
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
$id_shop_list = array();
foreach ($info['shop'] as $shop)
if (!is_numeric($shop))
$id_shop_list[] = Shop::getIdByName($shop);
else
$id_shop_list[] = $shop;
if (is_array($info['shop']) && count($info['shop']))
foreach ($info['shop'] as $shop)
if (!empty($shop) && !is_numeric($shop))
$id_shop_list[] = Shop::getIdByName($shop);
elseif (!empty($shop))
$id_shop_list[] = $shop;
if(isset($info['id_product']))
$product = new Product((int)$info['id_product'], false, $default_language);
@@ -1724,12 +1759,14 @@ class AdminImportControllerCore extends AdminController
if(isset($info['group']))
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group)
{
if (empty($group))
continue;
$tab_group = explode(':', $group);
$group = trim($tab_group[0]);
if (!isset($tab_group[1]))
$type = 'select';
else
$type = trim($tab_group[1]);
$type = trim($tab_group[1]);
// sets group
$groups_attributes[$key]['group'] = $group;
@@ -1779,6 +1816,8 @@ class AdminImportControllerCore extends AdminController
if(isset($info['attribute']))
foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute)
{
if (empty($attribute))
continue;
$tab_attribute = explode(':', $attribute);
$attribute = trim($tab_attribute[0]);
// if position is filled
@@ -1925,6 +1964,9 @@ class AdminImportControllerCore extends AdminController
$this->receiveTab();
$handle = $this->openCsvFile();
$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();
for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++)
{
@@ -1952,31 +1994,45 @@ class AdminImportControllerCore extends AdminController
$customer_exist = true;
$customer_groups = $customer->getGroups();
$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]);
}
// Group Importation
if (isset($info['group']) && !empty($info['group']))
{
if (!isset($customer_groups))
$customer_groups = array();
$myGroup = Group::searchByName($default_language_id, $info['group']);
if (!$myGroup)
foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group)
{
$myGroup = new Group();
$myGroup->name = Array($default_language_id => $info['group']);
$myGroup->price_display_method = 1;
$myGroup->add();
$myGroup = Group::searchByName($default_language_id, $info['group']);
$group = trim($group);
if(empty($group))
continue;
$id_group = false;
if (is_numeric($group) && $group)
{
$myGroup = new Group((int)$group);
if (Validate::isLoadedObject($myGroup))
$customer_groups[] = (int)$group;
continue;
}
$myGroup = Group::searchByName($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);
if ($customer->passwd)
@@ -1990,6 +2046,8 @@ class AdminImportControllerCore extends AdminController
{
foreach ($id_shop_list as $id_shop)
{
if (empty($id_shop))
continue;
$shop = new Shop((int)$id_shop);
$group_shop = $shop->getGroup();
if ($group_shop->share_customer)
@@ -2011,7 +2069,18 @@ class AdminImportControllerCore extends AdminController
//set temporally for validate field
$customer->id_shop = $default_shop->id;
$customer->id_shop_group = $default_shop->getGroup()->id;
if (isset($info['id_default_group']) && !empty($info['id_default_group']) && !is_numeric($info['id_default_group']))
{
$info['id_default_group'] = trim($info['id_default_group']);
$myGroup = Group::searchByName($info['id_default_group']);
if (isset($myGroup['id_group']) && $myGroup['id_group'])
$info['id_default_group'] = (int)$myGroup['id_group'];
}
$myGroup = new Group($customer->id_default_group);
if (!Validate::isLoadedObject($myGroup))
$customer->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
$customer_groups[] = (int)$customer->id_default_group;
$customer_groups = array_flip(array_flip($customer_groups));
$res = true;
if (($field_error = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true &&
($lang_field_error = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
@@ -2029,12 +2098,9 @@ class AdminImportControllerCore extends AdminController
$customer->id = $current_id_customer;
$res &= $customer->update();
}
else
{
$res &= $customer->add();
if (isset($customer_groups))
$customer->addGroups($customer_groups);
if (isset($addresses))
foreach ($addresses as $address)
{
@@ -2043,6 +2109,8 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->insert('address', $address);
}
}
if ($res && isset($customer_groups))
$customer->updateGroup($customer_groups);
}
}
else
@@ -2057,8 +2125,6 @@ class AdminImportControllerCore extends AdminController
else
{
$res &= $customer->add();
if (isset($customer_groups))
$customer->addGroups($customer_groups);
if (isset($addresses))
foreach ($addresses as $address)
{
@@ -2067,9 +2133,12 @@ class AdminImportControllerCore extends AdminController
Db::getInstance()->insert('address', $address);
}
}
if ($res && isset($customer_groups))
$customer->updateGroup($customer_groups);
}
}
}
unset($customer_groups);
$customer_exist = false;
if (!$res)
{
@@ -2116,7 +2185,7 @@ class AdminImportControllerCore extends AdminController
$country->active = 1;
$country->name = AdminImportController::createMultiLangField($address->country);
$country->id_zone = 0; // Default zone for country to create
$country->iso_code = strtoupper(substr($address->country, 0, 2)); // Default iso for country to create
$country->iso_code = Tools::strtoupper(Tools::substr($address->country, 0, 2)); // Default iso for country to create
$country->contains_states = 0; // Default value for country to create
$lang_field_error = $country->validateFieldsLang(UNFRIENDLY_ERROR, true);
if (($field_error = $country->validateFields(UNFRIENDLY_ERROR, true)) === true &&
@@ -2147,7 +2216,7 @@ class AdminImportControllerCore extends AdminController
$state->name = $address->state;
$state->id_country = isset($country->id) ? (int)$country->id : 0;
$state->id_zone = 0; // Default zone for state to create
$state->iso_code = strtoupper(substr($address->state, 0, 2)); // Default iso for state to create
$state->iso_code = Tools::strtoupper(Tools::substr($address->state, 0, 2)); // Default iso for state to create
$state->tax_behavior = 0;
if (($field_error = $state->validateFields(UNFRIENDLY_ERROR, true)) === true &&
($lang_field_error = $state->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && $state->add())
@@ -2332,6 +2401,11 @@ class AdminImportControllerCore extends AdminController
if (!$res)
$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)
{
// Associate supplier to group shop
@@ -2345,6 +2419,8 @@ class AdminImportControllerCore extends AdminController
$shops = array();
foreach ($manufacturer->shop as $shop)
{
if (empty($shop))
continue;
$shop = trim($shop);
if (!is_numeric($shop))
$shop = ShopGroup::getIdByName($shop);
@@ -2403,6 +2479,11 @@ class AdminImportControllerCore extends AdminController
if (!$res)
$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)
$this->errors[] = Db::getInstance()->getMsgError().' '.sprintf(
Tools::displayError('%1$s (ID: %2$s) cannot be saved'),
@@ -2422,6 +2503,8 @@ class AdminImportControllerCore extends AdminController
$shops = array();
foreach ($supplier->shop as $shop)
{
if (empty($shop))
continue;
$shop = trim($shop);
if (!is_numeric($shop))
$shop = ShopGroup::getIdByName($shop);
@@ -2440,6 +2523,56 @@ class AdminImportControllerCore extends AdminController
$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
*/
@@ -2479,34 +2612,32 @@ class AdminImportControllerCore extends AdminController
$date_delivery_expected = pSQL($info['date_delivery_expected']);
$discount_rate = (float)$info['discount_rate'];
$is_template = (bool)$info['is_template'];
$error = '';
// checks parameters
if (!Supplier::supplierExists($id_supplier))
$this->errors[] = sprintf($this->l('Supplier ID (%d) is not valid (at line %d).'), $id_supplier, $current_line + 1);
$error = sprintf($this->l('Supplier ID (%d) is not valid (at line %d).'), $id_supplier, $current_line + 1);
if (!Language::getLanguage($id_lang))
$this->errors[] = sprintf($this->l('Lang ID (%d) is not valid (at line %d).'), $id_lang, $current_line + 1);
$error = sprintf($this->l('Lang ID (%d) is not valid (at line %d).'), $id_lang, $current_line + 1);
if (!Warehouse::exists($id_warehouse))
$this->errors[] = sprintf($this->l('Warehouse ID (%d) is not valid (at line %d).'), $id_warehouse, $current_line + 1);
$error = sprintf($this->l('Warehouse ID (%d) is not valid (at line %d).'), $id_warehouse, $current_line + 1);
if (!Currency::getCurrency($id_currency))
$this->errors[] = sprintf($this->l('Currency ID (%d) is not valid (at line %d).'), $id_currency, $current_line + 1);
$error = sprintf($this->l('Currency ID (%d) is not valid (at line %d).'), $id_currency, $current_line + 1);
if (empty($supply_order->reference) && SupplyOrder::exists($reference))
$this->errors[] = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
$error = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
if (!empty($supply_order->reference) && ($supply_order->reference != $reference && SupplyOrder::exists($reference)))
$this->errors[] = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
$error = sprintf($this->l('Reference (%s) already exists (at line %d).'), $reference, $current_line + 1);
if (!Validate::isDateFormat($date_delivery_expected))
$this->errors[] = sprintf($this->l('Date (%s) is not valid (at line %d). Format: %s.'), $date_delivery_expected,
$current_line + 1, $this->l('YYYY-MM-DD'));
$error = sprintf($this->l('Date (%s) is not valid (at line %d). Format: %s.'), $date_delivery_expected, $current_line + 1, $this->l('YYYY-MM-DD'));
else if (new DateTime($date_delivery_expected) <= new DateTime('yesterday'))
$this->errors[] = sprintf($this->l('Date (%s) cannot be in the past (at line %d). Format: %s.'), $date_delivery_expected,
$current_line + 1, $this->l('YYYY-MM-DD'));
$error = sprintf($this->l('Date (%s) cannot be in the past (at line %d). Format: %s.'), $date_delivery_expected, $current_line + 1, $this->l('YYYY-MM-DD'));
if ($discount_rate < 0 || $discount_rate > 100)
$this->errors[] = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate,
$current_line + 1, $this->l('Format: Between 0 and 100'));
$error = sprintf($this->l('Discount rate (%d) is not valid (at line %d). %s.'), $discount_rate, $current_line + 1, $this->l('Format: Between 0 and 100'));
if ($supply_order->id > 0 && !$supply_order->isEditable())
$this->errors[] = sprintf($this->l('Supply Order (%d) is not editable (at line %d).'), $supply_order->id, $current_line + 1);
$error = sprintf($this->l('Supply Order (%d) is not editable (at line %d).'), $supply_order->id, $current_line + 1);
// if no errors, sets supply order
if (empty($this->errors))
if (empty($error))
{
// adds parameters
$info['id_ref_currency'] = (int)Currency::getDefaultCurrency()->id;
@@ -2523,8 +2654,10 @@ class AdminImportControllerCore extends AdminController
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $supply_order);
// updatesd($supply_order);
$res = true;
if ($supply_order->id > 0)
if ((int)$supply_order->id && ($supply_order->exists((int)$supply_order->id) || $supply_order->exists($supply_order->reference)))
$res &= $supply_order->update();
else
$res &= $supply_order->add();
@@ -2533,6 +2666,8 @@ class AdminImportControllerCore extends AdminController
if (!$res)
$this->errors[] = sprintf($this->l('Supply Order could not be saved (at line %d).'), $current_line + 1);
}
else
$this->errors[] = $error;
}
// closes
@@ -2658,6 +2793,8 @@ class AdminImportControllerCore extends AdminController
protected function getNbrColumn($handle, $glue)
{
if (!is_resource($handle))
return false;
$tmp = fgetcsv($handle, MAX_LINE_SIZE, $glue);
AdminImportController::rewindBomAware($handle);
return count($tmp);
@@ -2672,7 +2809,10 @@ class AdminImportControllerCore extends AdminController
protected function openCsvFile()
{
$handle = fopen(_PS_ADMIN_DIR_.'/import/'.strval(preg_replace('/\.{2,}/', '.', Tools::getValue('csv'))), 'r');
$file = _PS_ADMIN_DIR_.'/import/'.strval(preg_replace('/\.{2,}/', '.', Tools::getValue('csv')));
$handle = false;
if (is_file($file) && is_readable($file))
$handle = fopen($file, 'r');
if (!$handle)
$this->errors[] = Tools::displayError('Cannot read the .CSV file');
@@ -2787,6 +2927,9 @@ class AdminImportControllerCore extends AdminController
if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d))
unlink(_PS_SUPP_IMG_DIR_.$d);
break;
case $this->entities[$this->l('Alias')]:
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'alias`');
break;
}
Image::clearTmpDir();
return true;
@@ -2811,7 +2954,7 @@ class AdminImportControllerCore extends AdminController
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']))
{
switch ($_FILES['file']['error'])
@@ -2885,6 +3028,9 @@ class AdminImportControllerCore extends AdminController
$this->supplierImport();
$this->clearSmartyCache();
break;
case $this->entities[$import_type = $this->l('Alias')]:
$this->aliasImport();
break;
}
// @since 1.5.0
@@ -3002,3 +3148,4 @@ class AdminImportControllerCore extends AdminController
}
}
}
?>
+8 -1
View File
@@ -225,6 +225,12 @@ class AdminMetaControllerCore extends AdminController
public function renderForm()
{
$files = Meta::getPages(true, ($this->object->page ? $this->object->page : false));
$is_index = false;
foreach ($this->object->url_rewrite as $rewrite)
if($is_index != true)
$is_index = ($this->object->page == 'index' && empty($rewrite)) ? true : false;
$pages = array(
'common' => array(
'name' => $this->l('Default pages'),
@@ -312,6 +318,7 @@ class AdminMetaControllerCore extends AdminController
'name' => 'url_rewrite',
'lang' => true,
'required' => true,
'disabled' => (bool)$is_index,
'hint' => array(
$this->l('Only letters and hyphens are allowed'),
$this->l('e.g. "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php'),
@@ -404,7 +411,7 @@ class AdminMetaControllerCore extends AdminController
{
fwrite($write_fd, "# Directories\n");
foreach ($this->rb_data['Directories'] as $dir)
fwrite($write_fd, 'Disallow: /*'.$dir."\n");
fwrite($write_fd, 'Disallow: */'.$dir."\n");
}
// Files
+1 -1
View File
@@ -829,7 +829,7 @@ class AdminModulesControllerCore extends AdminController
if (count($module_errors))
{
$html_error = '<ul style="line-height:20px">';
$html_error = '<ul>';
foreach ($module_errors as $module_error)
{
$html_error_description = '';
+3 -3
View File
@@ -317,7 +317,7 @@ class AdminOrdersControllerCore extends AdminController
'{shipping_number}' => $order->shipping_number,
'{order_name}' => $order->getUniqReference()
);
if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit'), $templateVars,
if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars,
$customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null,
_PS_MAIL_DIR_, true, (int)$order->id_shop))
{
@@ -715,7 +715,7 @@ class AdminOrdersControllerCore extends AdminController
@Mail::Send(
(int)$order->id_lang,
'credit_slip',
Mail::l('New credit slip regarding your order', $order->id_lang),
Mail::l('New credit slip regarding your order', (int)$order->id_lang),
$params,
$customer->email,
$customer->firstname.' '.$customer->lastname,
@@ -1884,7 +1884,7 @@ class AdminOrdersControllerCore extends AdminController
Mail::Send(
(int)$order->id_lang,
'order_changed',
Mail::l('Your order has been changed', $order->id_lang),
Mail::l('Your order has been changed', (int)$order->id_lang),
$data,
$order->getCustomer()->email,
$order->getCustomer()->firstname.' '.$order->getCustomer()->lastname,
@@ -145,7 +145,6 @@ class AdminPPreferencesControllerCore extends AdminController
'fields' => array(
'PS_DISPLAY_QTIES' => array(
'title' => $this->l('Display available quantities on the product page'),
'hint' => '',
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
@@ -161,7 +160,6 @@ class AdminPPreferencesControllerCore extends AdminController
),
'PS_DISPLAY_JQZOOM' => array(
'title' => $this->l('Enable JqZoom instead of Thickbox on the product page'),
'hint' => '',
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
@@ -169,7 +167,6 @@ class AdminPPreferencesControllerCore extends AdminController
),
'PS_DISP_UNAVAILABLE_ATTR' => array(
'title' => $this->l('Display unavailable product attributes on the product page'),
'hint' => '',
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
@@ -206,7 +203,6 @@ class AdminPPreferencesControllerCore extends AdminController
),
'PS_STOCK_MANAGEMENT' => array(
'title' => $this->l('Enable stock management'),
'hint' => '',
'validation' => 'isBool',
'cast' => 'intval',
'required' => false,
@@ -129,9 +129,68 @@ class AdminPerformanceControllerCore extends AdminController
$this->fields_value['smarty_console_key'] = Configuration::get('PS_SMARTY_CONSOLE_KEY');
}
public function initFieldsetFeaturesDetachables()
public function initFieldsetDebugMode()
{
$this->fields_form[1]['form'] = array(
'legend' => array(
'title' => $this->l('Debug mode'),
'image' => '../img/admin/prefs.gif'
),
'input' => array(
array(
'type' => 'radio',
'label' => $this->l('Disable non PrestaShop modules'),
'name' => 'native_module',
'class' => 't',
'is_bool' => true,
'values' => array(
array(
'id' => 'native_module_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'native_module_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
'desc' => $this->l('Enable or disable non PrestaShop Modules.')
),
array(
'type' => 'radio',
'label' => $this->l('Disable all overrides'),
'name' => 'overrides',
'class' => 't',
'is_bool' => true,
'values' => array(
array(
'id' => 'overrides_module_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'overrides_module_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
'desc' => $this->l('Enable or disable all classes and controllers overrides')
),
),
'submit' => array(
'title' => $this->l(' Save '),
'class' => 'button'
),
);
$this->fields_value['native_module'] = Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
$this->fields_value['overrides'] = Configuration::get('PS_DISABLE_OVERRIDES');
}
public function initFieldsetFeaturesDetachables()
{
$this->fields_form[2]['form'] = array(
'legend' => array(
'title' => $this->l('Optional features'),
'icon' => 'icon-puzzle-piece'
@@ -190,7 +249,7 @@ class AdminPerformanceControllerCore extends AdminController
public function initFieldsetCCC()
{
$this->fields_form[2]['form'] = array(
$this->fields_form[3]['form'] = array(
'legend' => array(
'title' => $this->l('CCC (Combine, Compress and Cache)'),
'icon' => 'icon-fullscreen'
@@ -300,7 +359,7 @@ class AdminPerformanceControllerCore extends AdminController
public function initFieldsetMediaServer()
{
$this->fields_form[3]['form'] = array(
$this->fields_form[4]['form'] = array(
'legend' => array(
'title' => $this->l('Media servers (use only with CCC)'),
'icon' => 'icon-link'
@@ -346,7 +405,8 @@ class AdminPerformanceControllerCore extends AdminController
$warning_mcrypt = str_replace('[a]', '<a href="http://www.php.net/manual/'.substr($php_lang, 0, 2).'/book.mcrypt.php" target="_blank">', $warning_mcrypt);
$warning_mcrypt = str_replace('[/a]', '</a>', $warning_mcrypt);
$this->fields_form[4]['form'] = array(
$this->fields_form[5]['form'] = array(
'legend' => array(
'title' => $this->l('Ciphering'),
'icon' => 'icon-desktop'
@@ -399,7 +459,7 @@ class AdminPerformanceControllerCore extends AdminController
$warning_fs = ' '.sprintf($this->l('(the directory %s must be writable)'), realpath(_PS_CACHEFS_DIRECTORY_));
$this->fields_form[5]['form'] = array(
$this->fields_form[6]['form'] = array(
'legend' => array(
'title' => $this->l('Caching'),
'icon' => 'icon-desktop'
@@ -481,12 +541,19 @@ class AdminPerformanceControllerCore extends AdminController
{
// Initialize fieldset for a form
$this->initFieldsetSmarty();
if (_PS_MODE_DEV_)
$this->initFieldsetDebugMode();
$this->initFieldsetFeaturesDetachables();
$this->initFieldsetCCC();
$this->initFieldsetMediaServer();
$this->initFieldsetCiphering();
$this->initFieldsetCaching();
// Reindex fields
$this->fields_form = array_values($this->fields_form);
// Activate multiple fieldset
$this->multiple_fieldsets = true;
@@ -781,6 +848,17 @@ class AdminPerformanceControllerCore extends AdminController
Autoload::getInstance()->generateIndex();
}
if (Tools::isSubmit('submitAddconfiguration') && _PS_MODE_DEV_)
{
Configuration::updateGlobalValue('PS_DISABLE_NON_NATIVE_MODULE', (int)Tools::getValue('native_module'));
Configuration::updateGlobalValue('PS_DISABLE_OVERRIDES', (int)Tools::getValue('overrides'));
if (Tools::getValue('overrides'))
Autoload::getInstance()->_include_override_path = false;
Autoload::getInstance()->generateIndex();
}
if ($redirectAdmin && (!isset($this->errors) || !count($this->errors)))
{
Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => ''));
+25 -7
View File
@@ -180,7 +180,7 @@ class AdminProductsControllerCore extends AdminController
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.')';
$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`';
if ($join_category)
@@ -331,12 +331,17 @@ class AdminProductsControllerCore extends AdminController
$nb = count($this->_list);
if ($this->_list)
{
$context = $this->context->cloneContext();
$context->shop = clone($context->shop);
/* update product final price */
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
$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);
}
}
@@ -367,9 +372,9 @@ class AdminProductsControllerCore extends AdminController
{
if (is_array($default_product->$field_name))
foreach ($default_product->$field_name as $key => $value)
$this->object->{$field_name}[$key] = ObjectModel::formatValue($value, $def['fields'][$field_name]['type']);
$this->object->{$field_name}[$key] = $value;
else
$this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']);
$this->object->$field_name = $default_product->$field_name;
}
}
$this->object->loadStockData();
@@ -1337,7 +1342,6 @@ class AdminProductsControllerCore extends AdminController
if (isset($result['success']))
{
$obj = new Image((int)$result['success']['id_image']);
// Associate image to shop from context
$shops = Shop::getContextListShopID();
$obj->associateTo($shops);
@@ -1351,6 +1355,7 @@ class AdminProductsControllerCore extends AdminController
'id'=>$obj->id,
'path' => $obj->getExistingImgPath(),
'position' => $obj->position,
'legend' => $obj->legend,
'cover' => $obj->cover,
'shops' => $json_shops,
);
@@ -3676,6 +3681,7 @@ class AdminProductsControllerCore extends AdminController
foreach ($images as $k => $image)
$images[$k] = new Image($image['id_image']);
if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP)
$current_shop_id = (int)$this->context->shop->id;
else
@@ -3694,8 +3700,16 @@ class AdminProductsControllerCore extends AdminController
'max_image_size' => $this->max_image_size / 1024 / 1024,
'up_filename' => (string)Tools::getValue('virtual_product_filename_attribute'),
'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
$this->displayWarning($this->l('You must save the product in this shop before adding images.'));
@@ -3752,7 +3766,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');
$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);
foreach ($images as $k => $image)
{
@@ -69,9 +69,9 @@ class AdminSearchConfControllerCore extends AdminController
</p>
<p>'.$this->l('Building the product index may take a few minutes.')
.$this->l('If your server stops before the process ends, you can resume the indexation by clicking "Add missing products."').'</p>
<a href="searchcron.php?token='.substr(_COOKIE_KEY_, 34, 8).'&redirect=1" class="btn btn-link"><i class="icon-external-link-sign"></i> '.
<a href="searchcron.php?token='.substr(_COOKIE_KEY_, 34, 8).'&redirect=1" class="btn-link"><i class="icon-external-link-sign"></i> '.
$this->l('Add missing products to the index.').'</a><br />
<a href="searchcron.php?full=1&token='.substr(_COOKIE_KEY_, 34, 8).'&redirect=1" class="btn btn-link"><i class="icon-external-link-sign"></i> '.
<a href="searchcron.php?full=1&token='.substr(_COOKIE_KEY_, 34, 8).'&redirect=1" class="btn-link"><i class="icon-external-link-sign"></i> '.
$this->l('Re-build the entire index.').'</a><br /><br />
'.$this->l('You can set a cron job that will rebuild your index using the following URL:').' <a href="'.$cron_url.'"><i class="icon-external-link-sign"></i> '.$cron_url.'</a>',
'fields' => array(
+11 -1
View File
@@ -26,7 +26,6 @@
class AdminSearchControllerCore extends AdminController
{
public function __construct()
{
$this->bootstrap = true;
@@ -197,6 +196,15 @@ class AdminSearchControllerCore extends AdminController
$module->linkto = 'index.php?tab=AdminModules&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name).'&token='.Tools::getAdminTokenLite('AdminModules');
$this->_list['modules'][] = $module;
}
$vars = http_build_query(array(
'version' => _PS_VERSION_,
'iso_lang' => Tools::strtolower(Context::getContext()->language->iso_code),
'iso_code' => Tools::strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
'search_query' => $this->query
));
if (($json_content = Tools::file_get_contents('https://api.addons.prestashop.com/search.php?'.$vars)) != false)
$this->_list['addons'] = Tools::jsonDecode($json_content, true);
}
/**
@@ -408,6 +416,8 @@ class AdminSearchControllerCore extends AdminController
if (isset($this->_list['modules']) && count($this->_list['modules']))
$this->tpl_view_vars['modules'] = $this->_list['modules'];
if (isset($this->_list['addons']) && count($this->_list['addons']))
$this->tpl_view_vars['addons'] = $this->_list['addons'];
return parent::renderView();
}
+2 -2
View File
@@ -103,8 +103,8 @@ class AdminStatsControllerCore extends AdminStatsTabController
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'module` m
'.Shop::addSqlAssociation('module', 'm', true).'
WHERE m.active = 1');
'.Shop::addSqlAssociation('module', 'm', false).'
WHERE module_shop.id_module IS NULL OR m.active = 0');
}
public static function getModulesToUpdate()
@@ -1410,7 +1410,9 @@ class AdminSupplyOrdersControllerCore extends AdminController
true,
$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.'));
$location = Warehouse::getProductLocation($supply_order_detail->id_product,
@@ -1259,6 +1259,8 @@ class AdminTranslationsControllerCore extends AdminController
// Set the path of selected theme
if ($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
if (($type = Tools::getValue('type')) && !is_array($type))
+10 -8
View File
@@ -227,19 +227,19 @@ class AddressControllerCore extends FrontController
else // Update cart address
$this->context->cart->autosetProductAddress();
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->update();
}
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;
elseif (Configuration::get('PS_ORDER_PROCESS_TYPE'))
$this->context->cart->id_address_invoice = (int)$this->context->cart->id_address_delivery;
$this->context->cart->update();
if ($this->ajax)
{
$return = array(
'hasError' => (bool)$this->errors,
'errors' => $this->errors,
'id_address_delivery' => $this->context->cart->id_address_delivery,
'id_address_invoice' => $this->context->cart->id_address_invoice
'id_address_delivery' => (int)$this->context->cart->id_address_delivery,
'id_address_invoice' => (int)$this->context->cart->id_address_invoice
);
die(Tools::jsonEncode($return));
}
@@ -247,6 +247,8 @@ class AddressControllerCore extends FrontController
// Redirect to old page or current page
if ($back = Tools::getValue('back'))
{
if ($back == Tools::secureReferrer(Tools::getValue('back')))
Tools::redirect(html_entity_decode($back));
$mod = Tools::getValue('mod');
Tools::redirect('index.php?controller='.$back.($mod ? '&back='.$mod : ''));
}
+132 -110
View File
@@ -94,7 +94,7 @@ class AuthControllerCore extends FrontController
if (!empty($key))
$back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key;
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'))
{
@@ -329,7 +329,7 @@ class AuthControllerCore extends FrontController
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('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account'));
}
@@ -394,7 +394,10 @@ class AuthControllerCore extends FrontController
$firstnameAddress = Tools::getValue('firstname');
$_POST['lastname'] = Tools::getValue('customer_lastname');
$_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;
if (Configuration::get('PS_ONE_PHONE_AT_LEAST'))
{
@@ -404,10 +407,8 @@ class AuthControllerCore extends FrontController
$error_phone = true;
}
elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE'))
|| (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create')))
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')))
$error_phone = true;
elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE') && Tools::getValue('email_create')))
|| (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))
|| (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create')))
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')))
$error_phone = true;
}
@@ -465,7 +466,7 @@ class AuthControllerCore extends FrontController
die(Tools::jsonEncode($return));
}
if ($back = Tools::getValue('back'))
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)
@@ -482,37 +483,57 @@ class AuthControllerCore extends FrontController
}
else // if registration type is in one step, we save the address
{
// Preparing address
$address = new Address();
$_POST['lastname'] = $lastnameAddress;
$_POST['firstname'] = $firstnameAddress;
$address->id_customer = 1;
$this->errors = array_unique(array_merge($this->errors, $address->validateController()));
// US customer: normalize the address
if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
$post_back = $_POST;
// Preparing addresses
foreach($addresses_types as $addresses_type)
{
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
$address->address1 = $normalize->AddressLineStandardization($address->address1);
$address->address2 = $normalize->AddressLineStandardization($address->address2);
$$addresses_type = new Address();
$$addresses_type->id_customer = 1;
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('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') == ''))
@@ -531,88 +552,89 @@ class AuthControllerCore extends FrontController
if (!count($this->errors))
{
// if registration type is in one step, we save the address
if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount'))
if (!($country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT'))) || !Validate::isLoadedObject($country))
die(Tools::displayError());
$contains_state = isset($country) && is_object($country) ? (int)$country->contains_states: 0;
$id_state = isset($address) && is_object($address) ? (int)$address->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.');
$customer->active = 1;
// 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
{
$customer->active = 1;
// 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
foreach($addresses_types as $addresses_type)
{
$address->id_customer = (int)$customer->id;
$this->errors = array_unique(array_merge($this->errors, $address->validateController()));
if (!count($this->errors) && (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') || $this->ajax || Tools::isSubmit('submitGuestAccount')) && !$address->add())
$$addresses_type->id_customer = (int)$customer->id;
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;
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.');
}
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
{
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
{
$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'));
$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 = (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'));
}
}
}
+3
View File
@@ -110,6 +110,9 @@ class CmsControllerCore extends FrontController
'content_only' => (int)(Tools::getValue('content_only')),
'path' => $path
));
if ($this->cms->indexation == 0)
$this->context->smarty->assign('nobots', true);
}
else if ($this->assignCase == 2)
{
+3 -4
View File
@@ -84,17 +84,16 @@ class CompareControllerCore extends FrontController
$hasProduct = false;
if (!Configuration::get('PS_COMPARATOR_MAX_ITEM'))
return Tools::redirect('index.php?controller=404');
return Tools::redirect('index.php?controller=404');
$ids = null;
if (($product_list = Tools::getValue('compare_product_list')) && ($postProducts = (isset($product_list) ? rtrim($product_list, '|') : '')))
$ids = array_unique(explode('|', $postProducts));
else if (isset($this->context->cookie->id_compare))
elseif (isset($this->context->cookie->id_compare))
{
$ids = CompareProduct::getCompareProducts($this->context->cookie->id_compare);
Tools::redirect($this->context->link->getPageLink('products-comparison', null, $this->context->language->id, array('compare_product_list' => implode('|', $ids))));
}
else
$ids = null;
if ($ids)
{
+2 -2
View File
@@ -58,8 +58,8 @@ class OrderControllerCore extends ParentOrderController
{
$this->step = 0;
$this->errors[] = sprintf(
Tools::displayError('A minimum purchase total of %s is required in order to validate your order.'),
Tools::displayPrice($minimal_purchase, $currency)
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($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency)
);
}
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),
'id_country_invoice' => (int)($address_invoice->id_country),
'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),
);
}
+2 -2
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)
$this->addJS(_THEME_JS_DIR_.'order-address.js');
$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->addJS(_THEME_JS_DIR_.'cart-summary.js');
@@ -465,7 +465,7 @@ class ParentOrderControllerCore extends FrontController
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
$bad_delivery = false;
if ($bad_delivery = !Address::isCountryActiveById((int)$this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice))
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')
{
+2 -17
View File
@@ -63,23 +63,8 @@ class PdfInvoiceControllerCore extends FrontController
$order_invoice_list = $this->order->getInvoicesCollection();
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();
}
/**
* 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);Gender ID (Mr=1, Ms=2, else 9);E-mail*;Password*;Birthday;Lastname*;Firstname*;Newletter (0/1);Opt-in (0/1)
1;1;1;johndoe@prestashop.com;#res152EDRF;1987-09-21;Doe;John;1;1
2;1;2;mariedoe@prestashop.com;58@ret26#;1986-10-14;Doe;Marie;0;1
id;Active (0/1);Gender ID (Mr=1, Ms=2, else 9);E-mail*;Password*;Birthday;Lastname*;Firstname*;Newletter (0/1);Opt-in (0/1);Groups (x,y,z...);Default group ID;ID / Name of shop
1;1;1;johndoe@prestashop.com;#res152EDRF;1987-09-21;Doe;John;1;1;1,2;1;1
2;1;2;mariedoe@prestashop.com;58@ret26#;1986-10-14;Doe;Marie;0;1;1,3;3;1
1 id Active (0/1) Gender ID (Mr=1, Ms=2, else 9) E-mail* Password* Birthday Lastname* Firstname* Newletter (0/1) Opt-in (0/1) Groups (x,y,z...) Default group ID ID / Name of shop
2 1 1 1 johndoe@prestashop.com #res152EDRF 1987-09-21 Doe John 1 1 1,2 1 1
3 2 1 2 mariedoe@prestashop.com 58@ret26# 1986-10-14 Doe Marie 0 1 1,3 3 1
+3 -3
View File
@@ -1,3 +1,3 @@
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description
1;1;Apple Computer, Inc;;;;;
2;1;Shure Incorporated;;;;;
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL
1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg
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
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
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 worlds 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;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;1;2;3;0.5;800;1;both;0.00;;0.00;iPod shuffle, the worlds 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
1;1;Applestore;;;;;
2;1;Shure Online Store;;;;;
id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL
1;1;Applestore;;;;;http://youdomain.com/img.jpg
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()
{
$session = InstallSession::getInstance();
if (!$session->last_step || $session->last_step == 'welcome')
Autoload::getInstance()->generateIndex();
if (Tools::getValue('compile_templates'))
{
require_once (_PS_INSTALL_CONTROLLERS_PATH_.'http/smarty_compile.php');
@@ -111,7 +115,6 @@ abstract class InstallControllerHttp
self::$instances[$step] = new $classname($step);
}
$session = InstallSession::getInstance();
if (!$session->last_step || !in_array($session->last_step, self::$steps))
$session->last_step = self::$steps[0];

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