Compare commits
352 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3782524898 | |||
| 302f7e7602 | |||
| e8f0c50c21 | |||
| fcce4d7bd1 | |||
| 0cd84c0f13 | |||
| 04caa74ac3 | |||
| a75fece648 | |||
| 1c9e9e8f3f | |||
| 2e3b2cd56d | |||
| 4a8e705efa | |||
| 338573856b | |||
| 4302ad7590 | |||
| 3ffb0466a5 | |||
| beb8206250 | |||
| 294af01eff | |||
| 4863e60cc3 | |||
| 6c98ff9ea8 | |||
| 8c613d773b | |||
| 2c160eb1b2 | |||
| 2c2b0fae9d | |||
| 50206f1bef | |||
| 1b2d7faafb | |||
| 55a1ad4b5e | |||
| f90f8011b8 | |||
| 6f3196b45a | |||
| 672d19f22a | |||
| b10a41105f | |||
| 49111f2d61 | |||
| 1129b89530 | |||
| bd3524c2d5 | |||
| fdfd718a5c | |||
| 1b22cb4b23 | |||
| 479461589b | |||
| cd58ef1c8d | |||
| fddeff7e4a | |||
| 17e546a3e7 | |||
| 64a83b9a55 | |||
| d3adbb1ba4 | |||
| fe7e7df605 | |||
| 02b2308819 | |||
| 266befeea5 | |||
| 35803ef67c | |||
| 58da54df23 | |||
| cb5c0a088c | |||
| ec021a44c3 | |||
| c4b6d33b44 | |||
| 913160ee5f | |||
| 432e0122ed | |||
| c0864ccedb | |||
| 5d2dde451a | |||
| 6f8368dba0 | |||
| 17efe5e27a | |||
| 9bce983280 | |||
| c0bdebf11a | |||
| 88222d9300 | |||
| 01371b1dcf | |||
| 05d6d1801a | |||
| d2626246ff | |||
| 721a20badd | |||
| fe70700b4a | |||
| 6e74fd59d1 | |||
| 10d3b0d127 | |||
| e7726cddd7 | |||
| d132549d32 | |||
| e7fb5ec6a4 | |||
| 43acfc04a4 | |||
| b68412e3a1 | |||
| 5b554435cf | |||
| 71eda6c6f3 | |||
| 2084089d1a | |||
| 34b062074b | |||
| 7b4e94603a | |||
| 980cbdc6de | |||
| 1ae4edb9cd | |||
| 976ffc3455 | |||
| 00cb52c6f9 | |||
| f3ab4f18ea | |||
| d57ceb7cf4 | |||
| f54d895f78 | |||
| ac67819ed7 | |||
| c513e21a96 | |||
| ca3d9ee5ae | |||
| 019ece549a | |||
| 9fd5aca4dc | |||
| a5469504cb | |||
| 0535b473ed | |||
| a589d527a9 | |||
| 496a6ef4ee | |||
| 187b6c0781 | |||
| d0666a7f53 | |||
| d5eabdaee8 | |||
| f81cc6e774 | |||
| 433382fa7c | |||
| c1dc2befd6 | |||
| 4f6de85447 | |||
| 57c92993e3 | |||
| afd0953f87 | |||
| af7e12efae | |||
| 145d34a291 | |||
| 1d17f750a9 | |||
| 35ba4e2bff | |||
| ba565f2add | |||
| 3ad3b6ea50 | |||
| 28d9b3cb2b | |||
| 1096d7dc44 | |||
| b7fec2c3e5 | |||
| 99decb70f1 | |||
| c77a8fef96 | |||
| ab59c5b8bb | |||
| 0b9d667516 | |||
| 05654f808c | |||
| 395054d5f9 | |||
| 71cd43a264 | |||
| fab4f5aa65 | |||
| 62097b8774 | |||
| 4b82c44dbe | |||
| 8367d3f958 | |||
| b565a755c7 | |||
| 22042415fd | |||
| 0584d6113e | |||
| 07795223e5 | |||
| 866175603e | |||
| bdf3c0bc9d | |||
| 1589264ecc | |||
| 7f2b320a3a | |||
| 26b1d30ef6 | |||
| 733a99e781 | |||
| b7a507464a | |||
| f20c5595d9 | |||
| d67656c6c0 | |||
| cf56010e90 | |||
| 698e1615f6 | |||
| 73733c76e1 | |||
| 9ad0b29da0 | |||
| 1e8536b6b3 | |||
| 03877da7f5 | |||
| 17493845c9 | |||
| 6f44dc6de7 | |||
| 4cce8e929c | |||
| 6e0a43f08e | |||
| 611f01f340 | |||
| 06d251156f | |||
| dfa8f7bf01 | |||
| f9e44fadfa | |||
| fdf7bf6aeb | |||
| f5bad733a5 | |||
| 68fad06745 | |||
| 72d32a7242 | |||
| b1cf1031cc | |||
| a91e7c4264 | |||
| 63ae5ba573 | |||
| 0ceb3ab448 | |||
| 15558c17c5 | |||
| f07e112111 | |||
| a0b97331eb | |||
| 9b64fecd0d | |||
| 9142792d30 | |||
| 8af50066a7 | |||
| b2d29d5eaf | |||
| a403dbf037 | |||
| 2805d8d37c | |||
| 76a455a216 | |||
| 306d13b8e3 | |||
| 8931c02d25 | |||
| ceabc1d32e | |||
| bb2b784888 | |||
| accd95d3b4 | |||
| 82ab941146 | |||
| 88b3a4938d | |||
| 43ca5b7bf9 | |||
| 6aeb574863 | |||
| e9c0150146 | |||
| 1b1acba4cd | |||
| 40c1b55ca8 | |||
| 14ccde1851 | |||
| dc98b821b5 | |||
| b39567ee48 | |||
| 0655ce189e | |||
| 1372eb778d | |||
| f13a64351c | |||
| 8657b584c5 | |||
| 0050c43675 | |||
| 5a57d5851c | |||
| 17058c36db | |||
| 1a216c325d | |||
| f272612eef | |||
| 3fae760e85 | |||
| f2985f1368 | |||
| c15f0f19fa | |||
| fb8e8fd23a | |||
| 3f8239fb91 | |||
| 7bc8fea54b | |||
| f18621b2ee | |||
| eaab471e9a | |||
| 248ec3fbbe | |||
| 53c5aa7174 | |||
| 1b4a2e0504 | |||
| 1dbbcbebab | |||
| 3048f027e6 | |||
| 0521a14a3d | |||
| 321fa7ee3b | |||
| f2caec512c | |||
| 43cd696220 | |||
| 1701efab16 | |||
| 3179bdf40d | |||
| e46bb5c6f4 | |||
| e637297bae | |||
| 9df166fce6 | |||
| 61036a1c61 | |||
| b5cdfacd86 | |||
| 7cac3a1f93 | |||
| 2b7e79c180 | |||
| f81effcbdc | |||
| 9c57a8e3e2 | |||
| 48117b955c | |||
| d9d75d4545 | |||
| 459a98c1bb | |||
| e9c73cde80 | |||
| e58e5141bf | |||
| 568df5c40f | |||
| 471aa8d194 | |||
| 3a13f5c434 | |||
| 9abea64e99 | |||
| 66c63059ea | |||
| 69b56e5f79 | |||
| 80a5d1db3d | |||
| 40093d3884 | |||
| 80430ae546 | |||
| b85170f6de | |||
| 6d5e3c7c77 | |||
| b8554dcdd4 | |||
| d0a8c4e5b6 | |||
| 701462b7e5 | |||
| 045d814a8a | |||
| b1ea5b3e7b | |||
| f4671e17c1 | |||
| 3fa187937b | |||
| 4ec2c49dbc | |||
| 8b210e65d4 | |||
| f1156969c0 | |||
| b3d63dba77 | |||
| 20af1a97f6 | |||
| 247aaada6f | |||
| 95c4a3c8d3 | |||
| 969a94c261 | |||
| df275195ab | |||
| 14faf9d7ac | |||
| c944660ba8 | |||
| 3f1cb8d093 | |||
| 352a1f636c | |||
| 3b087d4912 | |||
| 74cf4b5bfc | |||
| 292928844c | |||
| fd1a15d66f | |||
| 52263fa26b | |||
| bacf91bf65 | |||
| 7906a39f9c | |||
| 972fbc2312 | |||
| a92bb97253 | |||
| 209e1821ea | |||
| ae7812475e | |||
| c526b1a06c | |||
| daebd54bda | |||
| 47ca6c46eb | |||
| a5c3d88a8e | |||
| a48e8cf111 | |||
| dcf067d890 | |||
| b4aba5e8f3 | |||
| 9686562d85 | |||
| c847c68f49 | |||
| 4dac4d9609 | |||
| 2897c024ce | |||
| 2869859748 | |||
| acbe68472e | |||
| 89af761924 | |||
| ae34979845 | |||
| 702b93aa25 | |||
| f7ac3955e1 | |||
| c5c2d7e142 | |||
| a18bc569aa | |||
| d8f2bdf3c6 | |||
| 1885de9848 | |||
| f31d338de7 | |||
| 6ee30e3bdb | |||
| b81425534e | |||
| ea1ad666f7 | |||
| 88a80b624b | |||
| 22bc313e76 | |||
| 060ed4cce1 | |||
| a5b4596cd7 | |||
| 486866d6f0 | |||
| 181f9fd1b8 | |||
| e96687636d | |||
| e8cef6aea0 | |||
| 7ab7950ffc | |||
| 3451d9d010 | |||
| f35027b4fd | |||
| 5a923f6605 | |||
| 0f2b942358 | |||
| 67f5137a63 | |||
| d13e3c329a | |||
| 6926e5b326 | |||
| 7b90890cba | |||
| 359fdc09f0 | |||
| 8614ca6ed1 | |||
| 6c1be047c3 | |||
| c2984b884f | |||
| ca8bab9dda | |||
| e689af81e6 | |||
| f2e5eaaabd | |||
| c686552b2a | |||
| 94458cb01d | |||
| 6b1f0fb41a | |||
| 95d63aa30e | |||
| 1ad7acd1a3 | |||
| 938f7dc0a6 | |||
| 6cb0f0a000 | |||
| 792f2bb283 | |||
| 77e04afcec | |||
| 4a1fd5e336 | |||
| 93d1065bcc | |||
| 25dda0156d | |||
| 77bea290f1 | |||
| b36247f993 | |||
| 293245e89c | |||
| 51111037f8 | |||
| 6d779139cd | |||
| 273c5d55eb | |||
| 2aa07e24c7 | |||
| aea254b1e3 | |||
| 96c679c9b4 | |||
| 6086fac366 | |||
| 50facdfb8a | |||
| b836ab1f7f | |||
| 9e87b07624 | |||
| a5f0a11124 | |||
| 484f091375 | |||
| 3fdb3f9e22 | |||
| c68b1ad548 | |||
| d13be9e69e | |||
| d59308a9b6 | |||
| b1cc259996 | |||
| 4c6276f1cd | |||
| 1c1cdab498 | |||
| 6897a92982 | |||
| fc7cfa168f | |||
| 464ab13391 | |||
| 7fa825e949 | |||
| c019aebfbc | |||
| 9cf8b5a538 | |||
| e45d86f048 | |||
| 84341c7505 |
@@ -196,7 +196,7 @@
|
||||
id="cart_rule_select_remove"
|
||||
style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
|
||||
>
|
||||
|
||||
<< {l s='Remove'}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<ul style="margin: 0; padding: 0; list-style-type: none;">
|
||||
{foreach from=$datas key='index' item='data'}
|
||||
<li style="display: inline; margin: 2px;">
|
||||
<a href="displayImage.php?img={$data.value}&name={$order->id}-file{$smarty.foreach.count.index}" target="_blank">
|
||||
<a href="displayImage.php?img={$data.value}&name={$order->id}-file{$index}" target="_blank">
|
||||
<img src="{$pic_dir}{$data.value}_small" alt="" /></a>
|
||||
</li>
|
||||
{/foreach}
|
||||
@@ -107,7 +107,7 @@
|
||||
{elseif $type == constant('Product::CUSTOMIZE_TEXTFIELD')}
|
||||
<ul style="margin-bottom: 4px; padding: 0; list-style-type: none;">
|
||||
{foreach from=$datas key='index' item='data'}
|
||||
<li>{if $data.name}{$data.name}{else}{l s='Text #'}{$smarty.foreach.count.index}{/if}{l s=':'}<b>{$data.value}</b></li>
|
||||
<li>{if $data.name}{$data.name}{else}{l s='Text #'}{$index}{/if}{l s=':'}<b>{$data.value}</b></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
@@ -121,6 +121,7 @@ $(document).ready(function() {
|
||||
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
|
||||
|
||||
{hook h="displayAdminHomeInfos"}
|
||||
{hook h="displayBackOfficeHome"} {*old name of the hook*}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var truncateAuthorized = {$truncateAuthorized|intval};
|
||||
|
||||
$(document).ready(function(){
|
||||
activeClueTip();
|
||||
$("a#upload_file_import_link").fancybox({
|
||||
@@ -46,9 +48,18 @@
|
||||
$('#preview_import').submit(function(e) {
|
||||
if ($('#truncate').get(0).checked)
|
||||
{
|
||||
if (!confirm('{l s='Are you sure you want to delete' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '{l s='?' js=1}'))
|
||||
console.log(truncateAuthorized);
|
||||
if (truncateAuthorized)
|
||||
{
|
||||
e.preventDefault();
|
||||
if (!confirm('{l s='Are you sure you want to delete' js=1}' + ' ' + $.trim($('#entity > option:selected').text().toLowerCase()) + '{l s='?' js=1}'))
|
||||
{
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jAlert('{l s='You do not have permission to delete here. When the multi-store is enable, only a SuperAdmin can delete all items before import.'}');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -122,7 +133,7 @@
|
||||
<fieldset style="float: left; margin: 0pt 20px 0pt 0pt; width: 70%;">
|
||||
<legend><img src="../img/admin/import.gif" />{l s='Import'}</legend>
|
||||
|
||||
<label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=files_to_import}{else}{l s='Your CSV file (%d file):' sprintf=files_to_import}{/if}</label>
|
||||
<label class="clear">{if count($files_to_import) > 1}{l s='Your CSV file (%d files):' sprintf=count($files_to_import)}{else}{l s='Your CSV file (%d file):' sprintf=count($files_to_import)}{/if}</label>
|
||||
<div class="margin-form">
|
||||
{if count($files_to_import)}
|
||||
<select name="csv">
|
||||
@@ -173,10 +184,14 @@
|
||||
<div class="margin-form">
|
||||
<input name="truncate" id="truncate" type="checkbox"/>
|
||||
</div>
|
||||
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
|
||||
<label for="match_ref" class="clear" style="display: none">{l s='Use product reference as key?'}</label>
|
||||
<div class="margin-form">
|
||||
<input name="match_ref" id="match_ref" type="checkbox" style="margin-top: 6px; display:none"/>
|
||||
</div>
|
||||
<label for="forceIDs" class="clear">{l s='Force all ids during import?'} </label>
|
||||
<div class="margin-form">
|
||||
<input name="forceIDs" id="forceIDs" type="checkbox"/> {l s='If you don\'t use this option, all IDs will be auto-incremented.'}
|
||||
</div>
|
||||
<div class="space margin-form">
|
||||
<input type="submit" name="submitImportFile" value="{l s='Next step'}" class="button" {if empty($files_to_import)}disabled{/if}/>
|
||||
{if empty($files_to_import)}<span style="color:red;">{l s='You must upload a file for go to the next step.'}</span>{/if}
|
||||
@@ -255,6 +270,11 @@
|
||||
else
|
||||
$(".import_products_categories").hide();
|
||||
|
||||
if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6)
|
||||
$("label[for=forceIDs],#forceIDs").show();
|
||||
else
|
||||
$("label[for=forceIDs],#forceIDs").hide();
|
||||
|
||||
$("#entitie").html($("#entity > option:selected").text().toLowerCase());
|
||||
$.ajax({
|
||||
url: 'ajax.php',
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
{if $fields_value.truncate}
|
||||
<input type="hidden" name="truncate" value="1" />
|
||||
{/if}
|
||||
{if $fields_value.forceIDs}
|
||||
<input type="hidden" name="forceIDs" value="1" />
|
||||
{/if}
|
||||
{if $fields_value.match_ref}
|
||||
<input type="hidden" name="match_ref" value="1" />
|
||||
{/if}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<input type="radio" name="{$key}" id="{$key}_off" value="0" {if !$field['value']} checked="checked"{/if}{if isset($field['js']['off'])} {$field['js']['off']}{/if}/>
|
||||
<label class="t" for="{$key}_off"> {l s='No'}</label>
|
||||
{if !$field['mod_rewrite']}
|
||||
<span class="warning_mod_rewrite">{l s='URL rewriting (mod_rewrite) is not active on your server. If you want to use Friendly URLs you must activate this mod.'}</span>
|
||||
<span class="warning_mod_rewrite">{l s='URL rewriting (mod_rewrite) is not active on your server or it is not possible to check your server configuration. If you want to use Friendly URLs you must activate this mod.'}</span>
|
||||
<div class="clear"></div>
|
||||
{/if}
|
||||
{else}
|
||||
|
||||
@@ -38,21 +38,21 @@
|
||||
<tr height="32" {if $km % 2 eq 0} class="alt_row"{/if}>
|
||||
<td><img src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}" width="16" height="16" /></td>
|
||||
<td><span class="moduleName">{$module->displayName}</span></td>
|
||||
<td><span class="moduleFavDesc">{$module->description|truncate:80:'…'}</span></td>
|
||||
<td><span class="moduleFavDesc">{$module->description|truncate:80:'...'}</span></td>
|
||||
<td>{if isset($module->id) && $module->id gt 0}<span class="setup">{l s='Installed'}</span>{else}<span class="setup non-install">{l s='Not Installed'}</span>{/if}</td>
|
||||
<td>{$module->categoryName}</td>
|
||||
<td>
|
||||
<select name="i_{$module->name}" class="moduleFavorite" style="width:50px">
|
||||
<option value="" selected="selected">---</option>
|
||||
<option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>Yes</option>
|
||||
<option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>No</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" style="width:50px">
|
||||
<option value="" selected="selected">---</option>
|
||||
<option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>Yes</option>
|
||||
<option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>No</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>
|
||||
</td>
|
||||
<td id="r_{$module->name}"> </td>
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</td>
|
||||
<td class="partial_refund_fields current-edit" style="text-align:left;display:none">
|
||||
<div style="width:40%;margin-top:5px;float:left">{l s='Quantity:'}</div> <div style="width:60%;margin-top:2px;float:left"><input onchange="checkPartialRefundProductQuantity(this)" type="text" size="3" name="partialRefundProductQuantity[{{$product['id_order_detail']}}]" value="0" /> 0/{$productQuantity-$product['product_quantity_refunded']}</div>
|
||||
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left"><input onchange="checkPartialRefundProductAmount(this)" type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']}]" /> €</div> {if !empty($product['amount_refund']) && $product['amount_refund'] > 0}({l s='%s refund' sprintf=$product['amount_refund']}){/if}
|
||||
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left">{$currency->prefix}<input onchange="checkPartialRefundProductAmount(this)" type="text" size="3" name="partialRefundProduct[{$product['id_order_detail']}]" /> {$currency->suffix}</div> {if !empty($product['amount_refund']) && $product['amount_refund'] > 0}({l s='%s refund' sprintf=$product['amount_refund']}){/if}
|
||||
<input type="hidden" value="{$product['quantity_refundable']}" class="partialRefundProductQuantity" />
|
||||
<input type="hidden" value="{$product['amount_refundable']}" class="partialRefundProductAmount" />
|
||||
</td>
|
||||
|
||||
@@ -1099,7 +1099,7 @@
|
||||
</fieldset>
|
||||
<br />
|
||||
<fieldset id="vouchers_part" style="display:none;">
|
||||
<legend><img src="../img/t/AdminDiscounts.gif" />{l s='Vouchers'}</legend>
|
||||
<legend><img src="../img/t/AdminCartRules.gif" />{l s='Vouchers'}</legend>
|
||||
<p>
|
||||
<label>{l s='Search a voucher:'} </label>
|
||||
<input type="text" id="voucher" value="" />
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<!-- Left column -->
|
||||
<div style="width: 49%; float:left;">
|
||||
<!-- Change status form -->
|
||||
<form action="{$currentIndex}&viewOrder&token={$smarty.get.token}" method="post">
|
||||
<form action="{$currentIndex}&vieworder&token={$smarty.get.token}" method="post">
|
||||
<select id="id_order_state" name="id_order_state">
|
||||
{foreach from=$states item=state}
|
||||
{if $state['id_order_state'] != $currentState->id}
|
||||
@@ -184,8 +184,8 @@
|
||||
{foreach from=$sources item=source}
|
||||
<li>
|
||||
{dateFormat date=$source['date_add'] full=true}<br />
|
||||
<b>{l s='From:'}</b> <a href="{$source['http_referer']}">{parse_url($source['http_referer'], $smarty.const.PHP_URL_HOST)|regex_replace:'/^www./':''}</a><br />
|
||||
<b>{l s='To:'}</b> {$source['request_uri']}<br />
|
||||
<b>{l s='From:'}</b>{if $source['http_referer'] != ''}<a href="{$source['http_referer']}">{parse_url($source['http_referer'], $smarty.const.PHP_URL_HOST)|regex_replace:'/^www./':''}</a>{else}-{/if}<br />
|
||||
<b>{l s='To:'}</b> <a href="http://{$source['request_uri']}">{$source['request_uri']|truncate:100:'...'}</a><br />
|
||||
{if $source['keywords']}<b>{l s='Keywords:'}</b> {$source['keywords']}<br />{/if}<br />
|
||||
</li>
|
||||
{/foreach}
|
||||
@@ -264,7 +264,7 @@
|
||||
<legend><img src="../img/admin/money.gif" /> {l s='Payment'}</legend>
|
||||
|
||||
{if (!$order->valid && sizeof($currencies) > 1)}
|
||||
<form method="post" action="{$currentIndex}&viewOrder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
||||
<form method="post" action="{$currentIndex}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
|
||||
<p class="warn">{l s='Don\'t forget to update your conversion rate before make this change.'}</p>
|
||||
<label>{l s='Don\'t forget to update your conversion rate before make this change.'}</label>
|
||||
<select name="new_currency">
|
||||
@@ -384,7 +384,7 @@
|
||||
<tr class="current-edit">
|
||||
<td><input type="text" name="payment_date" class="datepicker" size="17" value="{date('Y-m-d H:i:s')}" /></td>
|
||||
<td>
|
||||
<select name="payment_method">
|
||||
<select name="payment_method" class="payment_method">
|
||||
{foreach from=$payment_methods item=payment_method}
|
||||
<option value="{$payment_method}">{$payment_method}</option>
|
||||
{/foreach}
|
||||
@@ -395,7 +395,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="payment_amount" size="5" value="" />
|
||||
<select name="payment_currency">
|
||||
<select name="payment_currency" class="payment_currency">
|
||||
{foreach from=$currencies item=current_currency}
|
||||
<option value="{$current_currency['id_currency']}"{if $current_currency['id_currency'] == $currency->id} selected="selected"{/if}>{$current_currency['sign']}</option>
|
||||
{/foreach}
|
||||
@@ -662,7 +662,7 @@
|
||||
<tr id="total_shipping">
|
||||
<td><b>{l s='Shipping'}</b></td>
|
||||
<td class="amount" align="right">{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id}</td>
|
||||
<td class="partial_refund_fields current-edit" style="display:none;"><input type="text" size="3" name="partialRefundShippingCost" value="0" /> €</td>
|
||||
<td class="partial_refund_fields current-edit" style="display:none;">{$currency->prefix}<input type="text" size="3" name="partialRefundShippingCost" value="0" />{$currency->suffix}</td>
|
||||
</tr>
|
||||
<tr style="font-size: 20px" id="total_order">
|
||||
<td style="font-size: 20px">{l s='Total'}</td>
|
||||
@@ -719,7 +719,7 @@
|
||||
<div style="clear:both; height:15px;"> </div>
|
||||
<div style="float: right; width: 160px; display: none;" class="standard_refund_fields">
|
||||
{if ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN'))}
|
||||
<input type="checkbox" id="reinjectQuantities" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
||||
<input type="checkbox" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
||||
{/if}
|
||||
{if ((!$order->hasBeenDelivered() && $order->hasBeenPaid()) || ($order->hasBeenDelivered() && Configuration::get('PS_ORDER_RETURN')))}
|
||||
<input type="checkbox" id="generateCreditSlip" name="generateCreditSlip" class="button" onclick="toggleShippingCost(this)" /> <label for="generateCreditSlip" style="float:none; font-weight:normal;">{l s='Generate a credit slip'}</label><br />
|
||||
@@ -733,10 +733,9 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div style="float: right; width: 160px; display:none;" class="partial_refund_fields">
|
||||
<div style="text-align:center; margin-top:5px;">
|
||||
<input type="checkbox" id="generateDiscountRefund" name="generateDiscountRefund" class="button" onclick="toggleShippingCost(this)" /> <label for="generateDiscount" style="float:none; font-weight:normal;">{l s='Generate a voucher'}</label><br />
|
||||
<input type="submit" name="partialRefund" value="{l s='Partial refund'}" class="button" style="margin-top:8px;" />
|
||||
</div>
|
||||
<input type="checkbox" name="reinjectQuantities" class="button" /> <label for="reinjectQuantities" style="float:none; font-weight:normal;">{l s='Re-stock products'}</label><br />
|
||||
<input type="checkbox" id="generateDiscountRefund" name="generateDiscountRefund" class="button" onclick="toggleShippingCost(this)" /> <label for="generateDiscount" style="float:none; font-weight:normal;">{l s='Generate a voucher'}</label><br />
|
||||
<input type="submit" name="partialRefund" value="{l s='Partial refund'}" class="button" style="margin-top:8px;" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
<li style="float: left; width: {$imageWidth}px;">
|
||||
<input type="checkbox" name="id_image_attr[]" value="{$image.id_image}" id="id_image_attr_{$image.id_image}" />
|
||||
<label for="id_image_attr_{$image.id_image}" style="float: none;">
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}{$image.obj->getExistingImgPath()}-small.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()}-small_default.jpg" alt="{$image.legend|escape:'htmlall':'UTF-8'}" title="{$image.legend|escape:'htmlall':'UTF-8'}" />
|
||||
</label>
|
||||
</li>
|
||||
{/foreach}
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
<table id="lineType" style="display:none;">
|
||||
<tr id="image_id">
|
||||
<td style="padding: 4px;">
|
||||
<a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" target="_blank">
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}en-default-small.jpg" alt="image_id" title="image_id" />
|
||||
<a href="{$smarty.const._THEME_PROD_DIR_}image_path.jpg" class="fancybox">
|
||||
<img src="{$smarty.const._THEME_PROD_DIR_}en-default-small_default.jpg" alt="image_id" title="image_id" />
|
||||
</a>
|
||||
</td>
|
||||
<td id="td_image_id" class="pointer dragHandle center positionImage">
|
||||
@@ -109,6 +109,7 @@
|
||||
var come_from = '{$table}';
|
||||
var success_add = '{l s='image has been successfully added'}';
|
||||
var id_tmp = 0;
|
||||
var current_shop_id = {$current_shop_id|intval};
|
||||
{literal}
|
||||
//Ready Function
|
||||
$(document).ready(function(){
|
||||
@@ -253,6 +254,11 @@
|
||||
$(this).attr("src", $(this).attr("src").replace("enabled", "forbbiden"));
|
||||
});
|
||||
$(this).attr("src", $(this).attr("src").replace("forbbiden", "enabled"));
|
||||
|
||||
if (current_shop_id != 0)
|
||||
$('#'+current_shop_id+id).attr('check', true);
|
||||
else
|
||||
$(this).parent().parent().parent().children('td input').attr('check', true);
|
||||
doAdminAjax({
|
||||
"action":"UpdateCover",
|
||||
"id_image":id,
|
||||
@@ -322,6 +328,7 @@
|
||||
}
|
||||
$("#imageList").append(line);
|
||||
}
|
||||
$('.fancybox').fancybox();
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
{if $key == 'rightCols'}
|
||||
{foreach $field as $input}
|
||||
{if $input.type == 'file'}
|
||||
<label style="text-align: left; width: inherit;">{$input.label} </label>
|
||||
<div class="margin-form" style="padding: 0; display: inline;">
|
||||
<label style="text-align: left; width: inherit;width:250px;text-align:right">{$input.label} </label>
|
||||
<div class="margin-form">
|
||||
<input type="file" name="{$input.name}" />
|
||||
<p class="clear">{$input.desc}</p>
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
@@ -71,7 +71,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
|
||||
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin: 15px 0 20px 260px; border: 1px solid #BBB;">
|
||||
<tr>
|
||||
<th colspan="2">{l s='Hours:'}</th>
|
||||
</tr>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<div id="submitAddLangContent" style="float:left;">
|
||||
<p>{l s='You can add or update a language directly from prestashop.com here'}</p>
|
||||
<div class="warn">
|
||||
{l s='If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes Front Office expressions and default e-mail templates.'}
|
||||
{l s='If you choose to update an existing language pack, all your previous customization in the theme named "Default" will be lost. This includes Front Office expressions and default e-mail templates.'}
|
||||
</div>
|
||||
{if $packs_to_update || $packs_to_install}
|
||||
<div style="font-weight:bold; float:left;">{l s='Language you want to add or update:'}
|
||||
|
||||
+1
@@ -128,6 +128,7 @@
|
||||
</fieldset><br />
|
||||
{/if}
|
||||
{/foreach}
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
{/block}
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
<link rel="shortcut icon" href="{$img_dir}favicon.ico" />
|
||||
<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_dir}favicon.ico" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{$img_dir}favicon.ico" />
|
||||
{if isset($displayBackOfficeHeader)}
|
||||
{$displayBackOfficeHeader}
|
||||
{/if}
|
||||
@@ -102,126 +103,129 @@
|
||||
{* begin HEADER *}
|
||||
<div id="header">
|
||||
<div id="header_infos">
|
||||
<a id="header_shopname" href="{$link->getAdminLink('AdminHome')|escape:'htmlall':'UTF-8'}"><span>{$shop_name}</span></a><div id="notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<div id="orders_notif" class="notifs">
|
||||
<span id="orders_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been placed on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a></p>
|
||||
<a id="header_shopname" href="{$link->getAdminLink('AdminHome')|escape:'htmlall':'UTF-8'}"><span>{$shop_name}</span></a>
|
||||
<div id="notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<div id="orders_notif" class="notifs">
|
||||
<span id="orders_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
<div id="orders_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last orders'}</h3>
|
||||
<p class="no_notifs">{l s='No new orders has been placed on your shop'}</p>
|
||||
<ul id="list_orders_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if ($show_new_customers == 1)}
|
||||
<div id="customers_notif" class="notifs notifs_alternate">
|
||||
<span id="customers_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a></p>
|
||||
{/if}
|
||||
{if ($show_new_customers == 1)}
|
||||
<div id="customers_notif" class="notifs notifs_alternate">
|
||||
<span id="customers_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customers_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last customers'}</h3>
|
||||
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
|
||||
<ul id="list_customers_notif"></ul>
|
||||
<p><a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<div id="customer_messages_notif" class="notifs">
|
||||
<span id="customer_messages_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customer_messages_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customer_messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_customer_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a></p>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<div id="customer_messages_notif" class="notifs">
|
||||
<span id="customer_messages_notif_number_wrapper" class="number_wrapper">
|
||||
<span id="customer_messages_notif_value">0</span>
|
||||
</span>
|
||||
<div id="customer_messages_notif_wrapper" class="notifs_wrapper">
|
||||
<h3>{l s='Last messages'}</h3>
|
||||
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
|
||||
<ul id="list_customer_messages_notif"></ul>
|
||||
<p><a href="index.php?tab=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="employee_links">
|
||||
<span class="employee_name">{$first_name} {$last_name}</span>
|
||||
<span class="separator"> </span>
|
||||
<a class="employee" href="index.php?controller=AdminEmployees&id_employee={$employee->id}&updateemployee&token={getAdminToken tab='AdminEmployees'}" alt="">{l s='My preferences'}</a>
|
||||
<span class="separator"> </span>
|
||||
<a href="index.php?logout" id="header_logout">{l s='logout'}</a>
|
||||
{if {$base_url}}
|
||||
<span class="separator"> </span>
|
||||
<a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}">{l s='View my shop'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={getAdminToken tab='AdminSearch'}">
|
||||
<input type="text" name="bo_query" id="bo_query" value="{$bo_query}" />
|
||||
<select name="bo_search_type" id="bo_search_type" class="chosen no-search">
|
||||
<option value="0">{l s='everywhere'}</option>
|
||||
<option value="1" {if {$search_type} == 1} selected="selected" {/if}>{l s='catalog'}</option>
|
||||
<optgroup label="{l s='customers'}:">
|
||||
<option value="2" {if {$search_type} == 2} selected="selected" {/if}>{l s='by name'}</option>
|
||||
<option value="6" {if {$search_type} == 6} selected="selected" {/if}>{l s='by ip address'}</option>
|
||||
</optgroup>
|
||||
<option value="3" {if {$search_type} == 3} selected="selected" {/if}>{l s='orders'}</option>
|
||||
<option value="4" {if {$search_type} == 4} selected="selected" {/if}>{l s='invoices'}</option>
|
||||
<option value="5" {if {$search_type} == 5} selected="selected" {/if}>{l s='carts'}</option>
|
||||
</select>
|
||||
<input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{if count($quick_access) > 0}
|
||||
<div id="header_quick">
|
||||
<script type="text/javascript">
|
||||
function quickSelect(elt)
|
||||
{
|
||||
var eltVal = $(elt).val();
|
||||
if (eltVal == "0")
|
||||
return false;
|
||||
else if (eltVal.substr(eltVal.length - 6) == '_blank')
|
||||
window.open(eltVal.substr(0, eltVal.length - 6), '_blank');
|
||||
else
|
||||
location.href = eltVal;
|
||||
}
|
||||
</script>
|
||||
<select onchange="quickSelect(this);" id="quick_select" class="chosen no-search">
|
||||
<option value="0">{l s='Quick Access'}</option>
|
||||
{foreach $quick_access as $quick}
|
||||
<option value="{$quick.link|escape:'htmlall':'UTF-8'}{if $quick.new_window}_blank{/if}">» {$quick.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($displayBackOfficeTop)}
|
||||
{$displayBackOfficeTop}
|
||||
{/if}
|
||||
</div> {* end header *}
|
||||
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
{/if}
|
||||
</div>
|
||||
<div id="employee_links">
|
||||
<span class="employee_name">{$first_name} {$last_name}</span>
|
||||
<span class="separator"> </span>
|
||||
<a class="employee" href="index.php?controller=AdminEmployees&id_employee={$employee->id}&updateemployee&token={getAdminToken tab='AdminEmployees'}" alt="">{l s='My preferences'}</a>
|
||||
<span class="separator"> </span>
|
||||
<a href="index.php?logout" id="header_logout">{l s='logout'}</a>
|
||||
{if {$base_url}}
|
||||
<span class="separator"> </span>
|
||||
<a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}">{l s='View my shop'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token={getAdminToken tab='AdminSearch'}">
|
||||
<input type="text" name="bo_query" id="bo_query" value="{$bo_query}" />
|
||||
<select name="bo_search_type" id="bo_search_type" class="chosen no-search">
|
||||
<option value="0">{l s='everywhere'}</option>
|
||||
<option value="1" {if {$search_type} == 1} selected="selected" {/if}>{l s='catalog'}</option>
|
||||
<optgroup label="{l s='customers'}:">
|
||||
<option value="2" {if {$search_type} == 2} selected="selected" {/if}>{l s='by name'}</option>
|
||||
<option value="6" {if {$search_type} == 6} selected="selected" {/if}>{l s='by ip address'}</option>
|
||||
</optgroup>
|
||||
<option value="3" {if {$search_type} == 3} selected="selected" {/if}>{l s='orders'}</option>
|
||||
<option value="4" {if {$search_type} == 4} selected="selected" {/if}>{l s='invoices'}</option>
|
||||
<option value="5" {if {$search_type} == 5} selected="selected" {/if}>{l s='carts'}</option>
|
||||
</select>
|
||||
<input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{if count($quick_access) > 0}
|
||||
<div id="header_quick">
|
||||
<script type="text/javascript">
|
||||
function quickSelect(elt)
|
||||
{
|
||||
var eltVal = $(elt).val();
|
||||
if (eltVal == "0")
|
||||
return false;
|
||||
else if (eltVal.substr(eltVal.length - 6) == '_blank')
|
||||
window.open(eltVal.substr(0, eltVal.length - 6), '_blank');
|
||||
else
|
||||
location.href = eltVal;
|
||||
}
|
||||
</script>
|
||||
<select onchange="quickSelect(this);" id="quick_select" class="chosen no-search">
|
||||
<option value="0">{l s='Quick Access'}</option>
|
||||
{foreach $quick_access as $quick}
|
||||
<option value="{$quick.link|escape:'htmlall':'UTF-8'}{if $quick.new_window}_blank{/if}">» {$quick.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
{if $t.active}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{if $t.name eq ''}{$t.class_name}{else}{$t.name}{/if}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
{if $t2.active}
|
||||
<li><a href="{$t2.href|escape:'htmlall':'UTF-8'}">{if $t2.name eq ''}{$t2.class_name}{else}{$t2.name|escape:'htmlall':'UTF-8'}{/if}</a></li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
{if isset($displayBackOfficeTop)}
|
||||
{$displayBackOfficeTop}
|
||||
{/if}
|
||||
</div>{* end header_infos*}
|
||||
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
{if $t.active}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{if $t.name eq ''}{$t.class_name}{else}{$t.name}{/if}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
{if $t2.active}
|
||||
<li><a href="{$t2.href|escape:'htmlall':'UTF-8'}">{if $t2.name eq ''}{$t2.class_name}{else}{$t2.name|escape:'htmlall':'UTF-8'}{/if}</a></li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>{* end header*}
|
||||
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $display_header && $install_dir_exists}
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
{$input.required = false}
|
||||
{$input.desc = null}
|
||||
{else}
|
||||
<select name="{$input.name}" class=""
|
||||
<select name="{$input.name}" class="{if isset($input.class)}{$input.class}{/if}"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
{if isset($input.multiple)}multiple="multiple" {/if}
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
@@ -213,12 +213,12 @@
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte"{/if} >{$fields_value[$input.name][$language.id_lang]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
<textarea cols="{$input.cols}" rows="{$input.rows}" name="{$input.name}_{$language.id_lang}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte {if isset($input.class)}{$input.class}{/if}"{/if} >{$fields_value[$input.name][$language.id_lang]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
<textarea name="{$input.name}" cols="{$input.cols}" rows="{$input.rows}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte"{/if}>{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
<textarea name="{$input.name}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" cols="{$input.cols}" rows="{$input.rows}" {if isset($input.autoload_rte) && $input.autoload_rte}class="rte autoload_rte {if isset($input.class)}{$input.class}{/if}"{/if}>{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
|
||||
{/if}
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{foreach $input.values.query as $value}
|
||||
@@ -226,6 +226,7 @@
|
||||
<input type="checkbox"
|
||||
name="{$id_checkbox}"
|
||||
id="{$id_checkbox}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
{if isset($value.val)}value="{$value.val|escape:'htmlall':'UTF-8'}"{/if}
|
||||
{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]}checked="checked"{/if} />
|
||||
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
|
||||
@@ -248,11 +249,12 @@
|
||||
<input type="password"
|
||||
name="{$input.name}"
|
||||
size="{$input.size}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
value=""
|
||||
{if isset($input.autocomplete) && !$input.autocomplete}autocomplete="off"{/if} />
|
||||
{elseif $input.type == 'birthday'}
|
||||
{foreach $input.options as $key => $select}
|
||||
<select name="{$key}" class="">
|
||||
<select name="{$key}" class="{if isset($input.class)}{$input.class}{/if}">
|
||||
<option value="">-</option>
|
||||
{if $key == 'months'}
|
||||
{*
|
||||
@@ -299,6 +301,7 @@
|
||||
{if isset($input.class)}class="{$input.class}"
|
||||
{else}class="color mColorPickerInput"{/if}
|
||||
name="{$input.name}"
|
||||
class="{if isset($input.class)}{$input.class}{/if}"
|
||||
value="{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}" />
|
||||
{elseif $input.type == 'date'}
|
||||
<input type="text"
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$table}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$table}').value={$page - 1}"/>
|
||||
{/if}
|
||||
{l s='Page'}<b>{$page}</b> / {$total_pages}
|
||||
{l s='Page'} <b>{$page}</b> / {$total_pages}
|
||||
{if $page < $total_pages}
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$table}').value={$page + 1}"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$table}').value={$total_pages}"/>
|
||||
|
||||
@@ -175,6 +175,17 @@ class AddressCore extends ObjectModel
|
||||
Customer::resetAddressCache($this->id_customer);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($null_values = false)
|
||||
{
|
||||
// Empty related caches
|
||||
if (isset(self::$_idCountries[$this->id]))
|
||||
unset(self::$_idCountries[$this->id]);
|
||||
if (isset(self::$_idZones[$this->id]))
|
||||
unset(self::$_idZones[$this->id]);
|
||||
|
||||
return parent::update($null_values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ObjectModel::delete()
|
||||
|
||||
@@ -45,7 +45,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'is_color_group' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'group_type' => array('type' => self::TYPE_STRING),
|
||||
'group_type' => array('type' => self::TYPE_STRING, 'required' => true),
|
||||
'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
||||
|
||||
// Lang fields
|
||||
@@ -139,6 +139,7 @@ class AttributeGroupCore extends ObjectModel
|
||||
IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id.')') === false ||
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id) === false)
|
||||
return false;
|
||||
$this->cleanPositions();
|
||||
}
|
||||
$return = parent::delete();
|
||||
if ($return)
|
||||
|
||||
@@ -202,6 +202,7 @@ class CarrierCore extends ObjectModel
|
||||
{
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
$this->cleanPositions();
|
||||
return (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id) &&
|
||||
$this->deleteTaxRulesGroup(Shop::getShops(true, null, true)));
|
||||
|
||||
|
||||
+72
-23
@@ -205,12 +205,12 @@ class CartCore extends ObjectModel
|
||||
public function updateAddressId($id_address, $id_address_new)
|
||||
{
|
||||
$to_update = false;
|
||||
if ($this->id_address_invoice == $id_address)
|
||||
if (!isset($this->id_address_invoice) || $this->id_address_invoice == $id_address)
|
||||
{
|
||||
$to_update = true;
|
||||
$this->context->cart->id_address_invoice = $id_address_new;
|
||||
}
|
||||
if ($this->id_address_delivery == $id_address)
|
||||
if (!isset($this->id_address_delivery) || $this->id_address_delivery == $id_address)
|
||||
{
|
||||
$to_update = true;
|
||||
$this->id_address_delivery = $id_address_new;
|
||||
@@ -223,6 +223,12 @@ class CartCore extends ObjectModel
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
AND `id_address_delivery` = '.(int)$id_address;
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'customization`
|
||||
SET `id_address_delivery` = '.(int)$id_address_new.'
|
||||
WHERE `id_cart` = '.(int)$this->id.'
|
||||
AND `id_address_delivery` = '.(int)$id_address;
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
@@ -411,6 +417,12 @@ class CartCore extends ObjectModel
|
||||
return $this->_products;
|
||||
}
|
||||
|
||||
$shop_group = Shop::getGroupFromShop(Shop::getContextShopID(), false);
|
||||
if ($shop_group['share_order'])
|
||||
$id_shop = 'cp.id_shop';
|
||||
else
|
||||
$id_shop = (int)Shop::getContextShopID();
|
||||
|
||||
if (!$id_country)
|
||||
$id_country = Context::getContext()->country->id;
|
||||
|
||||
@@ -431,10 +443,10 @@ class CartCore extends ObjectModel
|
||||
|
||||
// Build JOIN
|
||||
$sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
||||
$sql->innerJoin('product_shop', 'product_shop', 'product_shop.id_shop='.$id_shop);
|
||||
$sql->leftJoin('product_lang', 'pl', '
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('pl')
|
||||
AND pl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('pl', $id_shop)
|
||||
);
|
||||
|
||||
$sql->leftJoin('tax_rule', 'tr', '
|
||||
@@ -451,7 +463,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
$sql->leftJoin('category_lang', 'cl', '
|
||||
product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('cl')
|
||||
AND cl.`id_lang` = '.(int)$this->id_lang.Shop::addSqlRestrictionOnLang('cl', $id_shop)
|
||||
);
|
||||
|
||||
// @todo test if everything is ok, then refactorise call of this method
|
||||
@@ -492,7 +504,7 @@ class CartCore extends ObjectModel
|
||||
');
|
||||
|
||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product_attribute` = cp.`id_product_attribute`');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
|
||||
$sql->leftJoin('product_attribute_shop', 'product_attribute_shop', 'product_attribute_shop.id_shop='.$id_shop);
|
||||
$sql->leftJoin('product_attribute_image', 'pai', 'pai.`id_product_attribute` = pa.`id_product_attribute`');
|
||||
$sql->leftJoin('image_lang', 'il', 'il.id_image = pai.id_image AND il.id_lang = '.(int)$this->id_lang);
|
||||
}
|
||||
@@ -519,6 +531,7 @@ class CartCore extends ObjectModel
|
||||
if (empty($result))
|
||||
return array();
|
||||
|
||||
$cart_shop_context = Context::getContext()->cloneContext();
|
||||
foreach ($result as $row)
|
||||
{
|
||||
if (isset($row['ecotax_attr']) && $row['ecotax_attr'] > 0)
|
||||
@@ -538,6 +551,9 @@ class CartCore extends ObjectModel
|
||||
if (!Address::addressExists($address_id))
|
||||
$address_id = null;
|
||||
|
||||
if ($cart_shop_context->shop->id != $row['id_shop'])
|
||||
$cart_shop_context->shop = new Shop((int)$row['id_shop']);
|
||||
|
||||
if ($this->_taxCalculationMethod == PS_TAX_EXC)
|
||||
{
|
||||
$row['price'] = Product::getPriceStatic(
|
||||
@@ -553,7 +569,10 @@ class CartCore extends ObjectModel
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$specific_price_output
|
||||
$specific_price_output,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
); // Here taxes are computed only once the quantity has been applied to the product price
|
||||
|
||||
$row['price_wt'] = Product::getPriceStatic(
|
||||
@@ -568,7 +587,11 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null)
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
);
|
||||
|
||||
$tax_rate = Tax::getProductTaxRate((int)$row['id_product'], (int)$address_id);
|
||||
@@ -582,7 +605,7 @@ class CartCore extends ObjectModel
|
||||
(int)$row['id_product'],
|
||||
false,
|
||||
(int)$row['id_product_attribute'],
|
||||
6,
|
||||
2,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
@@ -591,7 +614,10 @@ class CartCore extends ObjectModel
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$specific_price_output
|
||||
$specific_price_output,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
);
|
||||
|
||||
$row['price_wt'] = Product::getPriceStatic(
|
||||
@@ -606,9 +632,13 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null)
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$cart_shop_context
|
||||
);
|
||||
|
||||
|
||||
// In case when you use QuantityDiscount, getPriceStatic() can be return more of 2 decimals
|
||||
$row['price_wt'] = Tools::ps_round($row['price_wt'], 2);
|
||||
$row['total_wt'] = $row['price_wt'] * (int)$row['cart_quantity'];
|
||||
@@ -618,10 +648,11 @@ class CartCore extends ObjectModel
|
||||
if (!isset($row['pai_id_image']) || $row['pai_id_image'] == 0)
|
||||
{
|
||||
$row2 = Db::getInstance()->getRow('
|
||||
SELECT i.`id_image`, il.`legend`
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
|
||||
WHERE i.`id_product` = '.(int)$row['id_product'].' AND i.`cover` = 1'
|
||||
SELECT image_shop.`id_image` id_image, il.`legend`
|
||||
FROM `'._DB_PREFIX_.'image` i'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$this->id_lang.')
|
||||
WHERE i.`id_product` = '.(int)$row['id_product'].' AND image_shop.`cover` = 1'
|
||||
);
|
||||
|
||||
if (!$row2)
|
||||
@@ -780,8 +811,9 @@ class CartCore extends ObjectModel
|
||||
$sql .= '
|
||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||
AND cp.`id_product_attribute` = '.(int)$id_product_attribute.'
|
||||
AND cp.`id_cart` = '.(int)$this->id.'
|
||||
AND cp.`id_address_delivery` = '.(int)$id_address_delivery;
|
||||
AND cp.`id_cart` = '.(int)$this->id;
|
||||
if (Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery())
|
||||
$sql .= ' AND cp.`id_address_delivery` = '.(int)$id_address_delivery;
|
||||
|
||||
if ($id_customization)
|
||||
$sql .= ' AND c.`id_customization` = '.(int)$id_customization;
|
||||
@@ -885,7 +917,7 @@ class CartCore extends ObjectModel
|
||||
SET `quantity` = `quantity` '.$qty.', `date_add` = NOW()
|
||||
WHERE `id_product` = '.(int)$id_product.
|
||||
(!empty($id_product_attribute) ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '').'
|
||||
AND `id_cart` = '.(int)$this->id.' AND `id_address_delivery` = '.(int)$id_address_delivery.'
|
||||
AND `id_cart` = '.(int)$this->id.(Configuration::get('PS_ALLOW_MULTISHIPPING') && $this->isMultiAddressDelivery() ? ' AND `id_address_delivery` = '.(int)$id_address_delivery : '').'
|
||||
LIMIT 1'
|
||||
);
|
||||
}
|
||||
@@ -1336,6 +1368,9 @@ class CartCore extends ObjectModel
|
||||
|
||||
foreach ($products as $product) // products refer to the cart details
|
||||
{
|
||||
if ($virtual_context->shop->id != $product['id_shop'])
|
||||
$virtual_context->shop = new Shop((int)$product['id_shop']);
|
||||
|
||||
if (Configuration::get('PS_TAX_ADDRESS_TYPE') == 'id_address_invoice')
|
||||
$address_id = (int)$this->id_address_invoice;
|
||||
else
|
||||
@@ -1358,7 +1393,11 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
(int)$this->id_customer ? (int)$this->id_customer : null,
|
||||
(int)$this->id,
|
||||
$address_id
|
||||
$address_id,
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$virtual_context
|
||||
);
|
||||
|
||||
$total_ecotax = $product['ecotax'] * (int)$product['cart_quantity'];
|
||||
@@ -1366,7 +1405,7 @@ class CartCore extends ObjectModel
|
||||
|
||||
if ($with_taxes)
|
||||
{
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id);
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context);
|
||||
$product_eco_tax_rate = Tax::getProductEcotaxRate((int)$address_id);
|
||||
|
||||
$total_price = ($total_price - $total_ecotax) * (1 + $product_tax_rate / 100);
|
||||
@@ -1388,14 +1427,18 @@ class CartCore extends ObjectModel
|
||||
false,
|
||||
((int)$this->id_customer ? (int)$this->id_customer : null),
|
||||
(int)$this->id,
|
||||
((int)$address_id ? (int)$address_id : null)
|
||||
((int)$address_id ? (int)$address_id : null),
|
||||
$null,
|
||||
true,
|
||||
true,
|
||||
$virtual_context
|
||||
);
|
||||
|
||||
$total_price = Tools::ps_round($price, 2) * (int)$product['cart_quantity'];
|
||||
|
||||
if (!$with_taxes)
|
||||
{
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id);
|
||||
$product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context);
|
||||
$total_price = Tools::ps_round($total_price / (1 + ($product_tax_rate / 100)), 2);
|
||||
}
|
||||
}
|
||||
@@ -2932,6 +2975,12 @@ class CartCore extends ObjectModel
|
||||
{
|
||||
return $this->_addCustomization($id_product, 0, $index, $type, $file, 0);
|
||||
}
|
||||
|
||||
public function deletePictureToProduct($id_product, $index)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->deleteCustomizationToProduct($id_product, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a customer's customization
|
||||
|
||||
+15
-10
@@ -80,6 +80,9 @@ class CategoryCore extends ObjectModel
|
||||
/** @var boolean is Category Root */
|
||||
public $is_root_category;
|
||||
|
||||
/** @var integer */
|
||||
public $id_shop_default;
|
||||
|
||||
public $groupBox;
|
||||
|
||||
protected static $_links = array();
|
||||
@@ -606,7 +609,7 @@ class CategoryCore extends ObjectModel
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`,
|
||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image`,
|
||||
il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default,
|
||||
DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),
|
||||
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).'
|
||||
@@ -627,10 +630,10 @@ class CategoryCore extends ObjectModel
|
||||
ON (p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i
|
||||
ON (i.`id_product` = p.`id_product`
|
||||
AND i.`cover` = 1)
|
||||
ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
|
||||
ON (i.`id_image` = il.`id_image`
|
||||
ON (image_shop.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr
|
||||
ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -645,8 +648,8 @@ class CategoryCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
|
||||
ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
WHERE product_shop.`id_shop` = '.(int)$context->shop->id.'
|
||||
AND ((product_attribute_shop.id_product_attribute IS NOT NULL OR pa.id_product_attribute IS NULL)
|
||||
OR (product_attribute_shop.id_product_attribute IS NULL AND pa.default_on=1))
|
||||
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop='.(int)$context->shop->id.')
|
||||
AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$context->shop->id.')
|
||||
AND cp.`id_category` = '.(int)$this->id
|
||||
.($active ? ' AND product_shop.`active` = 1' : '')
|
||||
.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
|
||||
@@ -775,14 +778,14 @@ class CategoryCore extends ObjectModel
|
||||
)' : '0').' AS nbSelectedSubCat
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` '.Shop::addSqlRestrictionOnLang('cl', $id_shop).')';
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
|
||||
$sql .= ' WHERE `id_lang` = '.(int)$id_lang;
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
$sql .= ' AND cs.`id_shop` = '.(int)$shop->id;
|
||||
$sql .= ' AND c.`id_parent` = '.(int)$id_parent;
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
if (!Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
|
||||
$sql .= ' ORDER BY cs.`position` ASC';
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
@@ -940,7 +943,9 @@ class CategoryCore extends ObjectModel
|
||||
*/
|
||||
public function getParentsCategories($id_lang = null)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$context = Context::getContext()->cloneContext();
|
||||
$context->shop = clone($context->shop);
|
||||
|
||||
if (is_null($id_lang))
|
||||
$id_lang = $context->language->id;
|
||||
|
||||
|
||||
+18
-1
@@ -108,6 +108,20 @@ class CombinationCore extends ObjectModel
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
if (!parent::add($autodate, $null_values))
|
||||
return false;
|
||||
|
||||
$product = new Product((int)$this->id_product);
|
||||
if ($product->getType() == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock((int)$this->id_product, 1, null, (int)$this->id);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock((int)$this->id_product, StockAvailable::outOfStock((int)$this->id_product), null, $this->id);
|
||||
|
||||
SpecificPriceRule::applyAllRules(array((int)$this->id_product));
|
||||
}
|
||||
|
||||
public function deleteAssociations()
|
||||
{
|
||||
@@ -185,7 +199,10 @@ class CombinationCore extends ObjectModel
|
||||
|
||||
public function setWsImages($values)
|
||||
{
|
||||
return $this->setImages($values);
|
||||
$ids_images = array();
|
||||
foreach ($values as $value)
|
||||
$ids_images[] = (int)$value['id'];
|
||||
return $this->setImages($ids_images);
|
||||
}
|
||||
|
||||
public function getAttributesName($id_lang)
|
||||
|
||||
+7
-1
@@ -121,7 +121,7 @@ class ContextCore
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
case 2: // Only for touchpads
|
||||
if ($this->mobile_detect->isTablet() && !$this->mobile_detect->is_mobile())
|
||||
if ($this->mobile_detect->isTablet() && $this->mobile_detect->isMobile())
|
||||
$this->mobile_device = true;
|
||||
break;
|
||||
case 3: // For touchpad or mobile devices
|
||||
@@ -137,6 +137,12 @@ class ContextCore
|
||||
|
||||
protected function checkMobileContext()
|
||||
{
|
||||
// Check mobile context
|
||||
if (Tools::isSubmit('no_mobile_theme'))
|
||||
Context::getContext()->cookie->no_mobile = true;
|
||||
else if (Tools::isSubmit('mobile_theme_ok'))
|
||||
Context::getContext()->cookie->no_mobile = false;
|
||||
|
||||
return isset($_SERVER['HTTP_USER_AGENT'])
|
||||
&& isset(Context::getContext()->cookie)
|
||||
&& (bool)Configuration::get('PS_ALLOW_MOBILE_DEVICE')
|
||||
|
||||
+13
-6
@@ -82,7 +82,10 @@ class CookieCore
|
||||
protected function getDomain($shared_urls = null)
|
||||
{
|
||||
$r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
|
||||
preg_match ($r, Tools::getHttpHost(false, false), $out);
|
||||
|
||||
if (!preg_match ($r, Tools::getHttpHost(false, false), $out) || !isset($out[4]))
|
||||
return false;
|
||||
|
||||
if (preg_match('/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9]).)'.
|
||||
'{1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]).)'.
|
||||
'{2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/', $out[4]))
|
||||
@@ -156,7 +159,6 @@ class CookieCore
|
||||
if (!$this->_modified && (!isset($this->_content[$key]) || (isset($this->_content[$key]) && $this->_content[$key] != $value)))
|
||||
$this->_modified = true;
|
||||
$this->_content[$key] = $value;
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +171,6 @@ class CookieCore
|
||||
if (isset($this->_content[$key]))
|
||||
$this->_modified = true;
|
||||
unset($this->_content[$key]);
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +218,6 @@ class CookieCore
|
||||
$this->_setcookie();
|
||||
unset($_COOKIE[$this->_name]);
|
||||
$this->_modified = true;
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,7 +241,6 @@ class CookieCore
|
||||
unset($this->_content['id_address_invoice']);
|
||||
unset($this->_content['id_address_delivery']);
|
||||
$this->_modified = true;
|
||||
$this->write();
|
||||
}
|
||||
|
||||
public function makeNewLog()
|
||||
@@ -317,11 +316,19 @@ class CookieCore
|
||||
return setcookie($this->_name, $content, $time, $this->_path, $this->_domain, 0, true);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->write();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save cookie with setcookie()
|
||||
*/
|
||||
public function write()
|
||||
{
|
||||
if (!$this->_modified || headers_sent())
|
||||
return;
|
||||
|
||||
$cookie = '';
|
||||
|
||||
/* Serialize cookie content */
|
||||
@@ -331,7 +338,7 @@ class CookieCore
|
||||
|
||||
/* Add checksum to cookie */
|
||||
$cookie .= 'checksum|'.crc32($this->_iv.$cookie);
|
||||
|
||||
$this->_modified = false;
|
||||
/* Cookies are encrypted for evident security reasons */
|
||||
return $this->_setcookie($cookie);
|
||||
}
|
||||
|
||||
@@ -344,4 +344,30 @@ class CountryCore extends ObjectModel
|
||||
|
||||
return (bool)preg_match($zip_regexp, $zip_code);
|
||||
}
|
||||
|
||||
public static function addModuleRestrictions(array $shops = array(), array $countries = array(), array $modules = array())
|
||||
{
|
||||
if (!count($shops))
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
|
||||
if (!count($countries))
|
||||
$countries = Country::getCountries((int)Context::getContext()->cookie->id_lang);
|
||||
|
||||
if (!count($modules))
|
||||
$modules = Module::getPaymentModules();
|
||||
|
||||
$sql = false;
|
||||
foreach ($shops as $id_shop)
|
||||
foreach ($countries as $country)
|
||||
foreach ($modules as $module)
|
||||
$sql .= '('.(int)$module['id_module'].', '.(int)$id_shop.', '.(int)$country['id_country'].'),';
|
||||
|
||||
if ($sql)
|
||||
{
|
||||
$sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.'module_country` (`id_module`, `id_shop`, `id_country`) VALUES '.rtrim($sql, ',');
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+32
-5
@@ -240,14 +240,41 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($addresses as $address)
|
||||
if (!count(Order::getCustomerOrders((int)$this->id)))
|
||||
{
|
||||
$obj = new Address((int)$address['id_address']);
|
||||
$obj->delete();
|
||||
$addresses = $this->getAddresses((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
foreach ($addresses as $address)
|
||||
{
|
||||
$obj = new Address((int)$address['id_address']);
|
||||
$obj->delete();
|
||||
}
|
||||
}
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'customer_group` WHERE `id_customer` = '.(int)$this->id);
|
||||
Discount::deleteByIdCustomer((int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'message WHERE id_customer='.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'specific_price WHERE id_customer='.(int)$this->id);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'compare WHERE id_customer='.(int)$this->id);
|
||||
|
||||
$carts = Db::getInstance()->executes('SELECT id_cart
|
||||
FROM '._DB_PREFIX_.'cart
|
||||
WHERE id_customer='.(int)$this->id);
|
||||
if ($carts)
|
||||
foreach ($carts as $cart)
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart WHERE id_cart='.(int)$cart['id_cart']);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_product WHERE id_cart='.(int)$cart['id_cart']);
|
||||
}
|
||||
|
||||
$cts = Db::getInstance()->executes('SELECT id_customer_thread
|
||||
FROM '._DB_PREFIX_.'customer_thread
|
||||
WHERE id_customer='.(int)$this->id);
|
||||
if ($cts)
|
||||
foreach ($cts as $ct)
|
||||
{
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'customer_thread WHERE id_customer_thread='.(int)$ct['id_customer_thread']);
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'customer_message WHERE id_customer_thread='.(int)$ct['id_customer_thread']);
|
||||
}
|
||||
|
||||
CartRule::deleteByIdCustomer((int)$this->id);
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ class DispatcherCore
|
||||
$this->default_controller = 'adminhome';
|
||||
$this->use_routes = false;
|
||||
}
|
||||
else if (Tools::getValue('fc') == 'module')
|
||||
elseif (Tools::getValue('fc') == 'module')
|
||||
{
|
||||
$this->front_controller = self::FC_MODULE;
|
||||
$this->controller_not_found = 'pagenotfound';
|
||||
@@ -287,6 +287,7 @@ class DispatcherCore
|
||||
case self::FC_ADMIN :
|
||||
$tab = Tab::getInstanceFromClassName($this->controller);
|
||||
$retrocompatibility_admin_tab = null;
|
||||
|
||||
if ($tab->module)
|
||||
{
|
||||
if (file_exists(_PS_MODULE_DIR_.$tab->module.'/'.$tab->class_name.'.php'))
|
||||
@@ -636,7 +637,7 @@ class DispatcherCore
|
||||
return $this->controller;
|
||||
|
||||
$controller = Tools::getValue('controller');
|
||||
|
||||
|
||||
if (isset($controller) && is_string($controller) && preg_match('/^([0-9a-z_-]+)\?(.*)=(.*)$/Ui', $controller, $m))
|
||||
{
|
||||
$controller = $m[1];
|
||||
@@ -648,7 +649,7 @@ class DispatcherCore
|
||||
|
||||
if (!Validate::isControllerName($controller))
|
||||
$controller = false;
|
||||
|
||||
|
||||
// Use routes ? (for url rewriting)
|
||||
if ($this->use_routes && !$controller)
|
||||
{
|
||||
|
||||
+6
-8
@@ -79,16 +79,14 @@ class FeatureCore extends ObjectModel
|
||||
* @return array Multiple arrays with feature's data
|
||||
* @static
|
||||
*/
|
||||
public static function getFeatures($id_lang)
|
||||
public static function getFeatures($id_lang, $with_shop = true)
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
'.Shop::addSqlAssociation('feature', 'f').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl
|
||||
ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
||||
ORDER BY f.`position` ASC
|
||||
');
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'feature` f
|
||||
'.($with_shop ? Shop::addSqlAssociation('feature', 'f') : '').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'feature_lang` fl ON (f.`id_feature` = fl.`id_feature` AND fl.`id_lang` = '.(int)$id_lang.')
|
||||
ORDER BY f.`position` ASC');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
-7
@@ -102,14 +102,16 @@ class GuestCore extends ObjectModel
|
||||
protected function getBrowser($userAgent)
|
||||
{
|
||||
$browserArray = array(
|
||||
'Google Chrome' => 'Chrome/',
|
||||
'Chrome' => 'Chrome/',
|
||||
'Safari' => 'Safari',
|
||||
'Firefox 3.x' => 'Firefox/3',
|
||||
'Firefox 2.x' => 'Firefox/2',
|
||||
'Safari iPad' => 'iPad',
|
||||
'Firefox' => 'Firefox/',
|
||||
'Opera' => 'Opera',
|
||||
'IE 8.x' => 'MSIE 8',
|
||||
'IE 7.x' => 'MSIE 7',
|
||||
'IE 6.x' => 'MSIE 6'
|
||||
'IE 10' => 'MSIE 10',
|
||||
'IE 9' => 'MSIE 9',
|
||||
'IE 8' => 'MSIE 8',
|
||||
'IE 7' => 'MSIE 7',
|
||||
'IE 6' => 'MSIE 6'
|
||||
);
|
||||
foreach ($browserArray as $k => $value)
|
||||
if (strstr($userAgent, $value))
|
||||
@@ -127,9 +129,12 @@ class GuestCore extends ObjectModel
|
||||
protected function getOs($userAgent)
|
||||
{
|
||||
$osArray = array(
|
||||
'Windows Vista' => 'Windows NT 6',
|
||||
'Windows 8' => 'Windows NT 6.2',
|
||||
'Windows 7' => 'Windows NT 6.1',
|
||||
'Windows Vista' => 'Windows NT 6.0',
|
||||
'Windows XP' => 'Windows NT 5',
|
||||
'MacOsX' => 'Mac OS X',
|
||||
'Android' => 'Android',
|
||||
'Linux' => 'X11'
|
||||
);
|
||||
foreach ($osArray as $k => $value)
|
||||
|
||||
+9
-4
@@ -64,7 +64,7 @@ class HookCore extends ObjectModel
|
||||
'table' => 'hook',
|
||||
'primary' => 'id_hook',
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 32),
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 64),
|
||||
'title' => array('type' => self::TYPE_STRING),
|
||||
'description' => array('type' => self::TYPE_HTML),
|
||||
'position' => array('type' => self::TYPE_BOOL),
|
||||
@@ -112,7 +112,7 @@ class HookCore extends ObjectModel
|
||||
public static function getIdByName($hook_name)
|
||||
{
|
||||
if (!Validate::isHookName($hook_name))
|
||||
throw new PrestaShopException('Invalid hook name');
|
||||
return false;
|
||||
|
||||
$cache_id = 'hook_idbyname_'.$hook_name;
|
||||
if (!Cache::isStored($cache_id))
|
||||
@@ -273,8 +273,13 @@ class HookCore extends ObjectModel
|
||||
if ($hook_name != 'displayPayment')
|
||||
$sql->where('h.name != "displayPayment"');
|
||||
// For payment modules, we check that they are available in the contextual country
|
||||
elseif ($frontend && Validate::isLoadedObject($context->country))
|
||||
$sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' LIMIT 1) = '.(int)$context->country->id.')');
|
||||
elseif ($frontend)
|
||||
{
|
||||
if (Validate::isLoadedObject($context->country))
|
||||
$sql->where('(h.name = "displayPayment" AND (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' LIMIT 1) = '.(int)$context->country->id.')');
|
||||
if (Validate::isLoadedObject($context->currency))
|
||||
$sql->where('(h.name = "displayPayment" AND (SELECT id_currency FROM '._DB_PREFIX_.'module_currency mcr WHERE mcr.id_module = m.id_module AND id_currency = '.(int)$context->currency->id.' LIMIT 1) = '.(int)$context->currency->id.')');
|
||||
}
|
||||
if (Validate::isLoadedObject($context->shop))
|
||||
$sql->where('hm.id_shop = '.(int)$context->shop->id);
|
||||
|
||||
|
||||
+22
-13
@@ -66,7 +66,7 @@ class ImageCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'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'),
|
||||
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'shop' => true),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -89,9 +89,13 @@ class ImageCore extends ObjectModel
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!parent::delete() ||
|
||||
!$this->deleteProductAttributeImage() ||
|
||||
!$this->deleteImage())
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
|
||||
if ($this->hasMultishopEntries())
|
||||
return true;
|
||||
|
||||
if (!$this->deleteProductAttributeImage() || !$this->deleteImage())
|
||||
return false;
|
||||
|
||||
// update positions
|
||||
@@ -185,12 +189,17 @@ class ImageCore extends ObjectModel
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg'))
|
||||
unlink(_PS_TMP_IMG_DIR_.'product_'.$id_product.'.jpg');
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
|
||||
return (Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0
|
||||
WHERE `id_product` = '.(int)$id_product
|
||||
);
|
||||
) &&
|
||||
Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image` i, `'._DB_PREFIX_.'image_shop` image_shop
|
||||
SET image_shop.`cover` = 0
|
||||
WHERE image_shop.id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).') AND image_shop.id_image = i.id_image AND i.`id_product` = '.(int)$id_product
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,10 +211,10 @@ class ImageCore extends ObjectModel
|
||||
public static function getCover($id_product)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT * FROM `'._DB_PREFIX_.'image`
|
||||
SELECT * FROM `'._DB_PREFIX_.'image` i'.
|
||||
Shop::addSqlAssociation('image', 'i').'
|
||||
WHERE `id_product` = '.(int)$id_product.'
|
||||
AND `cover`= 1
|
||||
');
|
||||
AND image_shop.`cover`= 1');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -589,9 +598,9 @@ class ImageCore extends ObjectModel
|
||||
// image exists in DB and with the correct product?
|
||||
if (Validate::isLoadedObject($image) && $image->id_product == (int)rtrim($matches[1], '-'))
|
||||
{
|
||||
// create the new folder if it does not exist
|
||||
if (!$image->createImgFolder())
|
||||
return false;
|
||||
// create the new folder if it does not exist
|
||||
if (!$image->createImgFolder())
|
||||
return false;
|
||||
|
||||
// if there's already a file at the new image path, move it to a dump folder
|
||||
// most likely the preexisting image is a demo image not linked to a product and it's ok to replace it
|
||||
|
||||
@@ -75,7 +75,11 @@ class ImageManagerCore
|
||||
ImageManager::resize($image, _PS_TMP_IMG_DIR_.$cache_image, $ratio_x, $size, $image_type);
|
||||
}
|
||||
}
|
||||
return '<img src="'._PS_TMP_IMG_.$cache_image.(!$disable_cache ? '?time='.time() : '').'" alt="" class="imgm" />';
|
||||
// Relative link will always work, whatever the base uri set in the admin
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
return '<img src="../img/tmp/'.$cache_image.(!$disable_cache ? '?time='.time() : '').'" alt="" class="imgm" />';
|
||||
else
|
||||
return '<img src="'._PS_TMP_IMG_.$cache_image.(!$disable_cache ? '?time='.time() : '').'" alt="" class="imgm" />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+22
-11
@@ -260,7 +260,7 @@ class LanguageCore extends ObjectModel
|
||||
$mPath_to = _PS_MAIL_DIR_.(string)$iso_to.'/';
|
||||
}
|
||||
|
||||
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php');
|
||||
$lFiles = array('admin.php', 'errors.php', 'fields.php', 'pdf.php', 'tabs.php', 'index.php');
|
||||
|
||||
// Added natives mails files
|
||||
$mFiles = array(
|
||||
@@ -295,7 +295,7 @@ class LanguageCore extends ObjectModel
|
||||
'test.html', 'test.txt',
|
||||
'voucher.html', 'voucher.txt',
|
||||
'voucher_new.html', 'voucher_new.txt',
|
||||
'order_changed.html', 'order_changed.txt'
|
||||
'order_changed.html', 'order_changed.txt', 'index.php'
|
||||
);
|
||||
|
||||
$number = -1;
|
||||
@@ -472,7 +472,7 @@ class LanguageCore extends ObjectModel
|
||||
// Database translations deletion
|
||||
$result = Db::getInstance()->executeS('SHOW TABLES FROM `'._DB_NAME_.'`');
|
||||
foreach ($result as $row)
|
||||
if (preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]))
|
||||
if (isset($row['Tables_in_'._DB_NAME_]) && !empty($row['Tables_in_'._DB_NAME_]) && preg_match('/_lang/', $row['Tables_in_'._DB_NAME_]))
|
||||
if (!Db::getInstance()->execute('DELETE FROM `'.$row['Tables_in_'._DB_NAME_].'` WHERE `id_lang` = '.(int)$this->id))
|
||||
return false;
|
||||
|
||||
@@ -515,7 +515,14 @@ class LanguageCore extends ObjectModel
|
||||
if (!$this->hasMultishopEntries())
|
||||
{
|
||||
// delete images
|
||||
$files_copy = array('/en.jpg', '/en-default-thickbox.jpg', '/en-default-home.jpg', '/en-default-large.jpg', '/en-default-medium.jpg', '/en-default-small.jpg', '/en-default-large_scene.jpg');
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-thickbox_default.jpg',
|
||||
'/en-default-home_default.jpg',
|
||||
'/en-default-large_default.jpg',
|
||||
'/en-default-medium_default.jpg',
|
||||
'/en-default-small_default.jpg'
|
||||
);
|
||||
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
foreach ($tos as $to)
|
||||
foreach ($files_copy as $file)
|
||||
@@ -718,14 +725,18 @@ class LanguageCore extends ObjectModel
|
||||
else
|
||||
Language::_copyNoneFlag($insert_id);
|
||||
|
||||
$files_copy = array('/en.jpg', '/en-default-thickbox.jpg', '/en-default-home.jpg', '/en-default-large.jpg', '/en-default-medium.jpg', '/en-default-small.jpg', '/en-default-large_scene.jpg');
|
||||
$tos = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
foreach ($tos as $to)
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-thickbox_default.jpg',
|
||||
'/en-default-home_default.jpg',
|
||||
'/en-default-large_default.jpg',
|
||||
'/en-default-medium_default.jpg',
|
||||
'/en-default-small_default.jpg',
|
||||
'/en-default-scene_default.jpg'
|
||||
);
|
||||
foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to)
|
||||
foreach ($files_copy as $file)
|
||||
{
|
||||
$name = str_replace('/en', '/'.$iso_code, $file);
|
||||
copy(dirname(__FILE__).'/../img/l'.$file, $to.$name);
|
||||
}
|
||||
@copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
+4
-4
@@ -109,7 +109,6 @@ class LinkCore
|
||||
$params['id'] = $product->id;
|
||||
$params['rewrite'] = (!$alias) ? $product->getFieldByLang('link_rewrite') : $alias;
|
||||
$params['ean13'] = (!$ean13) ? $product->ean13 : $ean13;
|
||||
$params['category'] = (!$category) ? $product->category : $category;
|
||||
$params['meta_keywords'] = Tools::str2url($product->getFieldByLang('meta_keywords'));
|
||||
$params['meta_title'] = Tools::str2url($product->getFieldByLang('meta_title'));
|
||||
|
||||
@@ -130,6 +129,7 @@ class LinkCore
|
||||
|
||||
if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories'))
|
||||
{
|
||||
$params['category'] = (!$category) ? $product->category : $category;
|
||||
$cats = array();
|
||||
foreach ($product->getParentCategories() as $cat)
|
||||
$cats[] = $cat['link_rewrite'];
|
||||
@@ -355,9 +355,9 @@ class LinkCore
|
||||
$theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : '');
|
||||
if ((Configuration::get('PS_LEGACY_IMAGES')
|
||||
&& (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg')))
|
||||
|| strpos($ids, 'default') !== false)
|
||||
|| ($not_default = strpos($ids, 'default') !== false))
|
||||
{
|
||||
if ($this->allow == 1)
|
||||
if ($this->allow == 1 && !$not_default)
|
||||
$uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg';
|
||||
else
|
||||
$uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg';
|
||||
@@ -408,7 +408,7 @@ class LinkCore
|
||||
$request = urlencode($request);
|
||||
parse_str($request, $request);
|
||||
}
|
||||
unset($request['controller']);
|
||||
unset($request['controller'], $request['module']);
|
||||
|
||||
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request);
|
||||
$url = ($ssl && $this->ssl_enable) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true);
|
||||
|
||||
@@ -53,9 +53,7 @@ class LocalizationPackCore
|
||||
$res &= $this->installConfiguration($xml);
|
||||
$res &= $this->installModules($xml);
|
||||
$res &= $this->updateDefaultGroupDisplayMethod($xml);
|
||||
|
||||
if (!defined('_PS_MODE_DEV_') || !_PS_MODE_DEV_)
|
||||
$res &= $this->_installLanguages($xml, $install_mode);
|
||||
$res &= $this->_installLanguages($xml, $install_mode);
|
||||
|
||||
if ($res && isset($this->iso_code_lang))
|
||||
{
|
||||
@@ -158,9 +156,9 @@ class LocalizationPackCore
|
||||
$tax->rate = (float)$attributes['rate'];
|
||||
$tax->active = 1;
|
||||
|
||||
if (!$tax->validateFields())
|
||||
if (($error = $tax->validateFields(false, true)) !== true || ($error = $tax->validateFieldsLang(false, true)) !== true)
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Invalid tax properties.');
|
||||
$this->_errors[] = Tools::displayError('Invalid tax properties.').' '.$error;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -301,44 +299,46 @@ class LocalizationPackCore
|
||||
$native_iso_code = array();
|
||||
foreach ($native_lang as $lang)
|
||||
$native_iso_code[] = $lang['iso_code'];
|
||||
if ((in_array((string)$attributes['iso_code'], $native_iso_code) && !$install_mode)
|
||||
|| !in_array((string)$attributes['iso_code'], $native_iso_code))
|
||||
// if we are not in an installation context or if the pack is not available in the local directory
|
||||
if (!$install_mode || !in_array((string)$attributes['iso_code'], $native_iso_code))
|
||||
{
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
if (@fsockopen('api.prestashop.com', 80, $errno, $errstr, 10))
|
||||
if (!@fsockopen('api.prestashop.com', 80, $errno, $errstr, 5))
|
||||
$this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
elseif (!($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code']))))
|
||||
$this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
|
||||
{
|
||||
if ($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code'])))
|
||||
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
|
||||
if (file_put_contents($file, $content))
|
||||
{
|
||||
if ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
|
||||
$gz = new Archive_Tar($file, true);
|
||||
$files_list = $gz->listContent();
|
||||
|
||||
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
{
|
||||
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
|
||||
if (file_put_contents($file, $content))
|
||||
{
|
||||
$gz = new Archive_Tar($file, true);
|
||||
|
||||
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
$this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AdminTranslationsController::checkAndAddMailsFiles($attributes['iso_code'], $files_list);
|
||||
AdminTranslationsController::addNewTabs($attributes['iso_code'], $files_list);
|
||||
}
|
||||
|
||||
if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
|
||||
{
|
||||
$this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
|
||||
return false;
|
||||
}
|
||||
|
||||
@unlink($file);
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||
}
|
||||
}
|
||||
|
||||
// change the default language if there is only one language in the localization pack
|
||||
|
||||
@@ -323,7 +323,7 @@ class ManufacturerCore extends ObjectModel
|
||||
$alias = 'p.';
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pa.`id_product_attribute`,
|
||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
|
||||
pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
||||
pl.`meta_title`, pl.`name`, image_shop.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`,
|
||||
DATEDIFF(
|
||||
product_shop.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -340,7 +340,8 @@ class ManufacturerCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i
|
||||
ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il
|
||||
ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr
|
||||
@@ -367,6 +368,7 @@ class ManufacturerCore extends ObjectModel
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY '.$alias.pSQL($order_by).' '.pSQL($order_way).'
|
||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||
|
||||
|
||||
+13
-4
@@ -221,7 +221,12 @@ class MediaCore
|
||||
if (!preg_match('/^http(s?):\/\//i', $file_uri) && !@filemtime($file_uri))
|
||||
return false;
|
||||
|
||||
// adding file to the big array...;
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
{
|
||||
$js_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $js_uri);
|
||||
$js_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$js_uri;
|
||||
}
|
||||
|
||||
return $js_uri;
|
||||
}
|
||||
|
||||
@@ -243,9 +248,12 @@ class MediaCore
|
||||
if (!@filemtime($file_uri))
|
||||
return false;
|
||||
|
||||
// adding file to the big array...
|
||||
if (is_array($css_uri))
|
||||
return $css_uri;
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
{
|
||||
$css_uri = preg_replace('/^'.preg_quote(__PS_BASE_URI__, '/').'/', '/', $css_uri);
|
||||
$css_uri = dirname(preg_replace('/\?.+$/', '', $_SERVER['REQUEST_URI']).'a').'/..'.$css_uri;
|
||||
}
|
||||
|
||||
return array($css_uri => $css_media_type);
|
||||
}
|
||||
|
||||
@@ -269,6 +277,7 @@ class MediaCore
|
||||
$folder = _PS_JS_DIR_.'jquery/'; //set default folder
|
||||
//check if file exist
|
||||
$file = $folder.'jquery-'.$version.($minifier ? '.min.js' : '.js');
|
||||
|
||||
// remove PS_BASE_URI on _PS_ROOT_DIR_ for the following
|
||||
$url_data = parse_url($file);
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
|
||||
+10
-5
@@ -458,7 +458,7 @@ abstract class ObjectModelCore
|
||||
}
|
||||
|
||||
// Database insertion
|
||||
if (isset($this->id))
|
||||
if (isset($this->id) && !Tools::getValue('forceIDs'))
|
||||
unset($this->id);
|
||||
if (Shop::checkIdShopDefault($this->def['table']))
|
||||
$this->id_shop_default = min($id_shop_list);
|
||||
@@ -545,7 +545,7 @@ abstract class ObjectModelCore
|
||||
if (count($this->id_shop_list) > 0)
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
|
||||
if (Shop::checkIdShopDefault($this->def['table']))
|
||||
if (Shop::checkIdShopDefault($this->def['table']) && !$this->id_shop_default)
|
||||
$this->id_shop_default = min($id_shop_list);
|
||||
// Database update
|
||||
if (!$result = ObjectModel::$db->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, $null_values))
|
||||
@@ -870,8 +870,8 @@ abstract class ObjectModelCore
|
||||
$size = array('min' => 0, 'max' => $data['size']);
|
||||
|
||||
$length = Tools::strlen($value);
|
||||
if ($length < $size['min'] || $length > $size)
|
||||
return 'Property '.get_class($this).'->'.$field.' has bad length ('.$length.') and must be between '.$size['min'].' and '.$size['max'];
|
||||
if ($length < $size['min'] || $length > $size['max'])
|
||||
return 'Property '.get_class($this).'->'.$field.' length ('.$length.') must be between '.$size['min'].' and '.$size['max'];
|
||||
}
|
||||
|
||||
// Check field validator
|
||||
@@ -911,8 +911,13 @@ abstract class ObjectModelCore
|
||||
public function validateController($htmlentities = true)
|
||||
{
|
||||
$errors = array();
|
||||
$required_fields_database = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
|
||||
foreach ($this->def['fields'] as $field => $data)
|
||||
{
|
||||
// Check if field is required by user
|
||||
if (in_array($field, $required_fields_database))
|
||||
$data['required'] = true;
|
||||
|
||||
// Checking for required fields
|
||||
if (isset($data['required']) && $data['required'] && ($value = Tools::getValue($field, $this->{$field})) == false && (string)$value != '0')
|
||||
if (!$this->id || $field != 'passwd')
|
||||
@@ -1035,7 +1040,7 @@ abstract class ObjectModelCore
|
||||
$multi_shop_join = ' LEFT JOIN `'._DB_PREFIX_.bqSQL($this->def['table']).'_'.bqSQL($assoc['type']).'`
|
||||
AS `multi_shop_'.bqSQL($this->def['table']).'`
|
||||
ON (main.`'.bqSQL($this->def['primary']).'` = `multi_shop_'.bqSQL($this->def['table']).'`.`'.bqSQL($this->def['primary']).'`)';
|
||||
$sql_filter = 'AND id_shop = '.Context::getContext()->shop->id.' '.$sql_filter;
|
||||
$sql_filter = 'AND `multi_shop_'.bqSQL($this->def['table']).'`.id_shop = '.Context::getContext()->shop->id.' '.$sql_filter;
|
||||
$sql_join = $multi_shop_join.' '.$sql_join;
|
||||
}
|
||||
else
|
||||
|
||||
+9
-5
@@ -126,13 +126,14 @@ class PackCore extends Product
|
||||
if (!Pack::isFeatureActive())
|
||||
return array();
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, product_shop.`id_category_default`, a.id_product_pack
|
||||
$sql = 'SELECT p.*, product_shop.*, pl.*, image_shop.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, product_shop.`id_category_default`, a.id_product_pack
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.id_product = pl.id_product
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
@@ -144,6 +145,7 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE product_shop.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
AND a.`id_product_pack` = '.(int)$id_product;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$full)
|
||||
@@ -170,11 +172,12 @@ class PackCore extends Product
|
||||
return array();
|
||||
|
||||
$sql = '
|
||||
SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`
|
||||
SELECT p.*, product_shop.*, pl.*, image_shop.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
@@ -183,7 +186,8 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
||||
'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
AND p.`id_product` IN ('.$packs.')';
|
||||
AND p.`id_product` IN ('.$packs.')
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))';
|
||||
if ($limit)
|
||||
$sql .= ' LIMIT '.(int)$limit;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
+10
-18
@@ -111,21 +111,13 @@ abstract class PaymentModuleCore extends Module
|
||||
*/
|
||||
public function addCheckboxCountryRestrictionsForModule(array $shops = array())
|
||||
{
|
||||
if (!$shops)
|
||||
$shops = Shop::getShops(true, null, true);
|
||||
|
||||
foreach ($shops as $s)
|
||||
{
|
||||
if (!Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'module_country` (`id_module`, `id_shop`, `id_country`)
|
||||
SELECT '.(int)$this->id.', "'.(int)$s.'", `id_country` FROM `'._DB_PREFIX_.'country` WHERE active = 1'))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
$countries = Country::getCountries((int)Context::getContext()->language->id, true); //get only active country
|
||||
$country_ids = array();
|
||||
foreach ($countries as $country)
|
||||
$country_ids[] = $country['id_country'];
|
||||
return Country::addModuleRestrictions($shops, $countries, array(array('id_module' => (int)$this->id)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate an order in database
|
||||
* Function called from a payment module
|
||||
@@ -491,9 +483,9 @@ abstract class PaymentModuleCore extends Module
|
||||
$old_message = Message::getMessageByCartId((int)$this->context->cart->id);
|
||||
if ($old_message)
|
||||
{
|
||||
$message = new Message((int)$old_message['id_message']);
|
||||
$message->id_order = (int)$order->id;
|
||||
$message->update();
|
||||
$update_message = new Message((int)$old_message['id_message']);
|
||||
$update_message->id_order = (int)$order->id;
|
||||
$update_message->update();
|
||||
|
||||
// Add this message in the customer thread
|
||||
$customer_thread = new CustomerThread();
|
||||
@@ -510,7 +502,7 @@ abstract class PaymentModuleCore extends Module
|
||||
$customer_message = new CustomerMessage();
|
||||
$customer_message->id_customer_thread = $customer_thread->id;
|
||||
$customer_message->id_employee = 0;
|
||||
$customer_message->message = htmlentities($message->message, ENT_COMPAT, 'UTF-8');
|
||||
$customer_message->message = htmlentities($update_message->message, ENT_COMPAT, 'UTF-8');
|
||||
$customer_message->private = 0;
|
||||
|
||||
if (!$customer_message->add())
|
||||
|
||||
+86
-43
@@ -301,6 +301,7 @@ class ProductCore extends ObjectModel
|
||||
'default_category' => array('type' => self::HAS_ONE, 'field' => 'id_category_default', 'object' => 'Category'),
|
||||
'tax_rules_group' => array('type' => self::HAS_ONE),
|
||||
'categories' => array('type' => self::HAS_MANY, 'field' => 'id_category', 'object' => 'Category', 'association' => 'category_product'),
|
||||
'stock_availables' => array('type' => self::HAS_MANY, 'field' => 'id_stock_available', 'object' => 'StockAvailable', 'association' => 'stock_availables'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -392,6 +393,13 @@ class ProductCore extends ObjectModel
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
)),
|
||||
'stock_availables' => array('resource' => 'stock_available',
|
||||
'fields' => array(
|
||||
'id' => array('required' => true),
|
||||
'id_product_attribute' => array('required' => true),
|
||||
),
|
||||
'setter' => false
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -453,6 +461,11 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!parent::add($autodate, $null_values))
|
||||
return false;
|
||||
|
||||
if ($this->getType() == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, 1);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, 2);
|
||||
|
||||
Hook::exec('actionProductSave', array('id_product' => $this->id));
|
||||
return true;
|
||||
@@ -474,10 +487,8 @@ class ProductCore extends ObjectModel
|
||||
die(Tools::displayError());
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int)$customer->id_default_group);
|
||||
}
|
||||
else if (Validate::isLoadedObject(Context::getContext()->customer))
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Context::getContext()->customer->id_default_group);
|
||||
else
|
||||
self::$_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
|
||||
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
|
||||
}
|
||||
|
||||
public static function getTaxCalculationMethod($id_customer = null)
|
||||
@@ -649,16 +660,17 @@ class ProductCore extends ObjectModel
|
||||
if ($real_quantity > $physical_quantity)
|
||||
return false;
|
||||
}
|
||||
$result = parent::delete();
|
||||
|
||||
// Removes the product from StockAvailable, for the current shop
|
||||
StockAvailable::removeProductFromStockAvailable($this->id);
|
||||
|
||||
$result = parent::delete();
|
||||
$result &= ($this->deleteProductAttributes() && $this->deleteImages() && $this->deleteSceneProducts());
|
||||
// If there are still entries in product_shop, don't remove completly the product
|
||||
if ($this->hasMultishopEntries())
|
||||
return true;
|
||||
|
||||
|
||||
Product::cleanPositions($this->id);
|
||||
|
||||
Hook::exec('actionProductDelete', array('product' => $this));
|
||||
if (!$result ||
|
||||
!GroupReduction::deleteProductReduction($this->id) ||
|
||||
@@ -1067,7 +1079,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$attributes_list = array();
|
||||
$res = true;
|
||||
|
||||
$default_on = 1;
|
||||
foreach ($combinations as $key => $combination)
|
||||
{
|
||||
$id_combination = (int)$this->productAttributeExists($attributes[$key], false, null, true, true);
|
||||
@@ -1082,6 +1094,9 @@ class ProductCore extends ObjectModel
|
||||
foreach ($combination as $field => $value)
|
||||
$obj->$field = $value;
|
||||
|
||||
$obj->default_on = $default_on;
|
||||
$default_on = 0;
|
||||
|
||||
$obj->save();
|
||||
|
||||
if (!$id_combination)
|
||||
@@ -1118,11 +1133,6 @@ class ProductCore extends ObjectModel
|
||||
if (!$id_product_attribute || !$result)
|
||||
return false;
|
||||
|
||||
if ($this->getType() == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, 1, null, $id_product_attribute);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock((int)$this->id, StockAvailable::outOfStock($this->id), null, $id_product_attribute);
|
||||
SpecificPriceRule::applyAllRules(array((int)$this->id));
|
||||
return $id_product_attribute;
|
||||
}
|
||||
|
||||
@@ -1641,7 +1651,10 @@ class ProductCore extends ObjectModel
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa').'
|
||||
WHERE pa.`id_product` = '.(int)$this->id.'
|
||||
GROUP BY pa.`id_product_attribute`');
|
||||
|
||||
|
||||
if (!$combinations)
|
||||
return false;
|
||||
|
||||
$product_attributes = array();
|
||||
foreach ($combinations as $combination)
|
||||
$product_attributes[] = (int)$combination['id_product_attribute'];
|
||||
@@ -1881,7 +1894,7 @@ class ProductCore extends ObjectModel
|
||||
$sql = new DbQuery();
|
||||
$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`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
DATEDIFF(
|
||||
product_shop.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -1898,7 +1911,8 @@ class ProductCore extends ObjectModel
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl')
|
||||
);
|
||||
$sql->leftJoin('image', 'i', 'i.`id_product` = p.`id_product` AND i.`cover` = 1');
|
||||
$sql->leftJoin('image', 'i', 'i.`id_product` = p.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1'));
|
||||
$sql->leftJoin('image_lang', 'il', 'i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang);
|
||||
$sql->leftJoin('tax_rule', 'tr', '
|
||||
product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -1909,6 +1923,7 @@ class ProductCore extends ObjectModel
|
||||
$sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`');
|
||||
|
||||
$sql->where('product_shop.`active` = 1');
|
||||
$sql->where('(image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1)');
|
||||
if ($front)
|
||||
$sql->where('product_shop.`visibility` IN ("both", "catalog")');
|
||||
$sql->where('
|
||||
@@ -1936,7 +1951,7 @@ class ProductCore extends ObjectModel
|
||||
$sql->select('pa.id_product_attribute');
|
||||
$sql->leftOuterJoin('product_attribute', 'pa', 'p.`id_product` = pa.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on = 1'));
|
||||
$sql->where('(pa.id_product_attribute IS NULL OR product_attribute_shop.id_product_attribute IS NOT NULL)');
|
||||
$sql->where('(pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop='.(int)$context->shop->id.')');
|
||||
}
|
||||
$sql->join(Product::sqlStock('p', Combination::isFeatureActive() ? 'product_attribute_shop' : 0));
|
||||
|
||||
@@ -1999,17 +2014,17 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
$ids_product = ' AND (';
|
||||
foreach ($product_reductions as $product_reduction)
|
||||
$ids_product .= '( p.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND pa.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
||||
$ids_product .= '( product_shop.`id_product` = '.(int)$product_reduction['id_product'].($product_reduction['id_product_attribute'] ? ' AND product_attribute_shop.`id_product_attribute`='.(int)$product_reduction['id_product_attribute'] :'').') OR';
|
||||
$ids_product = rtrim($ids_product, 'OR').')';
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
// Please keep 2 distinct queries because RAND() is an awful way to achieve this result
|
||||
$sql = 'SELECT p.id_product, pa.id_product_attribute
|
||||
$sql = 'SELECT product_shop.id_product, product_attribute_shop.id_product_attribute
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.id_product = pa.id_product)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (product_shop.id_product = pa.id_product)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on = 1').'
|
||||
WHERE product_shop.`active` = 1
|
||||
'.(($ids_product) ? $ids_product : '').'
|
||||
@@ -2019,7 +2034,9 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
GROUP BY p.id_product
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.default_on = 1)
|
||||
GROUP BY product_shop.id_product
|
||||
ORDER BY RAND()';
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -2029,14 +2046,15 @@ class ProductCore extends ObjectModel
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.`out_of_stock` out_of_stock, pl.`description`, pl.`description_short`,
|
||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
p.`ean13`, p.`upc`, i.`id_image`, il.`legend`, t.`rate`
|
||||
p.`ean13`, p.`upc`, image_shop.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
@@ -2044,8 +2062,12 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.id_product = '.(int)$id_product.'
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '');
|
||||
AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$context->shop->id.')';
|
||||
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (!$row)
|
||||
return false;
|
||||
|
||||
if ($result['id_product_attribute'])
|
||||
$row['id_product_attribute'] = $result['id_product_attribute'];
|
||||
return Product::getProductProperties($id_lang, $row);
|
||||
@@ -2120,9 +2142,9 @@ class ProductCore extends ObjectModel
|
||||
$order_by = explode('.', $order_by);
|
||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||
}
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, product_attribute_shop.id_product_attribute,
|
||||
pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`,
|
||||
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
pl.`name`, image_shop.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -2132,12 +2154,15 @@ class ProductCore extends ObjectModel
|
||||
) > 0 AS new
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product = p.id_product)
|
||||
'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on=1').'
|
||||
'.Product::sqlStock('p', 0, false, $context->shop).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
@@ -2146,6 +2171,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
WHERE product_shop.`active` = 1
|
||||
AND product_shop.`show_price` = 1
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
'.($front ? ' AND p.`visibility` IN ("both", "catalog")' : '').'
|
||||
'.((!$beginning && !$ending) ? ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')' : '').'
|
||||
AND p.`id_product` IN (
|
||||
@@ -2154,6 +2180,7 @@ class ProductCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND (pa.id_product_attribute IS NULL OR product_attribute_shop.default_on = 1)
|
||||
ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').pSQL($order_by).' '.pSQL($order_way).'
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
|
||||
@@ -2270,7 +2297,7 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$sql = 'SELECT i.`cover`, i.`id_image`, il.`legend`, i.`position`
|
||||
$sql = 'SELECT image_shop.`cover`, i.`id_image`, il.`legend`, i.`position`
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
'.Shop::addSqlAssociation('image', 'i').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
@@ -2289,11 +2316,11 @@ class ProductCore extends ObjectModel
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$sql = 'SELECT i.`id_image`
|
||||
$sql = 'SELECT image_shop.`id_image`
|
||||
FROM `'._DB_PREFIX_.'image` i
|
||||
'.Shop::addSqlAssociation('image', 'i').'
|
||||
WHERE i.`id_product` = '.(int)$id_product.'
|
||||
AND i.`cover` = 1';
|
||||
AND image_shop.`cover` = 1';
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
@@ -2454,10 +2481,17 @@ class ProductCore extends ObjectModel
|
||||
$id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0)
|
||||
{
|
||||
static $address = null;
|
||||
static $context = null;
|
||||
|
||||
if ($address === null)
|
||||
$address = new Address();
|
||||
|
||||
if ($context == null)
|
||||
$context = Context::getContext()->cloneContext();
|
||||
|
||||
if ($id_shop !== null && $context->shop->id != (int)$id_shop)
|
||||
$context->shop = new Shop((int)$id_shop);
|
||||
|
||||
if (!$use_customer_price)
|
||||
$id_customer = 0;
|
||||
|
||||
@@ -2489,18 +2523,19 @@ class ProductCore extends ObjectModel
|
||||
$sql = new DbQuery();
|
||||
$sql->select('product_shop.`price`, product_shop.`ecotax`');
|
||||
$sql->from('product', 'p');
|
||||
$sql->join(Shop::addSqlAssociation('product', 'p'));
|
||||
$sql->innerJoin('product_shop', 'product_shop', '(product_shop.id_product=p.id_product AND product_shop.id_shop='.(int)$id_shop.')');
|
||||
$sql->where('p.`id_product` = '.(int)$id_product);
|
||||
if (Combination::isFeatureActive())
|
||||
{
|
||||
$sql->select('product_attribute_shop.id_product_attribute, product_attribute_shop.`price` AS attribute_price, product_attribute_shop.default_on');
|
||||
$sql->leftJoin('product_attribute', 'pa', 'pa.`id_product` = p.`id_product`');
|
||||
$sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.id_shop ='.(int)$id_shop));
|
||||
$sql->leftJoin('product_attribute_shop', 'product_attribute_shop', '(product_attribute_shop.id_product_attribute=pa.id_product_attribute AND product_attribute_shop.id_shop='.(int)$id_shop.')');
|
||||
}
|
||||
else
|
||||
$sql->select('0 as id_product_attribute');
|
||||
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
foreach ($res as $row)
|
||||
{
|
||||
$array_tmp = array(
|
||||
@@ -2540,7 +2575,7 @@ class ProductCore extends ObjectModel
|
||||
$address->id_state = $id_state;
|
||||
$address->postcode = $zipcode;
|
||||
|
||||
$tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$id_product));
|
||||
$tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int)$id_product, $context));
|
||||
$product_tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
// Add Tax
|
||||
@@ -2995,7 +3030,8 @@ class ProductCore extends ObjectModel
|
||||
product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -3003,7 +3039,8 @@ class ProductCore extends ObjectModel
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE `id_product_1` = '.(int)$this->id.
|
||||
WHERE `id_product_1` = '.(int)$this->id.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))'.
|
||||
($active ? ' AND product_shop.`active` = 1' : '');
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
return false;
|
||||
@@ -4162,14 +4199,13 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
|
||||
$key = 'product_id_tax_rules_group_'.(int)$id_product.'_'.(int)$context->shop->id;
|
||||
if (!Cache::isStored($key))
|
||||
Cache::store($key,
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT `id_tax_rules_group`
|
||||
FROM `'._DB_PREFIX_.'product_shop`
|
||||
WHERE `id_product` = '.(int)$id_product.' AND id_shop='.(int)Context::getContext()->shop->id));
|
||||
WHERE `id_product` = '.(int)$id_product.' AND id_shop='.(int)$context->shop->id));
|
||||
|
||||
return Cache::retrieve($key);
|
||||
}
|
||||
@@ -4417,12 +4453,12 @@ class ProductCore extends ObjectModel
|
||||
*/
|
||||
public function setCoverWs($id_image)
|
||||
{
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 0 WHERE `id_product` = '.(int)$this->id.'
|
||||
');
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 1 WHERE `id_product` = '.(int)$this->id.' AND `id_image` = '.(int)$id_image
|
||||
);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image_shop` image_shop, `'._DB_PREFIX_.'image` i
|
||||
SET image_shop.`cover` = 0
|
||||
WHERE i.`id_product` = '.(int)$this->id.' AND i.id_image = image_shop.id_image
|
||||
AND image_shop.id_shop='.(int)Context::getContext()->shop->id);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'image_shop`
|
||||
SET `cover` = 1 WHERE `id_image` = '.(int)$id_image);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -4442,6 +4478,13 @@ class ProductCore extends ObjectModel
|
||||
ORDER BY i.`position`');
|
||||
}
|
||||
|
||||
public function getWsStockAvailables()
|
||||
{
|
||||
return Db::getInstance()->executeS('SELECT `id_stock_available` id, `id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.'stock_available`
|
||||
WHERE `id_product`='.($this->id).StockAvailable::addSqlShopRestriction());
|
||||
}
|
||||
|
||||
public function getWsTags()
|
||||
{
|
||||
return Db::getInstance()->executeS('
|
||||
@@ -4789,7 +4832,7 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function addWs($autodate = true, $null_values = false)
|
||||
{
|
||||
$success = parent::add($autodate, $null_values);
|
||||
$success = $this->add($autodate, $null_values);
|
||||
if ($success && Configuration::get('PS_SEARCH_INDEXATION'))
|
||||
Search::indexation(false, $this->id);
|
||||
return $success;
|
||||
|
||||
+12
-6
@@ -66,7 +66,9 @@ class ProductSaleCore
|
||||
{
|
||||
if ($page_number < 0) $page_number = 0;
|
||||
if ($nb_products < 1) $nb_products = 10;
|
||||
if (empty($order_by) || $order_by == 'position') $order_by = 'sales';
|
||||
|
||||
$final_order_by = $order_by;
|
||||
if (empty($order_by) || $order_by == 'position' || $order_by = 'price') $order_by = 'sales';
|
||||
if (empty($order_way)) $order_way = 'DESC';
|
||||
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
@@ -77,7 +79,7 @@ class ProductSaleCore
|
||||
pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
|
||||
pl.`meta_keywords`, pl.`meta_title`, pl.`name`,
|
||||
m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer,
|
||||
i.`id_image`, il.`legend`,
|
||||
image_shop.`id_image`, il.`legend`,
|
||||
ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`,
|
||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(),
|
||||
INTERVAL '.$interval.' DAY)) > 0 AS new
|
||||
@@ -87,7 +89,8 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`)
|
||||
@@ -102,12 +105,13 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if ($order_by == 'price')
|
||||
if ($final_order_by == 'price')
|
||||
Tools::orderbyPrice($result, $order_way);
|
||||
if (!$result)
|
||||
return false;
|
||||
@@ -132,7 +136,7 @@ class ProductSaleCore
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
|
||||
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, i.`id_image`, il.`legend`,
|
||||
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, image_shop.`id_image`, il.`legend`,
|
||||
ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category
|
||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
||||
@@ -140,7 +144,8 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON cl.`id_category` = product_shop.`id_category_default`
|
||||
@@ -152,6 +157,7 @@ class ProductSaleCore
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY sales DESC
|
||||
LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products;
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
|
||||
@@ -202,7 +202,7 @@ class ReferrerCore extends ObjectModel
|
||||
* @param int $id_product
|
||||
* @param int $employee
|
||||
*/
|
||||
public function getStatsSales($id_product, $employe)
|
||||
public function getStatsSales($id_product, $employee)
|
||||
{
|
||||
$join = $where = '';
|
||||
if ($id_product)
|
||||
|
||||
+12
-6
@@ -284,7 +284,7 @@ class SearchCore
|
||||
$alias = 'product_shop.';
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
|
||||
pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
||||
tax.`rate`, image_shop.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.',
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -303,10 +303,12 @@ class SearchCore
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE p.`id_product` '.$product_pool.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
'.($order_by ? 'ORDER BY '.$alias.$order_by : '').($order_way ? ' '.$order_way : '').'
|
||||
LIMIT '.(int)(($page_number - 1) * $page_size).','.(int)$page_size;
|
||||
$result = $db->executeS($sql);
|
||||
@@ -323,9 +325,11 @@ class SearchCore
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` tax ON (tax.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE p.`id_product` '.$product_pool;
|
||||
WHERE p.`id_product` '.$product_pool.'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))';
|
||||
$total = $db->getValue($sql);
|
||||
|
||||
if (!$result)
|
||||
@@ -632,7 +636,7 @@ class SearchCore
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`,
|
||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||
tax.`rate`, image_shop.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||
DATEDIFF(
|
||||
p.`date_add`,
|
||||
DATE_SUB(
|
||||
@@ -646,7 +650,8 @@ class SearchCore
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
|
||||
)
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||
@@ -665,6 +670,7 @@ class SearchCore
|
||||
SELECT id_group FROM '._DB_PREFIX_.'customer_group
|
||||
WHERE id_customer = '.(int)$id_customer.')').'
|
||||
AND t.`name` LIKE \'%'.pSQL($tag).'%\'
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY position DESC'.($orderBy ? ', '.$orderBy : '').($orderWay ? ' '.$orderWay : '').'
|
||||
LIMIT '.(int)(($pageNumber - 1) * $pageSize).','.(int)$pageSize;
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
|
||||
@@ -253,7 +253,7 @@ class SupplierCore extends ObjectModel
|
||||
pl.`meta_keywords`,
|
||||
pl.`meta_title`,
|
||||
pl.`name`,
|
||||
i.`id_image`,
|
||||
image_shop.`id_image`,
|
||||
il.`legend`,
|
||||
s.`name` AS supplier_name,
|
||||
tl.`name` AS tax_name,
|
||||
@@ -267,8 +267,8 @@ class SupplierCore extends ObjectModel
|
||||
AND ps.id_product_attribute = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`
|
||||
AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
|
||||
Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`
|
||||
AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
@@ -291,6 +291,7 @@ class SupplierCore extends ObjectModel
|
||||
($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)
|
||||
AND ((image_shop.id_image IS NOT NULL OR i.id_image IS NULL) OR (image_shop.id_image IS NULL AND i.cover=1))
|
||||
ORDER BY '.$alias.pSQL($order_by).' '.pSQL($order_way).'
|
||||
LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;
|
||||
|
||||
|
||||
+69
-38
@@ -998,26 +998,45 @@ class ToolsCore
|
||||
public static function replaceAccentedChars($str)
|
||||
{
|
||||
$patterns = array(
|
||||
'/[\x{0105}\x{0104}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u',
|
||||
'/[\x{00E7}\x{010D}\x{0107}\x{0106}]/u',
|
||||
/* Lowercase */
|
||||
'/[\x{0105}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u',
|
||||
'/[\x{00E7}\x{010D}\x{0107}]/u',
|
||||
'/[\x{010F}]/u',
|
||||
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}\x{0118}]/u',
|
||||
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
|
||||
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
|
||||
'/[\x{0142}\x{0141}\x{013E}\x{013A}]/u',
|
||||
'/[\x{0142}\x{013E}\x{013A}]/u',
|
||||
'/[\x{00F1}\x{0148}]/u',
|
||||
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}\x{00D3}]/u',
|
||||
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
|
||||
'/[\x{0159}\x{0155}]/u',
|
||||
'/[\x{015B}\x{015A}\x{0161}]/u',
|
||||
'/[\x{015B}\x{0161}]/u',
|
||||
'/[\x{00DF}]/u',
|
||||
'/[\x{0165}]/u',
|
||||
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u',
|
||||
'/[\x{00FD}\x{00FF}]/u',
|
||||
'/[\x{017C}\x{017A}\x{017B}\x{0179}\x{017E}]/u',
|
||||
'/[\x{017C}\x{017A}\x{017E}]/u',
|
||||
'/[\x{00E6}]/u',
|
||||
'/[\x{0153}]/u'
|
||||
);
|
||||
'/[\x{0153}]/u',
|
||||
|
||||
$replacements = array('a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe');
|
||||
/* Uppercase */
|
||||
'/[\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u',
|
||||
'/[\x{00C7}\x{010C}\x{0106}]/u',
|
||||
'/[\x{010E}]/u',
|
||||
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/u',
|
||||
'/[\x{0141}\x{013D}\x{0139}]/u',
|
||||
'/[\x{00D1}\x{0147}]/u',
|
||||
'/[\x{00D3}]/u',
|
||||
'/[\x{0158}\x{0154}]/u',
|
||||
'/[\x{015A}\x{0160}]/u',
|
||||
'/[\x{0164}]/u',
|
||||
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
|
||||
'/[\x{017B}\x{0179}\x{017D}]/u',
|
||||
'/[\x{00C6}]/u',
|
||||
'/[\x{0152}]/u');
|
||||
|
||||
$replacements = array(
|
||||
'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
|
||||
'A', 'C', 'D', 'E', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
|
||||
);
|
||||
|
||||
return preg_replace($patterns, $replacements, $str);
|
||||
}
|
||||
@@ -1052,7 +1071,7 @@ class ToolsCore
|
||||
public static function dateYears()
|
||||
{
|
||||
$tab = array();
|
||||
for ($i = date('Y') - 10; $i >= 1900; $i--)
|
||||
for ($i = date('Y'); $i >= 1900; $i--)
|
||||
$tab[] = $i;
|
||||
return $tab;
|
||||
}
|
||||
@@ -1454,7 +1473,7 @@ class ToolsCore
|
||||
return Tools::getHttpHost();
|
||||
}
|
||||
|
||||
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null)
|
||||
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false)
|
||||
{
|
||||
if (defined('PS_INSTALLATION_IN_PROGRESS'))
|
||||
return true;
|
||||
@@ -1517,13 +1536,33 @@ class ToolsCore
|
||||
if ($disable_multiviews)
|
||||
fwrite($write_fd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
|
||||
|
||||
fwrite($write_fd, "RewriteEngine on\n\n");
|
||||
// Webservice
|
||||
fwrite($write_fd, 'RewriteRule ^api/?(.*)$ '."webservice/dispatcher.php?url=$1 [QSA,L]\n\n");
|
||||
fwrite($write_fd, "RewriteEngine on\n");
|
||||
|
||||
if (!$medias)
|
||||
$medias = array(_MEDIA_SERVER_1_, _MEDIA_SERVER_2_, _MEDIA_SERVER_3_);
|
||||
|
||||
$media_domains = '';
|
||||
if ($medias[0] != '')
|
||||
$media_domains = 'RewriteCond %{HTTP_HOST} ^'.$medias[0].'$ [OR]'."\n";
|
||||
if ($medias[1] != '')
|
||||
$media_domains .= 'RewriteCond %{HTTP_HOST} ^'.$medias[1].'$ [OR]'."\n";
|
||||
if ($medias[2] != '')
|
||||
$media_domains .= 'RewriteCond %{HTTP_HOST} ^'.$medias[2].'$ [OR]'."\n";
|
||||
|
||||
if (Configuration::get('PS_WEBSERVICE_CGI_HOST'))
|
||||
fwrite($write_fd, "RewriteCond %{HTTP:Authorization} ^(.*)\nRewriteRule . - [E=HTTP_AUTHORIZATION:%1]\n\n");
|
||||
|
||||
foreach ($domains as $domain => $list_uri)
|
||||
{
|
||||
$physicals = array();
|
||||
foreach ($list_uri as $uri)
|
||||
{
|
||||
fwrite($write_fd, 'RewriteCond %{HTTP_HOST} ^'.$domain.'$'."\n");
|
||||
fwrite($write_fd, 'RewriteRule . - [E=REWRITEBASE:'.$uri['physical'].']'."\n");
|
||||
|
||||
// Webservice
|
||||
fwrite($write_fd, 'RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]'."\n\n");
|
||||
|
||||
$rewrite_settings = (int)Configuration::get('PS_REWRITING_SETTINGS', null, null, (int)$uri['id_shop']);
|
||||
$domain_rewrite_cond = 'RewriteCond %{HTTP_HOST} ^'.$domain.'$'."\n";
|
||||
// Rewrite virtual multishop uri
|
||||
@@ -1531,14 +1570,17 @@ class ToolsCore
|
||||
{
|
||||
if (!$rewrite_settings)
|
||||
{
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^'.trim($uri['virtual'], '/').'/?$ '.$uri['physical'].$uri['virtual']."index.php [L,R]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^'.trim($uri['virtual'], '/').'$ '.$uri['physical'].$uri['virtual']." [L,R]\n");
|
||||
}
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^'.ltrim($uri['virtual'], '/').'(.*) '.$uri['physical']."$1 [L]\n\n");
|
||||
}
|
||||
@@ -1549,10 +1591,12 @@ class ToolsCore
|
||||
fwrite($write_fd, "# Images\n");
|
||||
if (Configuration::get('PS_LEGACY_IMAGES'))
|
||||
{
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ '._PS_PROD_IMG_.'$1-$2$3$4.jpg [L]'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}'._PS_PROD_IMG_.'$1-$2$3$4.jpg [L]'."\n");
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^([0-9]+)\-([0-9]+)(-[0-9]+)?/.+\.jpg$ '._PS_PROD_IMG_.'$1-$2$3.jpg [L]'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^([0-9]+)\-([0-9]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}'._PS_PROD_IMG_.'$1-$2$3.jpg [L]'."\n");
|
||||
}
|
||||
|
||||
// Rewrite product images < 100 millions
|
||||
@@ -1565,13 +1609,16 @@ class ToolsCore
|
||||
$img_name .= '$'.$j;
|
||||
}
|
||||
$img_name .= '$'.$j;
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^'.str_repeat('([0-9])', $i).'(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ '._PS_PROD_IMG_.$img_path.$img_name.'$'.($j + 1).".jpg [L]\n");
|
||||
fwrite($write_fd, 'RewriteRule ^'.str_repeat('([0-9])', $i).'(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}'._PS_PROD_IMG_.$img_path.$img_name.'$'.($j + 1).".jpg [L]\n");
|
||||
}
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^c/([0-9]+)(\-[_a-zA-Z0-9-\.*]*)(-[0-9]+)?/.+\.jpg$ img/c/$1$2$3.jpg [L]'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]'."\n");
|
||||
fwrite($write_fd, $media_domains);
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, 'RewriteRule ^c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ img/c/$1$2.jpg [L]'."\n");
|
||||
fwrite($write_fd, 'RewriteRule ^c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]'."\n");
|
||||
}
|
||||
}
|
||||
// Redirections to dispatcher
|
||||
@@ -1584,7 +1631,7 @@ class ToolsCore
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, "RewriteRule ^.*$ - [NC,L]\n");
|
||||
fwrite($write_fd, $domain_rewrite_cond);
|
||||
fwrite($write_fd, "RewriteRule ^.*\$ index.php [NC,L]\n");
|
||||
fwrite($write_fd, "RewriteRule ^.*\$ %{ENV:REWRITEBASE}index.php [NC,L]\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2079,22 +2126,6 @@ FileETag INode MTime Size
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function_exists('phpinfo'))
|
||||
{
|
||||
// If apache_get_modules does not exists,
|
||||
// we parse phpinfo(INFO_MODULES) return string
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$phpinfo = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if (strpos($phpinfo, $name) !== false)
|
||||
return true;
|
||||
}
|
||||
// otherwise, use the default behavior
|
||||
// see return value at the end of the function
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2183,7 +2214,7 @@ FileETag INode MTime Size
|
||||
|
||||
public static function modRewriteActive()
|
||||
{
|
||||
if (!Tools::apacheModExists('mod_rewrite'))
|
||||
if (Tools::apacheModExists('mod_rewrite'))
|
||||
return true;
|
||||
if ((isset($_SERVER['HTTP_MOD_REWRITE']) && strtolower($_SERVER['HTTP_MOD_REWRITE']) == 'on') || strtolower(getenv('HTTP_MOD_REWRITE')) == 'on')
|
||||
return true;
|
||||
|
||||
Vendored
+12
-4
@@ -248,13 +248,21 @@ abstract class CacheCore
|
||||
$this->set($key, $result);
|
||||
|
||||
// Get all table from the query and save them in cache
|
||||
if (preg_match_all('/('._DB_PREFIX_.'[a-z_-]*)`?.*/i', $query, $res))
|
||||
foreach ($res[1] as $table)
|
||||
if ($tables = $this->getTables($query))
|
||||
foreach ($tables as $table)
|
||||
if (!isset($this->sql_tables_cached[$table][$key]))
|
||||
$this->sql_tables_cached[$table][$key] = true;
|
||||
$this->set(self::SQL_TABLES_NAME, $this->sql_tables_cached);
|
||||
}
|
||||
|
||||
protected function getTables($string)
|
||||
{
|
||||
if (preg_match_all('/(?:from|join|update|into)\s+`?('._DB_PREFIX_.'[a-z_-]+)`?(?:,\s{0,}`?('._DB_PREFIX_.'[a-z_-]+)`?)?\s.*/Umsi', $string, $res))
|
||||
return array_merge($res[1], $res[2]);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a query from cache
|
||||
*
|
||||
@@ -269,8 +277,8 @@ abstract class CacheCore
|
||||
$this->sql_tables_cached = array();
|
||||
}
|
||||
|
||||
if (preg_match_all('/('._DB_PREFIX_.'[a-z_-]*)`?.*/i', $query, $res))
|
||||
foreach ($res[1] as $table)
|
||||
if ($tables = $this->getTables($query))
|
||||
foreach ($tables as $table)
|
||||
if (isset($this->sql_tables_cached[$table]))
|
||||
{
|
||||
foreach (array_keys($this->sql_tables_cached[$table]) as $fs_key)
|
||||
|
||||
@@ -189,6 +189,9 @@ class AdminControllerCore extends Controller
|
||||
* @var array ids of the rows selected
|
||||
*/
|
||||
protected $boxes;
|
||||
|
||||
/** @var string Do not automatically select * anymore but select only what is necessary */
|
||||
protected $explicitSelect = false;
|
||||
|
||||
/** @var string Add fields into data query to display list */
|
||||
protected $_select;
|
||||
@@ -414,6 +417,33 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function processFilter()
|
||||
{
|
||||
// Filter memorization
|
||||
if (isset($_POST) && !empty($_POST) && isset($this->table))
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if (is_array($this->table))
|
||||
{
|
||||
foreach ($this->table as $table)
|
||||
if (stripos($key, $table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
|
||||
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
elseif (stripos($key, $this->table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
|
||||
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
|
||||
if (isset($_GET) && !empty($_GET) && isset($this->table))
|
||||
foreach ($_GET as $key => $value)
|
||||
{
|
||||
if (is_array($this->table))
|
||||
{
|
||||
foreach ($this->table as $table)
|
||||
if (stripos($key, $table.'OrderBy') === 0 || stripos($key, $table.'Orderway') === 0)
|
||||
$this->context->cookie->$key = $value;
|
||||
}
|
||||
elseif (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
|
||||
$this->context->cookie->$key = $value;
|
||||
}
|
||||
|
||||
$filters = $this->context->cookie->getFamily($this->table.'Filter_');
|
||||
|
||||
foreach ($filters as $key => $value)
|
||||
@@ -568,11 +598,7 @@ class AdminControllerCore extends Controller
|
||||
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
|
||||
}
|
||||
elseif ($object->delete())
|
||||
{
|
||||
if (method_exists($object, 'cleanPositions'))
|
||||
$object->cleanPositions();
|
||||
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
|
||||
}
|
||||
$this->errors[] = Tools::displayError('An error occurred during deletion.');
|
||||
}
|
||||
}
|
||||
@@ -809,7 +835,6 @@ class AdminControllerCore extends Controller
|
||||
public function processResetFilters()
|
||||
{
|
||||
$filters = $this->context->cookie->getFamily($this->table.'Filter_');
|
||||
|
||||
foreach ($filters as $cookie_key => $filter)
|
||||
if (strncmp($cookie_key, $this->table.'Filter_', 7 + Tools::strlen($this->table)) == 0)
|
||||
{
|
||||
@@ -818,7 +843,7 @@ class AdminControllerCore extends Controller
|
||||
$tmp_tab = explode('!', $key);
|
||||
$key = (count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0]);
|
||||
|
||||
if (array_key_exists($key, $this->fields_list))
|
||||
if (is_array($this->fields_list) && array_key_exists($key, $this->fields_list))
|
||||
unset($this->context->cookie->$cookie_key);
|
||||
}
|
||||
|
||||
@@ -1157,10 +1182,10 @@ class AdminControllerCore extends Controller
|
||||
$this->context->smarty->assign('page', Tools::jsonEncode($page));
|
||||
else
|
||||
$this->context->smarty->assign('page', $page);
|
||||
|
||||
$this->context->smarty->display($this->layout);
|
||||
$this->smartyOutputContent($this->layout);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add a warning message to display at the top of the page
|
||||
*
|
||||
@@ -1239,13 +1264,15 @@ class AdminControllerCore extends Controller
|
||||
else
|
||||
{
|
||||
$path_img = _PS_IMG_DIR_.'t/'.$tab['class_name'].'.png';
|
||||
$img = _PS_IMG_.'t/'.$tab['class_name'].'.png';
|
||||
// Relative link will always work, whatever the base uri set in the admin
|
||||
$img = '../img/t/'.$tab['class_name'].'.png';
|
||||
}
|
||||
|
||||
if (trim($tab['module']) != '')
|
||||
{
|
||||
$path_img = _PS_MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||
// Relative link will always work, whatever the base uri set in the admin
|
||||
$img = '../modules/'.$tab['module'].'/'.$tab['class_name'].'.png';
|
||||
}
|
||||
|
||||
// retrocompatibility
|
||||
@@ -1580,7 +1607,9 @@ class AdminControllerCore extends Controller
|
||||
public function setMedia()
|
||||
{
|
||||
$this->addCSS(_PS_CSS_DIR_.'admin.css', 'all');
|
||||
$this->addCSS(__PS_BASE_URI__.str_ireplace(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR, '', _PS_ADMIN_DIR_).'/themes/'.$this->bo_theme.'/css/admin.css', 'all');
|
||||
$admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
|
||||
$admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
|
||||
$this->addCSS(__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/css/admin.css', 'all');
|
||||
if ($this->context->language->is_rtl)
|
||||
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
|
||||
|
||||
@@ -1651,7 +1680,7 @@ class AdminControllerCore extends Controller
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminLogin').(!isset($_GET['logout']) ? '&redirect='.$this->controller_name : ''));
|
||||
|
||||
// Set current index
|
||||
$current_index = __PS_BASE_URI__.basename(_PS_ADMIN_DIR_).'/index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : '');
|
||||
$current_index = 'index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : '');
|
||||
if ($back = Tools::getValue('back'))
|
||||
$current_index .= '&back='.urlencode($back);
|
||||
self::$currentIndex = $current_index;
|
||||
@@ -1760,32 +1789,6 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
// Filter memorization
|
||||
if (isset($_POST) && !empty($_POST) && isset($this->table))
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if (is_array($this->table))
|
||||
{
|
||||
foreach ($this->table as $table)
|
||||
if (stripos($key, $table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
|
||||
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
elseif (stripos($key, $this->table.'Filter_') === 0 || stripos($key, 'submitFilter') === 0)
|
||||
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
if (isset($_GET) && !empty($_GET) && isset($this->table))
|
||||
foreach ($_GET as $key => $value)
|
||||
{
|
||||
if (is_array($this->table))
|
||||
{
|
||||
foreach ($this->table as $table)
|
||||
if (stripos($key, $table.'OrderBy') === 0 || stripos($key, $table.'Orderway') === 0)
|
||||
$this->context->cookie->$key = $value;
|
||||
}
|
||||
elseif (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
|
||||
$this->context->cookie->$key = $value;
|
||||
}
|
||||
|
||||
// Manage list filtering
|
||||
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
|
||||
$this->filter = true;
|
||||
@@ -2059,8 +2062,24 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$this->_listsql = '
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '').'
|
||||
'.($this->lang ? 'b.*, ' : '').'a.*'.(isset($this->_select) ? ', '.$this->_select.' ' : '').$select_shop.'
|
||||
'.($this->_tmpTableFilter ? ' * FROM (SELECT ' : '');
|
||||
|
||||
if ($this->explicitSelect)
|
||||
{
|
||||
foreach ($this->fields_list as $key => $array_value)
|
||||
if (isset($array_value['filter_key']))
|
||||
$this->_listsql .= str_replace('!', '.', $array_value['filter_key']).' as '.$key.',';
|
||||
elseif ($key == 'id_'.$this->table)
|
||||
$this->_listsql .= 'a.`'.bqSQL($key).'`,';
|
||||
elseif ($key != 'image' && !preg_match('/'.preg_quote($key, '/').'/i', $this->_select))
|
||||
$this->_listsql .= '`'.bqSQL($key).'`,';
|
||||
$this->_listsql = rtrim($this->_listsql, ',');
|
||||
}
|
||||
else
|
||||
$this->_listsql .= ($this->lang ? 'b.*,' : '').' a.*';
|
||||
|
||||
$this->_listsql .= '
|
||||
'.(isset($this->_select) ? ', '.$this->_select : '').$select_shop.'
|
||||
FROM `'._DB_PREFIX_.$sql_table.'` a
|
||||
'.$lang_join.'
|
||||
'.(isset($this->_join) ? $this->_join.' ' : '').'
|
||||
@@ -2195,7 +2214,7 @@ class AdminControllerCore extends Controller
|
||||
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %s is required.'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), $field, $class_name))
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
|
||||
);
|
||||
|
||||
/* Checking for multilingual required fields */
|
||||
@@ -2203,7 +2222,7 @@ class AdminControllerCore extends Controller
|
||||
if (($empty = Tools::getValue($field_lang.'_'.$default_language->id)) === false || $empty !== '0' && empty($empty))
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %1$s is required at least in %2$s.'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name)),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$default_language->name
|
||||
);
|
||||
|
||||
@@ -2212,7 +2231,7 @@ class AdminControllerCore extends Controller
|
||||
if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length)
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %1$s is too long (%2$d chars max).'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name),
|
||||
$max_length
|
||||
);
|
||||
|
||||
@@ -2224,7 +2243,7 @@ class AdminControllerCore extends Controller
|
||||
if ($field_lang !== false && Tools::strlen($field_lang) > $max_length)
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name)),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$language['name'],
|
||||
$max_length
|
||||
);
|
||||
@@ -2238,7 +2257,7 @@ class AdminControllerCore extends Controller
|
||||
if (!Validate::$function($value) && !empty($value))
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %s is invalid.'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), $field, $class_name))
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
|
||||
);
|
||||
|
||||
/* Checking for passwd_old validity */
|
||||
@@ -2247,12 +2266,12 @@ class AdminControllerCore extends Controller
|
||||
if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value))
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %s is invalid.'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name))
|
||||
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
|
||||
);
|
||||
elseif ($class_name == 'Customer' && !Validate::isPasswd($value))
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %s is invalid.'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name))
|
||||
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2263,7 +2282,7 @@ class AdminControllerCore extends Controller
|
||||
if (!Validate::$function($value))
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('The field %1$s (%2$s) is invalid.'),
|
||||
Tools::safeOutput(call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name)),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$language['name']
|
||||
);
|
||||
}
|
||||
@@ -2704,13 +2723,13 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443, 'http://' => 80);
|
||||
$postData = 'version='._PS_VERSION_.'&method=listing&action=native&iso_code='.strtolower(Configuration::get('PS_LOCALE_COUNTRY')).'&iso_lang='.strtolower(Context::getContext()->language->iso_code);
|
||||
$postData = 'version='._PS_VERSION_.'&method=listing&action=native&iso_code='.strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.strtolower(Context::getContext()->language->iso_code);
|
||||
}
|
||||
if ($request == 'must-have')
|
||||
{
|
||||
// Define protocol accepted and post data values for this request
|
||||
$protocolsList = array('https://' => 443, 'http://' => 80);
|
||||
$postData = 'version='._PS_VERSION_.'&method=listing&action=must-have&iso_code='.strtolower(Configuration::get('PS_LOCALE_COUNTRY')).'&iso_lang='.strtolower(Context::getContext()->language->iso_code);
|
||||
$postData = 'version='._PS_VERSION_.'&method=listing&action=must-have&iso_code='.strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))).'&iso_lang='.strtolower(Context::getContext()->language->iso_code);
|
||||
}
|
||||
if ($request == 'customer')
|
||||
{
|
||||
@@ -2739,7 +2758,6 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make the request
|
||||
$opts = array(
|
||||
'http'=>array(
|
||||
|
||||
@@ -347,4 +347,10 @@ abstract class ControllerCore
|
||||
{
|
||||
return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
||||
}
|
||||
|
||||
protected function smartyOutputContent($content)
|
||||
{
|
||||
$this->context->cookie->write();
|
||||
$this->context->smarty->display($content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,10 @@ class FrontControllerCore extends Controller
|
||||
{
|
||||
$cart = new Cart($this->context->cookie->id_cart);
|
||||
if ($cart->OrderExists())
|
||||
{
|
||||
unset($this->context->cookie->id_cart, $cart, $this->context->cookie->checkedTOS);
|
||||
$this->context->cookie->check_cgv = false;
|
||||
}
|
||||
/* Delete product of cart, if user can't make an order from his country */
|
||||
elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) &&
|
||||
!in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) &&
|
||||
@@ -249,12 +252,6 @@ class FrontControllerCore extends Controller
|
||||
CartRule::autoAddToCart($this->context);
|
||||
}
|
||||
|
||||
// Check mobile context
|
||||
if (Tools::isSubmit('no_mobile_theme'))
|
||||
$this->context->cookie->no_mobile = true;
|
||||
else if (Tools::isSubmit('mobile_theme_ok'))
|
||||
$this->context->cookie->no_mobile = false;
|
||||
|
||||
$locale = strtolower(Configuration::get('PS_LOCALE_LANGUAGE')).'_'.strtoupper(Configuration::get('PS_LOCALE_COUNTRY').'.UTF-8');
|
||||
setlocale(LC_COLLATE, $locale);
|
||||
setlocale(LC_CTYPE, $locale);
|
||||
@@ -494,7 +491,7 @@ class FrontControllerCore extends Controller
|
||||
$this->context->smarty->assign('js_files', array_unique($this->js_files));
|
||||
|
||||
$this->display_header = $display;
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl');
|
||||
$this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl');
|
||||
|
||||
}
|
||||
|
||||
@@ -505,7 +502,7 @@ class FrontControllerCore extends Controller
|
||||
{
|
||||
// This method will be removed in 1.6
|
||||
Tools::displayAsDeprecated();
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl');
|
||||
$this->smartyOutputContent(_PS_THEME_DIR_.'footer.tpl');
|
||||
}
|
||||
|
||||
public function initCursedPage()
|
||||
@@ -569,28 +566,28 @@ class FrontControllerCore extends Controller
|
||||
ob_clean();
|
||||
$this->context->smarty->assign('template', $template);
|
||||
}
|
||||
$this->context->smarty->display($layout);
|
||||
$this->smartyOutputContent($layout);
|
||||
}
|
||||
else
|
||||
{
|
||||
// BEGIN - 1.4 retrocompatibility - will be removed in 1.6
|
||||
Tools::displayAsDeprecated('layout.tpl is missing in your theme directory');
|
||||
if ($this->display_header)
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl');
|
||||
$this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl');
|
||||
|
||||
if ($this->template)
|
||||
$this->context->smarty->display($this->template);
|
||||
$this->smartyOutputContent($this->template);
|
||||
else // For retrocompatibility with 1.4 controller
|
||||
$this->displayContent();
|
||||
|
||||
if ($this->display_footer)
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl');
|
||||
$this->smartyOutputContent(_PS_THEME_DIR_.'footer.tpl');
|
||||
|
||||
// live edit
|
||||
if (Tools::isSubmit('live_edit') && ($ad = Tools::getValue('ad')) && Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
|
||||
{
|
||||
$this->context->smarty->assign(array('ad' => $ad, 'live_edit' => true));
|
||||
$this->context->smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl');
|
||||
$this->smartyOutputContent(_PS_ALL_THEMES_DIR_.'live_edit.tpl');
|
||||
}
|
||||
// END - 1.4 retrocompatibility - will be removed in 1.6
|
||||
}
|
||||
@@ -610,7 +607,7 @@ class FrontControllerCore extends Controller
|
||||
$this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON'));
|
||||
|
||||
$template_dir = ($this->context->getMobileDevice() == true ? _PS_THEME_MOBILE_DIR_ : _PS_THEME_DIR_);
|
||||
$this->context->smarty->display($template_dir.'maintenance.tpl');
|
||||
$this->smartyOutputContent($template_dir.'maintenance.tpl');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -621,7 +618,7 @@ class FrontControllerCore extends Controller
|
||||
{
|
||||
header('HTTP/1.1 503 temporarily overloaded');
|
||||
$this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON'));
|
||||
$this->context->smarty->display(_PS_THEME_DIR_.'restricted-country.tpl');
|
||||
$this->smartyOutputContent(_PS_THEME_DIR_.'restricted-country.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -674,7 +671,6 @@ class FrontControllerCore extends Controller
|
||||
if (!isset($this->context->cookie->iso_code_country) || (isset($this->context->cookie->iso_code_country) && !in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES')))))
|
||||
{
|
||||
include_once(_PS_GEOIP_DIR_.'geoipcity.inc');
|
||||
include_once(_PS_GEOIP_DIR_.'geoipregionvars.php');
|
||||
|
||||
$gi = geoip_open(realpath(_PS_GEOIP_DIR_.'GeoLiteCity.dat'), GEOIP_STANDARD);
|
||||
$record = geoip_record_by_addr($gi, Tools::getRemoteAddr());
|
||||
@@ -708,9 +704,9 @@ class FrontControllerCore extends Controller
|
||||
$this->context->cookie->id_currency = (int)(Currency::getCurrencyInstance($default_country->id_currency ? (int)$default_country->id_currency : Configuration::get('PS_CURRENCY_DEFAULT'))->id);
|
||||
return $default_country;
|
||||
}
|
||||
elseif (Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == _PS_GEOLOCATION_NO_CATALOG_)
|
||||
elseif (Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == _PS_GEOLOCATION_NO_CATALOG_ && !FrontController::isInWhitelistForGeolocation())
|
||||
$this->restrictedCountry = true;
|
||||
elseif (Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == _PS_GEOLOCATION_NO_ORDER_)
|
||||
elseif (Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR') == _PS_GEOLOCATION_NO_ORDER_ && !FrontController::isInWhitelistForGeolocation())
|
||||
$this->context->smarty->assign(array(
|
||||
'restricted_country_mode' => true,
|
||||
'geolocation_country' => 'Undefined'
|
||||
@@ -930,7 +926,12 @@ class FrontControllerCore extends Controller
|
||||
{
|
||||
$allowed = false;
|
||||
$userIp = Tools::getRemoteAddr();
|
||||
$ips = explode(';', Configuration::get('PS_GEOLOCATION_WHITELIST'));
|
||||
$ips = array();
|
||||
// retrocompatibility
|
||||
$ips_old = explode(';', Configuration::get('PS_GEOLOCATION_WHITELIST'));
|
||||
if (is_array($ips_old) && count($ips_old))
|
||||
foreach ($ips_old as $ip)
|
||||
$ips = array_merge($ips, explode("\n", $ip));
|
||||
if (is_array($ips) && count($ips))
|
||||
foreach ($ips as $ip)
|
||||
if (!empty($ip) && strpos($userIp, $ip) === 0)
|
||||
|
||||
@@ -161,7 +161,7 @@ class HelperListCore extends Helper
|
||||
* @param int $id_product
|
||||
* @return string
|
||||
*/
|
||||
protected function displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null)
|
||||
public function displayEnableLink($token, $id, $value, $active, $id_category = null, $id_product = null)
|
||||
{
|
||||
$tpl_enable = $this->createTemplate('list_action_enable.tpl');
|
||||
$tpl_enable->assign(array(
|
||||
@@ -208,7 +208,7 @@ class HelperListCore extends Helper
|
||||
|
||||
if (method_exists($this->context->controller, $method_name))
|
||||
$this->_list[$index][$action] = $this->context->controller->$method_name($this->token, $id, $name);
|
||||
else if (method_exists($this, $method_name))
|
||||
elseif (method_exists($this, $method_name))
|
||||
$this->_list[$index][$action] = $this->$method_name($this->token, $id, $name);
|
||||
}
|
||||
}
|
||||
@@ -236,9 +236,9 @@ class HelperListCore extends Helper
|
||||
Tools::getValue('id_product')
|
||||
);
|
||||
}
|
||||
else if (isset($params['activeVisu']))
|
||||
elseif (isset($params['activeVisu']))
|
||||
$this->_list[$index][$key] = (bool)$tr[$key];
|
||||
else if (isset($params['position']))
|
||||
elseif (isset($params['position']))
|
||||
{
|
||||
$this->_list[$index][$key] = array(
|
||||
'position' => $tr[$key],
|
||||
@@ -252,14 +252,17 @@ class HelperListCore extends Helper
|
||||
'&way=0&position='.((int)$tr['position'] - 1).'&token='.$this->token
|
||||
);
|
||||
}
|
||||
else if (isset($params['image']))
|
||||
elseif (isset($params['image']))
|
||||
{
|
||||
// item_id is the product id in a product image context, else it is the image id.
|
||||
$item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)$tr['id_image'] : '').'.'.$this->imageType;
|
||||
if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES'))
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)$tr['id_image'] : '').'.'.$this->imageType;
|
||||
else
|
||||
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.Image::getImgFolderStatic($tr['id_image']).(int)$tr['id_image'].'.'.$this->imageType;
|
||||
$this->_list[$index][$key] = ImageManager::thumbnail($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
|
||||
}
|
||||
else if (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
|
||||
elseif (isset($params['icon']) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default'])))
|
||||
{
|
||||
if (isset($params['icon'][$tr[$key]]) && is_array($params['icon'][$tr[$key]]))
|
||||
$this->_list[$index][$key] = array(
|
||||
@@ -272,18 +275,18 @@ class HelperListCore extends Helper
|
||||
'alt' => isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'],
|
||||
);
|
||||
}
|
||||
else if (isset($params['type']) && $params['type'] == 'float')
|
||||
elseif (isset($params['type']) && $params['type'] == 'float')
|
||||
$this->_list[$index][$key] = rtrim(rtrim($tr[$key], '0'), '.');
|
||||
else if (isset($params['type']) && $params['type'] == 'price')
|
||||
elseif (isset($params['type']) && $params['type'] == 'price')
|
||||
{
|
||||
$currency = (isset($params['currency']) && $params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $this->context->currency;
|
||||
$this->_list[$index][$key] = Tools::displayPrice($tr[$key], $currency, false);
|
||||
}
|
||||
else if (isset($params['type']) && $params['type'] == 'date')
|
||||
elseif (isset($params['type']) && $params['type'] == 'date')
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id);
|
||||
else if (isset($params['type']) && $params['type'] == 'datetime')
|
||||
elseif (isset($params['type']) && $params['type'] == 'datetime')
|
||||
$this->_list[$index][$key] = Tools::displayDate($tr[$key], $this->context->language->id, true);
|
||||
else if (isset($tr[$key]))
|
||||
elseif (isset($tr[$key]))
|
||||
{
|
||||
$echo = $tr[$key];
|
||||
if (isset($params['callback']))
|
||||
@@ -329,7 +332,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display duplicate action link
|
||||
*/
|
||||
protected function displayDuplicateLink($token = null, $id, $name = null)
|
||||
public function displayDuplicateLink($token = null, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_duplicate.tpl');
|
||||
if (!array_key_exists('Bad SQL query', self::$cache_lang))
|
||||
@@ -371,7 +374,7 @@ class HelperListCore extends Helper
|
||||
* fields_display: // attribute $fields_list of the admin controller
|
||||
* }
|
||||
*/
|
||||
protected function displayDetailsLink($token = null, $id, $name = null)
|
||||
public function displayDetailsLink($token = null, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_details.tpl');
|
||||
if (!array_key_exists('Details', self::$cache_lang))
|
||||
@@ -395,7 +398,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display view action link
|
||||
*/
|
||||
protected function displayViewLink($token = null, $id, $name = null)
|
||||
public function displayViewLink($token = null, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_view.tpl');
|
||||
if (!array_key_exists('View', self::$cache_lang))
|
||||
@@ -413,7 +416,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display edit action link
|
||||
*/
|
||||
protected function displayEditLink($token = null, $id, $name = null)
|
||||
public function displayEditLink($token = null, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_edit.tpl');
|
||||
if (!array_key_exists('Edit', self::$cache_lang))
|
||||
@@ -431,7 +434,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display delete action link
|
||||
*/
|
||||
protected function displayDeleteLink($token = null, $id, $name = null)
|
||||
public function displayDeleteLink($token = null, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_delete.tpl');
|
||||
|
||||
@@ -464,7 +467,7 @@ class HelperListCore extends Helper
|
||||
/**
|
||||
* Display delete action link
|
||||
*/
|
||||
protected function displayDefaultLink($token = null, $id, $name = null)
|
||||
public function displayDefaultLink($token = null, $id, $name = null)
|
||||
{
|
||||
$tpl = $this->createTemplate('list_action_default.tpl');
|
||||
if (!array_key_exists('Default', self::$cache_lang))
|
||||
|
||||
@@ -995,7 +995,7 @@ abstract class ModuleCore
|
||||
$item->$k = (string)$v;
|
||||
$item->displayName = stripslashes(Translate::getModuleTranslation((string)$xml_module->name, Module::configXmlStringFormat($xml_module->displayName), (string)$xml_module->name));
|
||||
$item->description = stripslashes(Translate::getModuleTranslation((string)$xml_module->name, Module::configXmlStringFormat($xml_module->description), (string)$xml_module->name));
|
||||
$item->author = Translate::getModuleTranslation((string)$xml_module->name, Module::configXmlStringFormat($xml_module->author), (string)$xml_module->name);
|
||||
$item->author = stripslashes(Translate::getModuleTranslation((string)$xml_module->name, Module::configXmlStringFormat($xml_module->author), (string)$xml_module->name));
|
||||
|
||||
if (isset($xml_module->confirmUninstall))
|
||||
$item->confirmUninstall = Translate::getModuleTranslation((string)$xml_module->name, Module::configXmlStringFormat($xml_module->confirmUninstall), (string)$xml_module->name);
|
||||
@@ -1311,7 +1311,7 @@ abstract class ModuleCore
|
||||
$paypal_condition = ' AND m.`name` = \'paypal\'';
|
||||
|
||||
$list = Shop::getContextListShopID();
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT DISTINCT h.`id_hook`, m.`name`, hm.`position`
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT DISTINCT m.`id_module`, h.`id_hook`, m.`name`, hm.`position`
|
||||
FROM `'._DB_PREFIX_.'module` m
|
||||
'.($frontend ? 'LEFT JOIN `'._DB_PREFIX_.'module_country` mc ON (m.`id_module` = mc.`id_module` AND mc.id_shop = '.(int)$context->shop->id.')' : '').'
|
||||
'.($frontend ? 'INNER JOIN `'._DB_PREFIX_.'module_group` mg ON (m.`id_module` = mg.`id_module` AND mg.id_shop = '.(int)$context->shop->id.')' : '').'
|
||||
|
||||
@@ -293,10 +293,14 @@ abstract class ModuleGraphCore extends Module
|
||||
|
||||
protected static function getEmployee($employee = null, Context $context = null)
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
if (!$employee)
|
||||
if (!Validate::isLoadedObject($employee))
|
||||
{
|
||||
if (!$context)
|
||||
$context = Context::getContext();
|
||||
if (!Validate::isLoadedObject($context->employee))
|
||||
return false;
|
||||
$employee = $context->employee;
|
||||
}
|
||||
|
||||
if (empty($employee->stats_date_from) || empty($employee->stats_date_to)
|
||||
|| $employee->stats_date_from == '0000-00-00' || $employee->stats_date_to == '0000-00-00')
|
||||
@@ -317,8 +321,9 @@ abstract class ModuleGraphCore extends Module
|
||||
|
||||
public static function getDateBetween($employee = null)
|
||||
{
|
||||
$employee = ModuleGraph::getEmployee($employee);
|
||||
return ' \''.$employee->stats_date_from.' 00:00:00\' AND \''.$employee->stats_date_to.' 23:59:59\' ';
|
||||
if ($employee = ModuleGraph::getEmployee($employee))
|
||||
return ' \''.$employee->stats_date_from.' 00:00:00\' AND \''.$employee->stats_date_to.' 23:59:59\' ';
|
||||
return ' \''.date('Y-m').'-01 00:00:00\' AND \''.date('Y-m-t').' 23:59:59\' ';
|
||||
}
|
||||
|
||||
public function getLang()
|
||||
|
||||
@@ -628,16 +628,18 @@ class OrderCore extends ObjectModel
|
||||
{
|
||||
if (isset($product['product_attribute_id']) && $product['product_attribute_id'])
|
||||
$id_image = Db::getInstance()->getValue('
|
||||
SELECT id_image
|
||||
FROM '._DB_PREFIX_.'product_attribute_image
|
||||
SELECT image_shop.id_image
|
||||
FROM '._DB_PREFIX_.'product_attribute_image pai'.
|
||||
Shop::addSqlAssociation('image', 'pai', true).'
|
||||
WHERE id_product_attribute = '.(int)$product['product_attribute_id']);
|
||||
|
||||
if (!isset($id_image) || !$id_image)
|
||||
$id_image = Db::getInstance()->getValue('
|
||||
SELECT id_image
|
||||
FROM '._DB_PREFIX_.'image
|
||||
WHERE id_product = '.(int)($product['product_id']).' AND cover = 1
|
||||
');
|
||||
SELECT image_shop.id_image
|
||||
FROM '._DB_PREFIX_.'image i'.
|
||||
Shop::addSqlAssociation('image', 'i', true, 'image_shop.cover=1').'
|
||||
WHERE id_product = '.(int)($product['product_id'])
|
||||
);
|
||||
|
||||
$product['image'] = null;
|
||||
$product['image_size'] = null;
|
||||
|
||||
@@ -245,6 +245,16 @@ class OrderDetailCore extends ObjectModel
|
||||
if ($this->context != null && isset($this->context->shop))
|
||||
$id_shop = $this->context->shop->id;
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
|
||||
if ($context == null)
|
||||
$context = Context::getContext();
|
||||
$this->context = $context->cloneContext();
|
||||
}
|
||||
|
||||
protected function setContext($id_shop)
|
||||
{
|
||||
if ($this->context->shop->id != $id_shop)
|
||||
$this->context->shop = new Shop((int)$id_shop);
|
||||
}
|
||||
|
||||
public static function getDownloadFromHash($hash)
|
||||
@@ -308,7 +318,7 @@ class OrderDetailCore extends ObjectModel
|
||||
* @since 1.5.0.1
|
||||
* @return boolean
|
||||
*/
|
||||
public function saveTaxCalculator(Order $order)
|
||||
public function saveTaxCalculator(Order $order, $replace = false)
|
||||
{
|
||||
// Nothing to save
|
||||
if ($this->tax_calculator == null)
|
||||
@@ -335,12 +345,25 @@ class OrderDetailCore extends ObjectModel
|
||||
$values .= '('.(int)$this->id.','.(float)$id_tax.','.$unit_amount.','.(float)$total_amount.'),';
|
||||
}
|
||||
|
||||
if ($replace)
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_detail_tax` WHERE id_order_detail='.(int)$this->id);
|
||||
|
||||
$values = rtrim($values, ',');
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'order_detail_tax` (id_order_detail, id_tax, unit_amount, total_amount)
|
||||
VALUES '.$values;
|
||||
|
||||
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
public function updateTaxAmount($order)
|
||||
{
|
||||
$this->setContext((int)$this->id_shop);
|
||||
$address = new Address((int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||
$tax_manager = TaxManagerFactory::getManager($address, (int)Product::getIdTaxRulesGroupByIdProduct((int)$this->product_id, $this->context));
|
||||
$this->tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
return $this->saveTaxCalculator($order, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a detailed order list of an id_order
|
||||
@@ -406,7 +429,8 @@ class OrderDetailCore extends ObjectModel
|
||||
// Exclude VAT
|
||||
if (!Tax::excludeTaxeOption())
|
||||
{
|
||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct((int)$product['id_product']);
|
||||
$this->setContext((int)$product['id_shop']);
|
||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct((int)$product['id_product'], $this->context);
|
||||
|
||||
$tax_manager = TaxManagerFactory::getManager($this->vat_address, $id_tax_rules);
|
||||
$this->tax_calculator = $tax_manager->getTaxCalculator();
|
||||
@@ -424,7 +448,7 @@ class OrderDetailCore extends ObjectModel
|
||||
* Set specific price of the product
|
||||
* @param object $order
|
||||
*/
|
||||
protected function setSpecificPrice(Order $order)
|
||||
protected function setSpecificPrice(Order $order, $product = null)
|
||||
{
|
||||
$this->reduction_amount = 0.00;
|
||||
$this->reduction_percent = 0.00;
|
||||
@@ -442,8 +466,9 @@ class OrderDetailCore extends ObjectModel
|
||||
$price = Tools::convertPrice($this->specificPrice['reduction'], $order->id_currency);
|
||||
$this->reduction_amount = (float)(!$this->specificPrice['id_currency'] ?
|
||||
$price : $this->specificPrice['reduction']);
|
||||
|
||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct((int)$this->specificPrice['id_product']);
|
||||
if ($product !== null)
|
||||
$this->setContext((int)$product['id_shop']);
|
||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct((int)$this->specificPrice['id_product'], $this->context);
|
||||
$tax_manager = TaxManagerFactory::getManager($this->vat_address, $id_tax_rules);
|
||||
$this->tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
@@ -461,10 +486,11 @@ class OrderDetailCore extends ObjectModel
|
||||
*/
|
||||
protected function setDetailProductPrice(Order $order, Cart $cart, $product)
|
||||
{
|
||||
Product::getPriceStatic((int)$product['id_product'], true, (int)$product['id_product_attribute'], 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price);
|
||||
$this->setContext((int)$product['id_shop']);
|
||||
Product::getPriceStatic((int)$product['id_product'], true, (int)$product['id_product_attribute'], 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price, true, true, $this->context);
|
||||
$this->specificPrice = $specific_price;
|
||||
|
||||
$this->original_product_price = Product::getPriceStatic($product['id_product'], false, (int)$product['id_product_attribute'], 6, null, false, false, 1, false);
|
||||
$this->original_product_price = Product::getPriceStatic($product['id_product'], false, (int)$product['id_product_attribute'], 6, null, false, false, 1, false, null, null, null, $null, true, true, $this->context);
|
||||
$this->product_price = $this->original_product_price;
|
||||
$this->unit_price_tax_incl = (float)$product['price_wt'];
|
||||
$this->unit_price_tax_excl = (float)$product['price'];
|
||||
@@ -475,23 +501,19 @@ class OrderDetailCore extends ObjectModel
|
||||
if ($product['id_supplier'] > 0)
|
||||
$this->purchase_supplier_price = (float)ProductSupplier::getProductPrice((int)$product['id_supplier'], $product['id_product'], $product['id_product_attribute']);
|
||||
|
||||
$this->setSpecificPrice($order);
|
||||
$this->setSpecificPrice($order, $product);
|
||||
|
||||
$this->group_reduction = (float)(Group::getReduction((int)($order->id_customer)));
|
||||
|
||||
if (isset($this->context->shop))
|
||||
$shop_id = $this->context->shop->id;
|
||||
else
|
||||
$shop_id = $cart->id_shop;
|
||||
$shop_id = $this->context->shop->id;
|
||||
|
||||
$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], $shop_id,
|
||||
(int)$cart->id_currency, (int)$this->vat_address->id_country,
|
||||
(int)$this->customer->id_default_group, (int)$product['cart_quantity']);
|
||||
(int)$this->customer->id_default_group, (int)$product['cart_quantity'], false, null, null, $null, true, true, $this->context);
|
||||
|
||||
$unitPrice = Product::getPriceStatic((int)$product['id_product'], true,
|
||||
($product['id_product_attribute'] ? intval($product['id_product_attribute']) : null),
|
||||
2, null, false, true, 1, false, (int)$order->id_customer, null, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
2, null, false, true, 1, false, (int)$order->id_customer, null, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $null, true, true, $this->context);
|
||||
$this->product_quantity_discount = 0.00;
|
||||
if ($quantityDiscount)
|
||||
{
|
||||
|
||||
@@ -208,16 +208,17 @@ class OrderInvoiceCore extends ObjectModel
|
||||
{
|
||||
if (isset($product['product_attribute_id']) && $product['product_attribute_id'])
|
||||
$id_image = Db::getInstance()->getValue('
|
||||
SELECT id_image
|
||||
FROM '._DB_PREFIX_.'product_attribute_image
|
||||
SELECT image_shop.id_image
|
||||
FROM '._DB_PREFIX_.'product_attribute_image pai'.
|
||||
Shop::addSqlAssociation('image', 'pai', true).'
|
||||
WHERE id_product_attribute = '.(int)$product['product_attribute_id']);
|
||||
|
||||
if (!isset($image['id_image']) || !$image['id_image'])
|
||||
if (!isset($id_image) || !$id_image)
|
||||
$id_image = Db::getInstance()->getValue('
|
||||
SELECT id_image
|
||||
FROM '._DB_PREFIX_.'image
|
||||
WHERE id_product = '.(int)($product['product_id']).' AND cover = 1
|
||||
');
|
||||
SELECT image_shop.id_image
|
||||
FROM '._DB_PREFIX_.'image i'.
|
||||
Shop::addSqlAssociation('image', 'i', true, 'image_shop.cover=1').'
|
||||
WHERE id_product = '.(int)($product['product_id']));
|
||||
|
||||
$product['image'] = null;
|
||||
$product['image_size'] = null;
|
||||
@@ -666,4 +667,4 @@ class OrderInvoiceCore extends ObjectModel
|
||||
|
||||
return $is_correct;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,9 +213,19 @@ class OrderSlipCore extends ObjectModel
|
||||
$orderSlip = new OrderSlip();
|
||||
$orderSlip->id_customer = (int)($order->id_customer);
|
||||
$orderSlip->id_order = (int)($order->id);
|
||||
$orderSlip->shipping_cost = (int)($shipping_cost);
|
||||
$orderSlip->shipping_cost = (int)$shipping_cost;
|
||||
if ($orderSlip->shipping_cost)
|
||||
$orderSlip->shipping_cost_amount = $order->total_shipping_tax_incl;
|
||||
$orderSlip->conversion_rate = $currency->conversion_rate;
|
||||
$orderSlip->partial = 0;
|
||||
|
||||
$orderSlip->amount = $orderSlip->shipping_cost_amount;
|
||||
foreach ($productList as $id_order_detail)
|
||||
{
|
||||
$order_detail = new OrderDetail((int)$id_order_detail);
|
||||
$orderSlip->amount += $order_detail->unit_price_tax_incl * $qtyList[(int)$id_order_detail];
|
||||
}
|
||||
|
||||
if (!$orderSlip->add())
|
||||
return false;
|
||||
|
||||
|
||||
@@ -96,7 +96,13 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
|
||||
$this->order->total_shipping_tax_incl = $this->order->total_shipping_tax_excl = 0;
|
||||
|
||||
if ($this->order_slip->partial == 1 && $this->order_slip->shipping_cost_amount > 0)
|
||||
$this->order->total_shipping_tax_incl = $this->order->total_shipping_tax_excl = $this->order_slip->shipping_cost_amount;
|
||||
$this->order->total_shipping_tax_incl = $this->order_slip->shipping_cost_amount;
|
||||
|
||||
$tax = new Tax();
|
||||
$tax->rate = $this->order->carrier_tax_rate;
|
||||
$tax_calculator = new TaxCalculator(array($tax));
|
||||
$this->order->total_shipping_tax_excl = Tools::ps_round($tax_calculator->removeTaxes($this->order_slip->shipping_cost_amount), 2);
|
||||
|
||||
|
||||
$this->order->total_paid_tax_incl += $this->order->total_shipping_tax_incl;
|
||||
$this->order->total_paid_tax_excl += $this->order->total_shipping_tax_excl;
|
||||
@@ -158,6 +164,11 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
|
||||
public function getProductTaxesBreakdown()
|
||||
{
|
||||
$tmp_tax_infos = array();
|
||||
$infos = array(
|
||||
'total_price_tax_excl' => 0,
|
||||
'total_amount' => 0
|
||||
);
|
||||
|
||||
foreach ($this->order_slip->getOrdersSlipDetail((int)$this->order_slip->id) as $order_slip_details)
|
||||
{
|
||||
$tax_calculator = OrderDetail::getTaxCalculatorStatic((int)$order_slip_details['id_order_detail']);
|
||||
@@ -176,33 +187,26 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$tmp_tax_infos[$tax->rate]['total_price_tax_excl'] += $order_slip_details['amount_tax_excl'];
|
||||
$tmp_tax_infos[$tax->rate]['total_amount'] += $amount;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$infos = array(
|
||||
'total_price_tax_excl' => 0,
|
||||
'total_amount' => 0
|
||||
);
|
||||
|
||||
$tax_rate = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($tax_amount as $tax_id => $amount)
|
||||
{
|
||||
$tax_rate = 0;
|
||||
|
||||
$tax = new Tax((int)$tax_id);
|
||||
|
||||
$tax_rate += $tax->rate;
|
||||
$infos['total_price_tax_excl'] += $order_slip_details['amount_tax_excl'];
|
||||
$infos['total_amount'] += $amount;
|
||||
$tax_rate = $tax->rate;
|
||||
$infos['total_price_tax_excl'] += (float)Tools::ps_round($order_slip_details['amount_tax_excl'], 2);
|
||||
$infos['total_amount'] += (float)Tools::ps_round($amount, 2);
|
||||
}
|
||||
|
||||
$tmp_tax_infos[(string)number_format($tax_rate, 3)] = $infos;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $tmp_tax_infos;
|
||||
}
|
||||
|
||||
|
||||
@@ -340,10 +340,10 @@ class ShopCore extends ObjectModel
|
||||
{
|
||||
// extract url parameters
|
||||
$request_uri = substr($request_uri, strlen($found_uri));
|
||||
|
||||
$url = str_replace('//', '/', $row['domain'].$row['uri'].$request_uri);
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Cache-Control: no-cache');
|
||||
header('location: http://'.$row['domain'].$row['uri'].$request_uri);
|
||||
header('location: http://'.$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -749,7 +749,7 @@ class ShopCore extends ObjectModel
|
||||
*/
|
||||
public static function getSharedShops($shop_id, $type)
|
||||
{
|
||||
if (!in_array($type, array(Shop::SHARE_CUSTOMER, Shop::SHARE_ORDER)))
|
||||
if (!in_array($type, array(Shop::SHARE_CUSTOMER, Shop::SHARE_ORDER, SHOP::SHARE_STOCK)))
|
||||
die('Wrong argument ($type) in Shop::getSharedShops() method');
|
||||
|
||||
Shop::cacheShops();
|
||||
@@ -911,6 +911,8 @@ class ShopCore extends ObjectModel
|
||||
$sql .= ' AND '.$table_alias.'.id_shop = '.(int)self::$context_id_shop;
|
||||
elseif (Shop::checkIdShopDefault($table))
|
||||
$sql .= ' AND '.$table_alias.'.id_shop = '.$alias.'.id_shop_default';
|
||||
else
|
||||
$sql .= ' AND '.$table_alias.'.id_shop IN ('.implode(', ', Shop::getContextListShopID()).')';
|
||||
$sql .= (($on) ? ' AND '.$on : '').')';
|
||||
return $sql;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,10 @@ class StockAvailableCore extends ObjectModel
|
||||
),
|
||||
'hidden_fields' => array(
|
||||
),
|
||||
'objectMethods' => array(
|
||||
'add' => 'addWs',
|
||||
'update' => 'updateWs',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -93,6 +97,14 @@ class StockAvailableCore extends ObjectModel
|
||||
* @param int $id_shop Optional
|
||||
* @return int
|
||||
*/
|
||||
|
||||
public function updateWs()
|
||||
{
|
||||
if ($this->depends_on_stock)
|
||||
return WebserviceRequest::getInstance()->setError(500, Tools::displayError('You can\'t update stock available when it\'s depend on stock'));
|
||||
return $this->update();
|
||||
}
|
||||
|
||||
public static function getStockAvailableIdByProductId($id_product, $id_product_attribute = null, $id_shop = null)
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product))
|
||||
@@ -361,7 +373,7 @@ class StockAvailableCore extends ObjectModel
|
||||
{
|
||||
if (!parent::update($null_values))
|
||||
return false;
|
||||
$this->postSave();
|
||||
return $this->postSave();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,6 +521,26 @@ class StockAvailableCore extends ObjectModel
|
||||
{
|
||||
if (!Validate::isUnsignedId($id_product))
|
||||
return false;
|
||||
|
||||
if (Shop::getContext() == SHOP::CONTEXT_SHOP)
|
||||
if (Shop::getContextShopGroup()->share_stock == 1)
|
||||
{
|
||||
$pa_sql = '';
|
||||
if ($id_product_attribute !== null)
|
||||
{
|
||||
$pa_sql = '_attribute';
|
||||
$id_product_attribute_sql = $id_product_attribute;
|
||||
}
|
||||
else
|
||||
$id_product_attribute_sql = $id_product;
|
||||
|
||||
if ((int)Db::getInstance()->getValue('SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'product'.$pa_sql.'_shop
|
||||
WHERE id_product'.$pa_sql.'='.(int)$id_product_attribute_sql.'
|
||||
AND id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID(SHOP::SHARE_STOCK))).')'))
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'stock_available
|
||||
WHERE id_product = '.(int)$id_product.
|
||||
|
||||
+5
-2
@@ -250,10 +250,13 @@ class TaxCore extends ObjectModel
|
||||
* @param integer $id_country
|
||||
* @return Tax
|
||||
*/
|
||||
public static function getProductTaxRate($id_product, $id_address = null)
|
||||
public static function getProductTaxRate($id_product, $id_address = null, Context $context = null)
|
||||
{
|
||||
if ($context == null)
|
||||
$context = Context::getContext();
|
||||
|
||||
$address = Address::initialize($id_address);
|
||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct($id_product);
|
||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct($id_product, $context);
|
||||
|
||||
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
|
||||
$tax_calculator = $tax_manager->getTaxCalculator();
|
||||
|
||||
@@ -124,6 +124,10 @@ class WebserviceOutputXMLCore implements WebserviceOutputInterface
|
||||
if ($field['value'] != '')
|
||||
$node_content .= '<![CDATA['.$field['value'].']]>';
|
||||
}
|
||||
|
||||
if (isset($field['encode']))
|
||||
$ret .= ' encode="'.$field['encode'].'"';
|
||||
|
||||
if (isset($field['synopsis_details']) && !empty($field['synopsis_details']) && $this->schemaToDisplay !== 'blank')
|
||||
{
|
||||
foreach ($field['synopsis_details'] as $name => $detail)
|
||||
|
||||
@@ -269,7 +269,7 @@ class WebserviceRequestCore
|
||||
'stock_movement_reasons' => array('description' => 'Stock movement reason', 'class' => 'StockMvtReason'),
|
||||
'warehouses' => array('description' => 'Warehouses', 'class' => 'Warehouse', 'forbidden_method' => array('DELETE')),
|
||||
'stocks' => array('description' => 'Stocks', 'class' => 'Stock', 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
'stock_availables' => array('description' => 'Available quantities', 'class' => 'StockAvailable', 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
'stock_availables' => array('description' => 'Available quantities', 'class' => 'StockAvailable', 'forbidden_method' => array('POST', 'DELETE')),
|
||||
'warehouse_product_locations' => array('description' => 'Location of products in warehouses', 'class' => 'WarehouseProductLocation', 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
'supply_orders' => array('description' => 'Supply Orders', 'class' => 'SupplyOrder', 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
'supply_order_details' => array('description' => 'Supply Order Details', 'class' => 'SupplyOrderDetail', 'forbidden_method' => array('PUT', 'POST', 'DELETE')),
|
||||
@@ -329,6 +329,7 @@ class WebserviceRequestCore
|
||||
$arr_return = array();
|
||||
foreach($parameters as $name => $value)
|
||||
{
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
$id_country = (int)(isset($value['country']) ? $value['country'] : (Configuration::get('PS_COUNTRY_DEFAULT')));
|
||||
$id_state = (int)(isset($value['state']) ? $value['state'] : 0);
|
||||
$id_currency = (int)(isset($value['currency']) ? $value['currency'] : Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
@@ -344,7 +345,7 @@ class WebserviceRequestCore
|
||||
$use_ecotax = (int)(isset($value['use_ecotax']) ? $value['use_ecotax'] : Configuration::get('PS_USE_ECOTAX'));
|
||||
$specific_price_output = null;
|
||||
$id_county = (isset($value['county']) ? $value['county'] : 0);
|
||||
$return_value = Product::priceCalculation(null, $value['object_id'], $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity,
|
||||
$return_value = Product::priceCalculation($id_shop, $value['object_id'], $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity,
|
||||
$use_tax, $decimals, $only_reduc, $use_reduc, $use_ecotax, $specific_price_output, null);
|
||||
$arr_return[$name] = array('sqlId'=>strtolower($name), 'value'=>$return_value);
|
||||
}
|
||||
@@ -608,7 +609,6 @@ class WebserviceRequestCore
|
||||
*/
|
||||
public function webserviceErrorHandler($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
echo 'Error Handler WebserviceRequest';
|
||||
$display_errors = strtolower(ini_get('display_errors')) != 'off';
|
||||
if (!(error_reporting() & $errno) || $display_errors)
|
||||
return;
|
||||
@@ -1477,16 +1477,16 @@ class WebserviceRequestCore
|
||||
}
|
||||
elseif ((!isset($fieldProperties['required']) || !$fieldProperties['required']) && property_exists($object, $sqlId))
|
||||
$object->$sqlId = null;
|
||||
|
||||
if (isset($fieldProperties['i18n']) && $fieldProperties['i18n'])
|
||||
{
|
||||
$i18n = true;
|
||||
if (isset($attributes->$fieldName, $attributes->$fieldName->language))
|
||||
foreach ($attributes->$fieldName->language as $lang)
|
||||
$object->{$fieldName}[(int)$lang->attributes()->id] = (string)$lang;
|
||||
else
|
||||
$object->{$fieldName} = (string)$attributes->$fieldName;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->hasErrors())
|
||||
{
|
||||
if ($i18n && ($retValidateFieldsLang = $object->validateFieldsLang(false, true)) !== true)
|
||||
@@ -1538,7 +1538,7 @@ class WebserviceRequestCore
|
||||
}
|
||||
}
|
||||
$assoc = Shop::getAssoTable($this->resourceConfiguration['retrieveData']['table']);
|
||||
if ($assoc !== false)
|
||||
if ($assoc !== false && $assoc['type'] != 'fk_shop')
|
||||
{
|
||||
// PUT nor POST is destructive, no deletion
|
||||
$sql = 'INSERT IGNORE INTO `'.bqSQL(_DB_PREFIX_.$this->resourceConfiguration['retrieveData']['table'].'_'.$assoc['type']).'` (id_shop, '.pSQL($this->resourceConfiguration['fields']['id']['sqlId']).') VALUES ';
|
||||
|
||||
@@ -945,6 +945,12 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
|
||||
$image = new Image();
|
||||
$image->id_product = (int)($product->id);
|
||||
$image->position = Image::getHighestPosition($product->id) + 1;
|
||||
|
||||
if (!Image::getCover((int)$product->id))
|
||||
$image->cover = 1;
|
||||
else
|
||||
$image->cover = 0;
|
||||
|
||||
if (!$image->add())
|
||||
throw new WebserviceException('Error while creating image', array(76, 400));
|
||||
if (!Validate::isLoadedObject($product))
|
||||
@@ -976,13 +982,21 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
|
||||
}
|
||||
@unlink($tmpName);
|
||||
$this->imgToDisplay = _PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format;
|
||||
$this->objOutput->setFieldsToDisplay('full');
|
||||
$this->output = $this->objOutput->renderEntity($image, 1);
|
||||
$image_content = array('sqlId' => 'content', 'value' => base64_encode(file_get_contents($this->imgToDisplay)), 'encode' => 'base64');
|
||||
$this->output .= $this->objOutput->objectRender->renderField($image_content);
|
||||
}
|
||||
elseif ($this->imageType == 'categories')
|
||||
elseif (in_array($this->imageType, array('categories', 'manufacturers', 'suppliers', 'stores')))
|
||||
{
|
||||
if (!($tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS')) || !move_uploaded_file($file['tmp_name'], $tmpName))
|
||||
throw new WebserviceException('An error occurred during the image upload', array(76, 400));
|
||||
elseif (!ImageManager::resize($tmpName, $receptionPath))
|
||||
throw new WebserviceException('An error occurred while copying image', array(76, 400));
|
||||
$imagesTypes = ImageType::getImagesTypes($this->imageType);
|
||||
foreach ($imagesTypes as $imageType)
|
||||
if (!ImageManager::resize($tmpName, $parentPath.$this->wsObject->urlSegment[2].'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']))
|
||||
$this->_errors[] = Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name']);
|
||||
@unlink(_PS_TMP_IMG_DIR_.$tmpName);
|
||||
$this->imgToDisplay = $receptionPath;
|
||||
}
|
||||
@@ -993,4 +1007,4 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
|
||||
else
|
||||
throw new WebserviceException('Method '.$this->wsObject->method.' is not allowed for an image resource', array(77, 405));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-6
@@ -71,13 +71,18 @@ if (_PS_DEBUG_PROFILING_)
|
||||
/* Redefine REQUEST_URI if empty (on some webservers...) */
|
||||
if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
|
||||
{
|
||||
if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && empty($_SERVER['QUERY_STRING']))
|
||||
$_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']).'/';
|
||||
else
|
||||
if (!isset($_SERVER['SCRIPT_NAME']) && isset($_SERVER['SCRIPT_FILENAME']))
|
||||
$_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_FILENAME'];
|
||||
if (isset($_SERVER['SCRIPT_NAME']))
|
||||
{
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
|
||||
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']))
|
||||
$_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
|
||||
if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && empty($_SERVER['QUERY_STRING']))
|
||||
$_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']).'/';
|
||||
else
|
||||
{
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
|
||||
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']))
|
||||
$_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ $smarty->setCacheDir(_PS_CACHE_DIR_.'smarty/cache');
|
||||
$smarty->setConfigDir(_PS_SMARTY_DIR_.'configs');
|
||||
$smarty->caching = false;
|
||||
$smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_) ? true : false;
|
||||
$smarty->compile_check = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_CHECK_COMPILE_) ? true : false;
|
||||
$smarty->compile_check = (Configuration::get('PS_SMARTY_FORCE_COMPILE') <= _PS_SMARTY_CHECK_COMPILE_) ? true : false;
|
||||
|
||||
// Production mode
|
||||
$smarty->debugging = false;
|
||||
|
||||
@@ -132,6 +132,8 @@ class AdminAccessControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessUpdateAccess()
|
||||
{
|
||||
if (_PS_MODE_DEMO_)
|
||||
throw new PrestaShopException(Tools::displayError('This functionality has been disabled.'));
|
||||
if ($this->tabAccess['edit'] != '1')
|
||||
throw new PrestaShopException(Tools::displayError('You do not have permission to edit here.'));
|
||||
|
||||
@@ -190,9 +192,10 @@ class AdminAccessControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessUpdateModuleAccess()
|
||||
{
|
||||
if (_PS_MODE_DEMO_)
|
||||
throw new PrestaShopException(Tools::displayError('This functionality has been disabled.'));
|
||||
if ($this->tabAccess['edit'] != '1')
|
||||
throw new PrestaShopException(Tools::displayError('You do not have permission to edit here.'));
|
||||
/* Update Access Modules */
|
||||
|
||||
if (Tools::isSubmit('changeModuleAccess'))
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$this->className = 'Address';
|
||||
$this->lang = false;
|
||||
$this->addressType = 'customer';
|
||||
$this->explicitSelect = true;
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->addRowAction('edit');
|
||||
@@ -70,7 +71,6 @@ class AdminAddressesControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON a.id_customer = c.id_customer
|
||||
';
|
||||
|
||||
$this->_where = 'AND a.id_customer != 0 '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');
|
||||
|
||||
return parent::renderList();
|
||||
|
||||
@@ -126,13 +126,12 @@ class AdminAttachmentsControllerCore extends AdminController
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_)
|
||||
{
|
||||
$this->errors[] = Tools::displayError('This functionality has been disabled.');
|
||||
return;
|
||||
}
|
||||
/* PrestaShop demo mode*/
|
||||
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
$id = (int)Tools::getValue('id_attachment');
|
||||
|
||||
@@ -46,7 +46,7 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
foreach ($attributes as $attribute)
|
||||
{
|
||||
$price += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute)));
|
||||
$weight += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact'.(int)$attribute)));
|
||||
$weight += (float)preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact_'.(int)$attribute)));
|
||||
}
|
||||
if ($this->product->id)
|
||||
{
|
||||
@@ -130,6 +130,8 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
foreach ($attributes as $attribute)
|
||||
StockAvailable::setQuantity($this->product->id, $attribute['id_product_attribute'], $quantity);
|
||||
}
|
||||
else
|
||||
StockAvailable::synchronize($this->product->id);
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)Tools::getValue('id_product').'&addproduct&key_tab=Combinations&conf=4');
|
||||
}
|
||||
else
|
||||
@@ -165,11 +167,11 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
$attributes = array();
|
||||
foreach ($tab as $group)
|
||||
foreach ($group as $attribute)
|
||||
{
|
||||
$price = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute)));
|
||||
$weight = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact'.(int)$attribute)));
|
||||
$attributes[] = '('.(int)$id_product.', '.(int)$attribute.', '.(float)$price.', '.(float)$weight.')';
|
||||
}
|
||||
{
|
||||
$price = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('price_impact_'.(int)$attribute)));
|
||||
$weight = preg_replace('/[^0-9.]/', '', str_replace(',', '.', Tools::getValue('weight_impact_'.(int)$attribute)));
|
||||
$attributes[] = '('.(int)$id_product.', '.(int)$attribute.', '.(float)$price.', '.(float)$weight.')';
|
||||
}
|
||||
|
||||
return Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'attribute_impact` (`id_product`, `id_attribute`, `price`, `weight`)
|
||||
@@ -177,34 +179,35 @@ class AdminAttributeGeneratorControllerCore extends AdminController
|
||||
ON DUPLICATE KEY UPDATE `price` = VALUES(price), `weight` = VALUES(weight)');
|
||||
}
|
||||
|
||||
protected static function getAttributesImpacts($id_product)
|
||||
{
|
||||
$tab = array();
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT ai.`id_attribute`, ai.`price`, ai.`weight`
|
||||
FROM `'._DB_PREFIX_.'attribute_impact` ai
|
||||
WHERE ai.`id_product` = '.(int)$id_product);
|
||||
if (!$result)
|
||||
return array();
|
||||
foreach ($result as $impact)
|
||||
{
|
||||
$tab[$impact['id_attribute']]['price'] = (float)$impact['price'];
|
||||
$tab[$impact['id_attribute']]['weight'] = (float)$impact['weight'];
|
||||
}
|
||||
return $tab;
|
||||
protected static function getAttributesImpacts($id_product)
|
||||
{
|
||||
$tab = array();
|
||||
$result = Db::getInstance()->executeS(
|
||||
'SELECT ai.`id_attribute`, ai.`price`, ai.`weight`
|
||||
FROM `'._DB_PREFIX_.'attribute_impact` ai
|
||||
WHERE ai.`id_product` = '.(int)$id_product);
|
||||
|
||||
if (!$result)
|
||||
return array();
|
||||
foreach ($result as $impact)
|
||||
{
|
||||
$tab[$impact['id_attribute']]['price'] = (float)$impact['price'];
|
||||
$tab[$impact['id_attribute']]['weight'] = (float)$impact['weight'];
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
|
||||
public function initGroupTable()
|
||||
{
|
||||
$combinations_groups = $this->product->getAttributesGroups($this->context->language->id);
|
||||
$attributes = array();
|
||||
$impacts = AdminAttributeGeneratorController::getAttributesImpacts($this->product->id);
|
||||
$impacts = AdminAttributeGeneratorController::getAttributesImpacts($this->product->id);
|
||||
foreach ($combinations_groups as &$combination)
|
||||
{
|
||||
$target = &$attributes[$combination['id_attribute_group']][$combination['id_attribute']];
|
||||
$target = &$attributes[$combination['id_attribute_group']][$combination['id_attribute']];
|
||||
$target = $combination;
|
||||
if (isset($impacts[$combination['id_attribute']]))
|
||||
{
|
||||
if (isset($impacts[$combination['id_attribute']]))
|
||||
{
|
||||
$target['price'] = $impacts[$combination['id_attribute']]['price'];
|
||||
$target['weight'] = $impacts[$combination['id_attribute']]['weight'];
|
||||
}
|
||||
|
||||
@@ -139,8 +139,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
$this->_orderBy = 'position';
|
||||
|
||||
// get list and force no limit clause in the request
|
||||
$this->getList($this->context->language->id);
|
||||
|
||||
$this->getList($this->context->language->id, null, null, 0, false);
|
||||
|
||||
// Render list
|
||||
$helper = new HelperList();
|
||||
|
||||
@@ -195,7 +195,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// If the new rule has no cart rule restriction, then it must be added to the white list of the other cart rules that have restrictions
|
||||
if ($currentObject->cart_rule_restriction == 0)
|
||||
if (!Tools::getValue('cart_rule_restriction'))
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'cart_rule_combination` (`id_cart_rule_1`, `id_cart_rule_2`) (
|
||||
@@ -209,6 +209,7 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
SELECT cr.id_cart_rule
|
||||
FROM '._DB_PREFIX_.'cart_rule cr
|
||||
WHERE cr.id_cart_rule != '.(int)$currentObject->id.'
|
||||
AND cr.cart_rule_restriction = 0
|
||||
AND cr.id_cart_rule NOT IN (
|
||||
SELECT IF(id_cart_rule_1 = '.(int)$currentObject->id.', id_cart_rule_2, id_cart_rule_1)
|
||||
FROM '._DB_PREFIX_.'cart_rule_combination
|
||||
|
||||
@@ -32,6 +32,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->table = 'cart';
|
||||
$this->className = 'Cart';
|
||||
$this->lang = false;
|
||||
$this->explicitSelect = true;
|
||||
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('delete');
|
||||
@@ -87,7 +88,6 @@ class AdminCartsControllerCore extends AdminController
|
||||
'width' => 40,
|
||||
'align' => 'center',
|
||||
'type' => 'bool',
|
||||
'filter_key' => 'id_guest',
|
||||
'havingFilter' => true,
|
||||
'icon' => array(0 => 'blank.gif', 1 => 'tab-customers.gif')
|
||||
)
|
||||
@@ -295,7 +295,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->initFooter();
|
||||
$this->context->smarty->assign(array('customization_errors' => implode('<br />', $errors),
|
||||
'css_files' => $this->css_files));
|
||||
return $this->context->smarty->display('controllers/orders/form_customization_feedback.tpl');
|
||||
return $this->smartyOutputContent('controllers/orders/form_customization_feedback.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$this->className = 'Category';
|
||||
$this->lang = true;
|
||||
$this->deleted = false;
|
||||
$this->explicitSelect = true;
|
||||
|
||||
$this->context = Context::getContext();
|
||||
|
||||
@@ -73,7 +74,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'position' => array(
|
||||
'title' => $this->l('Position'),
|
||||
'width' => 40,
|
||||
'filter_key' => 'cs!position',
|
||||
'filter_key' => 'sa!position',
|
||||
'align' => 'center',
|
||||
'position' => 'position'
|
||||
),
|
||||
@@ -440,7 +441,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'name' => 'link_rewrite',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Forbidden characters:').' <>;=#{}'
|
||||
'hint' => $this->l('Only letters and the minus (-) character are allowed')
|
||||
),
|
||||
array(
|
||||
'type' => 'group',
|
||||
@@ -507,11 +508,11 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
{
|
||||
if (!in_array($this->display, array('edit', 'add')))
|
||||
$this->multishop_context_group = false;
|
||||
|
||||
if (Tools::isSubmit('forcedeleteImage'))
|
||||
if (Tools::isSubmit('forcedeleteImage') || isset($_FILES['image']))
|
||||
{
|
||||
$this->processForceDeleteImage();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminCategories').'&conf=7');
|
||||
if (Tools::isSubmit('forcedeleteImage'))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminCategories').'&conf=7');
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
@@ -519,7 +520,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function processForceDeleteImage()
|
||||
{
|
||||
$category = $this->loadObject();
|
||||
$category = $this->loadObject(true);
|
||||
if (Validate::isLoadedObject($category))
|
||||
$category->deleteImage(true);
|
||||
}
|
||||
@@ -544,9 +545,8 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$object = parent::processAdd();
|
||||
|
||||
//if we create a you root category you have to associate to a shop before to add sub categories in. So we redirect to AdminCategories listing
|
||||
if (Tools::isSubmit('is_root_category'))
|
||||
if ($object && Tools::getValue('is_root_category'))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminCategories').'&conf=3');
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
$this->lang = true;
|
||||
$this->deleted = false;
|
||||
|
||||
$this->explicitSelect = true;
|
||||
$this->addRowAction('edit');
|
||||
|
||||
$this->context = Context::getContext();
|
||||
@@ -43,7 +44,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
'enableSelection' => array('text' => $this->l('Enable selection')),
|
||||
'disableSelection' => array('text' => $this->l('Disable selection')),
|
||||
'affectzone' => array('text' => $this->l('Assign to a new zone'))
|
||||
);
|
||||
);
|
||||
|
||||
$this->fieldImageSettings = array(
|
||||
'name' => 'logo',
|
||||
@@ -403,6 +404,29 @@ class AdminCountriesControllerCore extends AdminController
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject()))
|
||||
Country::addModuleRestrictions(array(), array(array('id_country' => $object->id)), array());
|
||||
|
||||
parent::processStatus();
|
||||
}
|
||||
|
||||
public function processBulkStatusSelection($way)
|
||||
{
|
||||
if (is_array($this->boxes) && !empty($this->boxes))
|
||||
{
|
||||
$countries_ids = array();
|
||||
foreach ($this->boxes as $id)
|
||||
$countries_ids[] = array('id_country' => $id);
|
||||
|
||||
if (count($countries_ids))
|
||||
Country::addModuleRestrictions(array(), $countries_ids, array());
|
||||
}
|
||||
parent::processBulkStatusSelection($way);
|
||||
}
|
||||
|
||||
|
||||
protected function displayValidFields()
|
||||
{
|
||||
|
||||
@@ -34,13 +34,6 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
$this->lang = false;
|
||||
$this->multishop_context = Shop::CONTEXT_ALL;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Currency')),
|
||||
@@ -75,6 +68,8 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
<b>'.Tools::getShopDomain(true, true).__PS_BASE_URI__.basename(_PS_ADMIN_DIR_).'/cron_currency_rates.php?secure_key='.md5(_COOKIE_KEY_.Configuration::get('PS_SHOP_NAME')).'</b></p>',
|
||||
)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
@@ -97,13 +92,12 @@ class AdminCurrenciesControllerCore extends AdminController
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Currency:'),
|
||||
'label' => $this->l('Currency name:'),
|
||||
'name' => 'name',
|
||||
'size' => 30,
|
||||
'maxlength' => 32,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Only letters and the minus character are allowed'),
|
||||
'desc' => $this->l('Will appear in Front Office (e.g. $, €)').'...',
|
||||
'hint' => $this->l('Only letters and the minus character are allowed')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
|
||||
@@ -59,6 +59,13 @@ class AdminCustomerPreferencesControllerCore extends AdminController
|
||||
'list' => $registration_process_type,
|
||||
'identifier' => 'value'
|
||||
),
|
||||
'PS_ONE_PHONE_AT_LEAST' => array(
|
||||
'title' => $this->l('Phone number'),
|
||||
'desc' => $this->l('If you chose yes, your customer will have to provide at least one phone number to register.'),
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_CART_FOLLOWING' => array(
|
||||
'title' => $this->l('Cart re-display at login'),
|
||||
'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'),
|
||||
|
||||
@@ -136,7 +136,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_CUSTOMER_SERVICE_SIGNATURE' => array(
|
||||
'title' => $this->l('Allow file upload'),
|
||||
'title' => $this->l('Default message'),
|
||||
'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'),
|
||||
'type' => 'textareaLang',
|
||||
'lang' => true,
|
||||
@@ -153,70 +153,59 @@ class AdminCustomerThreadsControllerCore extends AdminController
|
||||
'desc' => $this->l('URL for IMAP server (mail.server.com)'),
|
||||
'type' => 'text',
|
||||
'size' => 40,
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_PORT' => array(
|
||||
'title' => $this->l('IMAP port'),
|
||||
'desc' => $this->l('Port to use to connect to IMAP server'),
|
||||
'type' => 'text',
|
||||
'defaultValue' => 143,
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_USER' => array(
|
||||
'title' => $this->l('IMAP user'),
|
||||
'desc' => $this->l('User to use to connect to IMAP server'),
|
||||
'type' => 'text',
|
||||
'size' => 40,
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_PWD' => array(
|
||||
'title' => $this->l('IMAP password'),
|
||||
'desc' => $this->l('Password to use to connect IMAP server'),
|
||||
'type' => 'text',
|
||||
'size' => 40,
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_DELETE_MSG' => array(
|
||||
'title' => $this->l('Delete messages'),
|
||||
'desc' => $this->l('Delete messages after sync. If you do not active this option, the sync will be longer'),
|
||||
'type' => 'bool',
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_OPT_NORSH' => array(
|
||||
'title' => $this->l('IMAP options').' (/norsh)',
|
||||
'type' => 'bool',
|
||||
'desc' => $this->l('Do not use RSH or SSH to establish a preauthenticated IMAP session'),
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_OPT_SSL' => array(
|
||||
'title' => $this->l('IMAP options').' (/ssl)',
|
||||
'type' => 'bool',
|
||||
'desc' => $this->l('Use the Secure Socket Layer to encrypt the session'),
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_OPT_VALIDATE-CERT' => array(
|
||||
'title' => $this->l('IMAP options').' (/validate-cert)',
|
||||
'type' => 'bool',
|
||||
'desc' => $this->l('Validate certificates from TLS/SSL server'),
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_OPT_NOVALIDATE-CERT' => array(
|
||||
'title' => $this->l('IMAP options').' (/novalidate-cert)',
|
||||
'type' => 'bool',
|
||||
'desc' => $this->l('Do not validate certificates from TLS/SSL server, needed if server uses self-signed certificates'),
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_OPT_TLS' => array(
|
||||
'title' => $this->l('IMAP options').' (/tls)',
|
||||
'type' => 'bool',
|
||||
'desc' => $this->l('Force use of start-TLS to encrypt the session, and reject connection to servers that do not support it'),
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
'PS_SAV_IMAP_OPT_NOTLS' => array(
|
||||
'title' => $this->l('IMAP options').' (/notls)',
|
||||
'type' => 'bool',
|
||||
'desc' => $this->l('Do not use start-TLS to encrypt the session, even with servers that support it'),
|
||||
'visibility' => Shop::CONTEXT_ALL,
|
||||
),
|
||||
),
|
||||
'submit' => array('title' => $this->l('Save'), 'class' => 'button'),
|
||||
|
||||
@@ -41,6 +41,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->className = 'Customer';
|
||||
$this->lang = false;
|
||||
$this->deleted = true;
|
||||
$this->explicitSelect = true;
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('view');
|
||||
@@ -63,6 +64,15 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$genders[$gender->id] = $gender->name;
|
||||
}
|
||||
|
||||
$this->_select = '
|
||||
a.date_add,
|
||||
IF (YEAR(`birthday`) = 0, "-", (YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5) < RIGHT(birthday, 5))) AS `age`, (
|
||||
SELECT c.date_add FROM '._DB_PREFIX_.'guest g
|
||||
LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
|
||||
WHERE g.id_customer = a.id_customer
|
||||
ORDER BY c.date_add DESC
|
||||
LIMIT 1
|
||||
) as connect';
|
||||
$this->fields_list = array(
|
||||
'id_customer' => array(
|
||||
'title' => $this->l('ID'),
|
||||
@@ -70,7 +80,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'width' => 20
|
||||
),
|
||||
'id_gender' => array(
|
||||
'title' => $this->l('Gender'),
|
||||
'title' => $this->l('Titles'),
|
||||
'width' => 70,
|
||||
'align' => 'center',
|
||||
'icon' => $genders_icon,
|
||||
@@ -103,7 +113,8 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'align' => 'center',
|
||||
'active' => 'status',
|
||||
'type' => 'bool',
|
||||
'orderby' => false
|
||||
'orderby' => false,
|
||||
'filter_key' => 'a!active',
|
||||
),
|
||||
'newsletter' => array(
|
||||
'title' => $this->l('News.'),
|
||||
@@ -212,14 +223,6 @@ class AdminCustomersControllerCore extends AdminController
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->_select = 'IF (YEAR(`birthday`) = 0, "-", (YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5) < RIGHT(birthday, 5))) AS `age`, (
|
||||
SELECT c.date_add FROM '._DB_PREFIX_.'guest g
|
||||
LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
|
||||
WHERE g.id_customer = a.id_customer
|
||||
ORDER BY c.date_add DESC
|
||||
LIMIT 1
|
||||
) as connect';
|
||||
|
||||
if (Tools::isSubmit('submitBulkdelete'.$this->table) || Tools::isSubmit('delete'.$this->table))
|
||||
$this->tpl_list_vars = array(
|
||||
'delete_customer' => true,
|
||||
@@ -257,7 +260,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Gender:'),
|
||||
'label' => $this->l('Titles:'),
|
||||
'name' => 'id_gender',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
@@ -681,7 +684,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'addresses' => $customer->getAddresses($this->default_form_language),
|
||||
|
||||
// Discounts
|
||||
'discounts' => Discount::getCustomerDiscounts($this->default_form_language, $customer->id, false, false),
|
||||
'discounts' => CartRule::getCustomerCartRules($this->default_form_language, $customer->id, false, false),
|
||||
|
||||
// Carts
|
||||
'carts' => $carts,
|
||||
@@ -701,12 +704,15 @@ class AdminCustomersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
$this->_setDeletedMode();
|
||||
parent::processDelete();
|
||||
}
|
||||
|
||||
protected function _setDeletedMode()
|
||||
{
|
||||
if ($this->delete_mode == 'real')
|
||||
{
|
||||
$this->deleted = false;
|
||||
Discount::deleteByIdCustomer((int)Tools::getValue('id_customer'));
|
||||
}
|
||||
elseif ($this->delete_mode == 'deleted')
|
||||
$this->deleted = true;
|
||||
else
|
||||
@@ -714,8 +720,12 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Unknown delete mode:').' '.$this->deleted;
|
||||
return;
|
||||
}
|
||||
|
||||
parent::processDelete();
|
||||
}
|
||||
|
||||
protected function processBulkDelete()
|
||||
{
|
||||
$this->_setDeletedMode();
|
||||
parent::processBulkDelete();
|
||||
}
|
||||
|
||||
public function processAdd()
|
||||
|
||||
@@ -210,14 +210,14 @@ class AdminEmployeesControllerCore extends AdminController
|
||||
),
|
||||
array(
|
||||
'type' => 'default_tab',
|
||||
'label' => $this->l('Default page'),
|
||||
'label' => $this->l('Default page:'),
|
||||
'name' => 'default_tab',
|
||||
'desc' => $this->l('This page will be displayed just after login'),
|
||||
'options' => $this->tabs_list
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Back Office width'),
|
||||
'label' => $this->l('Back Office width:'),
|
||||
'name' => 'bo_width',
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Back Office width, in pixels. The value "0" means that the Back Office width will be flexible.')
|
||||
|
||||
@@ -92,7 +92,7 @@ class AdminGendersControllerCore extends AdminController
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Gender'),
|
||||
'title' => $this->l('Titles'),
|
||||
'image' => '../img/admin/tab-genders.gif'
|
||||
),
|
||||
'input' => array(
|
||||
|
||||
@@ -149,7 +149,7 @@ class AdminGroupsControllerCore extends AdminController
|
||||
}
|
||||
$customer_fields_display = (array(
|
||||
'id_customer' => array('title' => $this->l('ID'), 'width' => 15, 'align' => 'center'),
|
||||
'id_gender' => array('title' => $this->l('Gender'), 'align' => 'center', 'width' => 50,'icon' => $genders_icon, 'list' => $genders),
|
||||
'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'width' => 50,'icon' => $genders_icon, 'list' => $genders),
|
||||
'firstname' => array('title' => $this->l('Name'), 'align' => 'center'),
|
||||
'lastname' => array('title' => $this->l('Name'), 'align' => 'center'),
|
||||
'email' => array('title' => $this->l('E-mail address'), 'width' => 150, 'align' => 'center'),
|
||||
|
||||
@@ -41,9 +41,15 @@ class AdminImagesControllerCore extends AdminController
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_image_type' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'size' => 16),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 300),
|
||||
'width' => array('title' => $this->l('Width'), 'align' => 'right', 'suffix' => ' px', 'width' => 50, 'size' => 5),
|
||||
'height' => array('title' => $this->l('Height'), 'align' => 'right', 'suffix' => ' px', 'width' => 50, 'size' => 5)
|
||||
'height' => array('title' => $this->l('Height'), 'align' => 'right', 'suffix' => ' px', 'width' => 50, 'size' => 5),
|
||||
'products' => array('title' => $this->l('Products'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'categories' => array('title' => $this->l('Categories'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'manufacturers' => array('title' => $this->l('Manufacturers'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'suppliers' => array('title' => $this->l('Suppliers'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'scenes' => array('title' => $this->l('Scenes'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false),
|
||||
'stores' => array('title' => $this->l('Stores'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false)
|
||||
);
|
||||
|
||||
$this->fields_options = array(
|
||||
@@ -372,6 +378,11 @@ class AdminImagesControllerCore extends AdminController
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public static function printEntityActiveIcon($value, $object)
|
||||
{
|
||||
return ($value ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />');
|
||||
}
|
||||
|
||||
protected function _childValidation()
|
||||
{
|
||||
if (!Tools::getValue('id_image_type') && Validate::isImageTypeName($typeName = Tools::getValue('name')) && ImageType::typeAlreadyExists($typeName))
|
||||
|
||||
@@ -270,7 +270,7 @@ class AdminImportControllerCore extends AdminController
|
||||
'no' => array('label' => $this->l('Ignore this column')),
|
||||
'id' => array('label' => $this->l('ID')),
|
||||
'active' => array('label' => $this->l('Active (0/1)')),
|
||||
'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 0)')),
|
||||
'id_gender' => array('label' => $this->l('Titles ID (Mr = 1, Ms = 2, else 0)')),
|
||||
'email' => array('label' => $this->l('E-mail *')),
|
||||
'passwd' => array('label' => $this->l('Password *')),
|
||||
'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')),
|
||||
@@ -298,6 +298,7 @@ class AdminImportControllerCore extends AdminController
|
||||
'address1',
|
||||
'postcode',
|
||||
'country',
|
||||
'customer_email',
|
||||
'city'
|
||||
);
|
||||
|
||||
@@ -307,6 +308,7 @@ class AdminImportControllerCore extends AdminController
|
||||
'alias' => array('label' => $this->l('Alias *')),
|
||||
'active' => array('label' => $this->l('Active (0/1)')),
|
||||
'customer_email' => array('label' => $this->l('Customer e-mail')),
|
||||
'id_customer' => array('label' => $this->l('Customer ID')),
|
||||
'manufacturer' => array('label' => $this->l('Manufacturer')),
|
||||
'supplier' => array('label' => $this->l('Supplier')),
|
||||
'company' => array('label' => $this->l('Company')),
|
||||
@@ -472,6 +474,7 @@ class AdminImportControllerCore extends AdminController
|
||||
'languages' => Language::getLanguages(false),
|
||||
'id_language' => $this->context->language->id,
|
||||
'available_fields' => $this->getAvailableFields(),
|
||||
'truncateAuthorized' => (Shop::isFeatureActive() && $this->context->employee->isSuperAdmin()) || !Shop::isFeatureActive(),
|
||||
'PS_ADVANCED_STOCK_MANAGEMENT' => Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'),
|
||||
);
|
||||
|
||||
@@ -502,6 +505,7 @@ class AdminImportControllerCore extends AdminController
|
||||
'entity' => (int)Tools::getValue('entity'),
|
||||
'iso_lang' => Tools::getValue('iso_lang'),
|
||||
'truncate' => Tools::getValue('truncate'),
|
||||
'forceIDs' => Tools::getValue('forceIDs'),
|
||||
'match_ref' => Tools::getValue('match_ref'),
|
||||
'separator' => $this->separator,
|
||||
'multiple_value_separator' => $this->multiple_value_separator
|
||||
@@ -726,7 +730,7 @@ class AdminImportControllerCore extends AdminController
|
||||
foreach (self::$column_mask as $type => $nb)
|
||||
$res[$type] = isset($row[$nb]) ? $row[$nb] : null;
|
||||
|
||||
if (Tools::getValue('truncate')) //if you choose to truncate table before import the column id is remove from the CSV file.
|
||||
if (Tools::getValue('forceIds')) // if you choose to force table before import the column id is remove from the CSV file.
|
||||
unset($res['id']);
|
||||
|
||||
return $res;
|
||||
@@ -848,7 +852,17 @@ class AdminImportControllerCore extends AdminController
|
||||
continue;
|
||||
}
|
||||
AdminImportController::setDefaultValues($info);
|
||||
$category = new Category();
|
||||
|
||||
if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id'])
|
||||
$category = new Category((int)$info['id']);
|
||||
else
|
||||
{
|
||||
if (isset($info['id']) && (int)$info['id'] && Category::existsInDatabase((int)$info['id'], 'category'))
|
||||
$category = new Category((int)$info['id']);
|
||||
else
|
||||
$category = new Category();
|
||||
}
|
||||
|
||||
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $category);
|
||||
|
||||
if (isset($category->parent) && is_numeric($category->parent))
|
||||
@@ -861,7 +875,10 @@ class AdminImportControllerCore extends AdminController
|
||||
{
|
||||
$category_parent = Category::searchByName($default_language_id, $category->parent, true);
|
||||
if ($category_parent['id_category'])
|
||||
{
|
||||
$category->id_parent = (int)$category_parent['id_category'];
|
||||
$category->level_depth = (int)$category_parent['level_depth'] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$category_to_create = new Category();
|
||||
@@ -963,13 +980,21 @@ class AdminImportControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
// Associate category to shop
|
||||
if (Shop::isFeatureActive() && $info['shop'])
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'category_shop
|
||||
WHERE id_category = '.(int)$category->id
|
||||
);
|
||||
|
||||
if (!Shop::isFeatureActive())
|
||||
$info['shop'] = 1;
|
||||
elseif (!isset($info['shop']) || empty($info['shop']))
|
||||
$info['shop'] = implode($this->multiple_value_separator, Shop::getContextListShopID());
|
||||
|
||||
// Get shops for each attributes
|
||||
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
|
||||
|
||||
foreach ($info['shop'] as $shop)
|
||||
if (!is_numeric($shop))
|
||||
$category->addShop(Shop::getIdByName($shop));
|
||||
@@ -996,16 +1021,24 @@ class AdminImportControllerCore extends AdminController
|
||||
if (Tools::getValue('convert'))
|
||||
$line = $this->utf8EncodeArray($line);
|
||||
$info = AdminImportController::getMaskedRow($line);
|
||||
|
||||
if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id'])
|
||||
$product = new Product((int)$info['id']);
|
||||
else
|
||||
{
|
||||
if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product'))
|
||||
$product = new Product((int)$info['id']);
|
||||
else
|
||||
$product = new Product();
|
||||
}
|
||||
|
||||
if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product'))
|
||||
{
|
||||
$product = new Product((int)$info['id']);
|
||||
$product->loadStockData();
|
||||
$category_data = Product::getProductCategories((int)$product->id);
|
||||
foreach ($category_data as $tmp)
|
||||
$product->category[] = $tmp;
|
||||
}
|
||||
else
|
||||
$product = new Product();
|
||||
|
||||
AdminImportController::setEntityDefaultValues($product);
|
||||
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $product);
|
||||
@@ -1362,6 +1395,8 @@ class AdminImportControllerCore extends AdminController
|
||||
$error = false;
|
||||
if (!empty($url))
|
||||
{
|
||||
$url = str_replace(' ', '%20', $url);
|
||||
|
||||
$image = new Image();
|
||||
$image->id_product = (int)$product->id;
|
||||
$image->position = Image::getHighestPosition($product->id) + 1;
|
||||
@@ -1455,10 +1490,13 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
AdminImportController::setDefaultValues($info);
|
||||
|
||||
if (!Shop::isFeatureActive())
|
||||
$info['shop'] = 1;
|
||||
elseif (!isset($info['shop']) || empty($info['shop']))
|
||||
$info['shop'] = implode($this->multiple_value_separator, Shop::getContextListShopID());
|
||||
|
||||
// Get shops for each attributes
|
||||
$info['shop'] = explode($this->multiple_value_separator, $info['shop']);
|
||||
if (!isset($info['shop']) || !count($info['shop']))
|
||||
$info['shop'] = Shop::getContextListShopID();
|
||||
|
||||
$id_shop_list = array();
|
||||
foreach ($info['shop'] as $shop)
|
||||
@@ -1621,6 +1659,11 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
$info['minimal_quantity'] = isset($info['minimal_quantity']) && $info['minimal_quantity'] ? (int)$info['minimal_quantity'] : 1;
|
||||
|
||||
$info['wholesale_price'] = str_replace(',', '.', $info['wholesale_price']);
|
||||
$info['price'] = str_replace(',', '.', $info['price']);
|
||||
$info['ecotax'] = str_replace(',', '.', $info['ecotax']);
|
||||
$info['weight'] = str_replace(',', '.', $info['weight']);
|
||||
|
||||
// if a reference is specified for this product, get the associate id_product_attribute to UPDATE
|
||||
if (isset($info['reference']) && !empty($info['reference']))
|
||||
{
|
||||
@@ -1948,7 +1991,35 @@ class AdminImportControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[] = sprintf(Tools::displayError('"%s": Is not a valid e-mail address'), $address->customer_email);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
elseif (isset($address->id_customer) && !empty($address->id_customer))
|
||||
{
|
||||
if (Customer::customerIdExistsStatic((int)$address->id_customer))
|
||||
{
|
||||
$customer = new Customer((int)$address->id_customer);
|
||||
|
||||
// a customer could exists in different shop
|
||||
$customer_list = Customer::getCustomersByEmail($customer->email);
|
||||
|
||||
if (count($customer_list) == 0)
|
||||
$this->errors[] = sprintf(
|
||||
Tools::displayError('%1$s does not exist in database %2$s (ID: %3$s) cannot be saved'),
|
||||
Db::getInstance()->getMsgError(),
|
||||
$customer->email,
|
||||
(int)$address->customer_id
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->errors[] = sprintf(Tools::displayError('The customer ID n.%d does not exist in database (ID: %d) cannot be saved'), $address->customer_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$customer_list = array();
|
||||
$address->id_customer = 0;
|
||||
}
|
||||
|
||||
if (isset($address->manufacturer) && is_numeric($address->manufacturer) && Manufacturer::manufacturerExists((int)$address->manufacturer))
|
||||
@@ -1997,7 +2068,7 @@ class AdminImportControllerCore extends AdminController
|
||||
if (($field_error = $address->validateFields(UNFRIENDLY_ERROR, true)) === true &&
|
||||
($lang_field_error = $address->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true)
|
||||
{
|
||||
if (count($customer_list) > 0)
|
||||
if (isset($customer_list) && count($customer_list) > 0)
|
||||
{
|
||||
$filter_list = array();
|
||||
foreach ($customer_list as $customer)
|
||||
@@ -2034,7 +2105,7 @@ class AdminImportControllerCore extends AdminController
|
||||
$info['alias'],
|
||||
(isset($info['id']) ? $info['id'] : 'null')
|
||||
);
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').($lang_field_error !== true ? $lang_field_error : '').
|
||||
$this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : '').
|
||||
Db::getInstance()->getMsgError();
|
||||
}
|
||||
}
|
||||
@@ -2054,10 +2125,16 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
AdminImportController::setDefaultValues($info);
|
||||
|
||||
if (array_key_exists('id', $info) && (int)$info['id'] && Manufacturer::existsInDatabase((int)$info['id'], 'manufacturer'))
|
||||
if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id'])
|
||||
$manufacturer = new Manufacturer((int)$info['id']);
|
||||
else
|
||||
$manufacturer = new Manufacturer();
|
||||
{
|
||||
if (array_key_exists('id', $info) && (int)$info['id'] && Manufacturer::existsInDatabase((int)$info['id'], 'manufacturer'))
|
||||
$manufacturer = new Manufacturer((int)$info['id']);
|
||||
else
|
||||
$manufacturer = new Manufacturer();
|
||||
}
|
||||
|
||||
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $manufacturer);
|
||||
|
||||
$res = false;
|
||||
@@ -2119,10 +2196,16 @@ class AdminImportControllerCore extends AdminController
|
||||
|
||||
AdminImportController::setDefaultValues($info);
|
||||
|
||||
if (array_key_exists('id', $info) && (int)$info['id'] && Supplier::existsInDatabase((int)$info['id'], 'supplier'))
|
||||
if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id'])
|
||||
$supplier = new Supplier((int)$info['id']);
|
||||
else
|
||||
$supplier = new Supplier();
|
||||
{
|
||||
if (array_key_exists('id', $info) && (int)$info['id'] && Supplier::existsInDatabase((int)$info['id'], 'supplier'))
|
||||
$supplier = new Supplier((int)$info['id']);
|
||||
else
|
||||
$supplier = new Supplier();
|
||||
}
|
||||
|
||||
|
||||
AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $supplier);
|
||||
if (($field_error = $supplier->validateFields(UNFRIENDLY_ERROR, true)) === true &&
|
||||
@@ -2585,7 +2668,8 @@ class AdminImportControllerCore extends AdminController
|
||||
// Check if the CSV file exist
|
||||
if (Tools::getValue('csv'))
|
||||
{
|
||||
if (Tools::getValue('truncate'))
|
||||
// If i am a superadmin, i can truncate table
|
||||
if (((Shop::isFeatureActive() && $this->context->employee->isSuperAdmin()) || !Shop::isFeatureActive()) && Tools::getValue('truncate'))
|
||||
$this->truncateTables((int)Tools::getValue('entity'));
|
||||
|
||||
switch ((int)Tools::getValue('entity'))
|
||||
|
||||
@@ -174,6 +174,10 @@ class AdminLocalizationControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the module list cache if the default country changed
|
||||
if (Tools::isSubmit('submitOptionsconfiguration') && file_exists(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST))
|
||||
@unlink(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ class AdminLoginControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_ADMIN_DIR_.'/../install') || file_exists(_PS_ADMIN_DIR_.'/../admin')
|
||||
|| (file_exists(_PS_ADMIN_DIR_.'/../install-dev') && (!defined('_PS_MODE_DEV_') || !_PS_MODE_DEV_)))
|
||||
if (file_exists(_PS_ADMIN_DIR_.'/../install') || file_exists(_PS_ADMIN_DIR_.'/../admin'))
|
||||
$this->context->smarty->assign(array(
|
||||
'randomNb' => rand(100, 999),
|
||||
'wrong_folder_name' => true
|
||||
@@ -186,8 +185,9 @@ class AdminLoginControllerCore extends AdminController
|
||||
|
||||
public function processForgot()
|
||||
{
|
||||
$email = trim(Tools::getValue('email_forgot'));
|
||||
if (empty($email))
|
||||
if (_PS_MODE_DEMO_)
|
||||
$this->errors[] = Tools::displayError('This functionality has been disabled.');
|
||||
elseif (!($email = trim(Tools::getValue('email_forgot'))))
|
||||
$this->errors[] = Tools::displayError('E-mail is empty');
|
||||
elseif (!Validate::isEmail($email))
|
||||
$this->errors[] = Tools::displayError('Invalid e-mail address');
|
||||
@@ -202,8 +202,6 @@ class AdminLoginControllerCore extends AdminController
|
||||
Configuration::get('PS_PASSWD_TIME_BACK')
|
||||
);
|
||||
}
|
||||
if (_PS_MODE_DEMO_)
|
||||
$this->errors[] = Tools::displayError('This functionality has been disabled.');
|
||||
|
||||
if (!count($this->errors))
|
||||
{
|
||||
|
||||
@@ -574,6 +574,7 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
for ($i = 0; $i < $total_product; $i++)
|
||||
{
|
||||
$products[$i] = new Product($products[$i]['id_product'], false, $this->context->language->id);
|
||||
$products[$i]->loadStockData();
|
||||
/* Build attributes combinations */
|
||||
$combinations = $products[$i]->getAttributeCombinations($this->context->language->id);
|
||||
foreach ($combinations as $k => $combination)
|
||||
|
||||
@@ -41,6 +41,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
$this->sm_file = _PS_ROOT_DIR_.'/sitemap.xml';
|
||||
$this->rb_data = $this->getRobotsContent();
|
||||
|
||||
$this->explicitSelect = true;
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
@@ -293,7 +294,7 @@ class AdminMetaControllerCore extends AdminController
|
||||
'name' => 'url_rewrite',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}',
|
||||
'hint' => $this->l('Only letters and the minus (-) character are allowed'),
|
||||
'desc' => $this->l('e.g. "contacts" for http://mysite.com/shop/contacts to redirect to http://mysite.com/shop/contact-form.php'),
|
||||
'size' => 50
|
||||
),
|
||||
@@ -454,6 +455,10 @@ class AdminMetaControllerCore extends AdminController
|
||||
{
|
||||
Configuration::updateValue('PS_REWRITING_SETTINGS', (int)Tools::getValue('PS_REWRITING_SETTINGS'));
|
||||
Tools::generateHtaccess($this->ht_file, null, null, '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'));
|
||||
|
||||
Tools::enableCache();
|
||||
Tools::clearCache($this->context->smarty);
|
||||
Tools::restoreCacheSettings();
|
||||
}
|
||||
|
||||
public function updateOptionPsRouteProductRule()
|
||||
|
||||
@@ -222,7 +222,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, '');
|
||||
|
||||
$this->initContent();
|
||||
$this->context->smarty->display('controllers/modules/list.tpl');
|
||||
$this->smartyOutputContent('controllers/modules/list.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
{
|
||||
foreach ($modules as $k => $module)
|
||||
{
|
||||
// Check add permissions, if add permissions not set, addons modules and non installed modules will not be displayed
|
||||
// Check add permissions, if add permissions not set, addons modules and uninstalled modules will not be displayed
|
||||
if ($this->tabAccess['add'] !== '1' && isset($module->type) && ($module->type != 'addonsNative' || $module->type != 'addonsBought'))
|
||||
unset($modules[$k]);
|
||||
else if ($this->tabAccess['add'] !== '1' && (!isset($module->id) || $module->id < 1))
|
||||
@@ -1001,16 +1001,21 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
// Module can't be upgraded if not file exist but can change the database version...
|
||||
// User has to be prevented
|
||||
else if (Module::getUpgradeStatus($module->name))
|
||||
elseif (Module::getUpgradeStatus($module->name))
|
||||
{
|
||||
// When the XML cache file is up-to-date, the module may not be loaded yet
|
||||
if (!class_exists($module->name))
|
||||
require_once(_PS_MODULE_DIR_.$module->name.'/'.$module->name.'.php');
|
||||
$object = new $module->name();
|
||||
$module_success[] = array('name' => $module->name, 'message' => array(
|
||||
0 => $this->l('Current version:').$object->version,
|
||||
1 => $this->l('No file upgrades applied (none exist)'))
|
||||
);
|
||||
if (file_exists(_PS_MODULE_DIR_.$module->name.'/'.$module->name.'.php'))
|
||||
{
|
||||
require_once(_PS_MODULE_DIR_.$module->name.'/'.$module->name.'.php');
|
||||
$object = new $module->name();
|
||||
$module_success[] = array('name' => $module->name, 'message' => array(
|
||||
0 => $this->l('Current version:').$object->version,
|
||||
1 => $this->l('No file upgrades applied (none exist)'))
|
||||
);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
unset($object);
|
||||
}
|
||||
|
||||
@@ -1018,8 +1023,8 @@ class AdminModulesControllerCore extends AdminController
|
||||
$this->makeModulesStats($module);
|
||||
|
||||
// Assign warnings
|
||||
if (isset($module->warning) && !empty($module->warning))
|
||||
$this->warnings[] = $module->displayName.$this->l(':').$module->warning;
|
||||
if ($module->active && isset($module->warning) && !empty($module->warning))
|
||||
$this->warnings[] = sprintf($this->l('%1$s: %2$s'), $module->displayName, $module->warning);
|
||||
|
||||
// AutoComplete array
|
||||
$autocompleteList .= Tools::jsonEncode(array(
|
||||
|
||||
@@ -85,14 +85,16 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
$exceptions = (isset($exceptions[0])) ? $exceptions[0] : array();
|
||||
$exceptions = explode(',', str_replace(' ', '', $exceptions));
|
||||
|
||||
foreach ($exceptions as $except)
|
||||
if (!Validate::isFileName($except))
|
||||
foreach ($exceptions as $key => $except)
|
||||
{
|
||||
if (empty($except))
|
||||
unset($exceptions[$key]);
|
||||
else if (!Validate::isFileName($except))
|
||||
$this->errors[] = Tools::displayError('No valid value for field exceptions');
|
||||
|
||||
}
|
||||
if (!$this->errors && !$module->registerExceptions($id_hook, $exceptions, Shop::getContextListShopID()))
|
||||
$this->errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
|
||||
}
|
||||
|
||||
if (!$this->errors)
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->className = 'Order';
|
||||
$this->lang = false;
|
||||
$this->addRowAction('view');
|
||||
$this->explicitSelect = true;
|
||||
|
||||
$this->deleted = false;
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->_select = '
|
||||
a.id_currency,
|
||||
a.id_order AS id_pdf,
|
||||
CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
|
||||
osl.`name` AS `osname`,
|
||||
@@ -48,10 +50,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';
|
||||
$this->_where = 'AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)';
|
||||
$this->_orderBy = 'id_order';
|
||||
$this->_orderWay = 'DESC';
|
||||
|
||||
@@ -77,7 +77,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'width' => 25,
|
||||
'align' => 'center',
|
||||
'type' => 'bool',
|
||||
'filter_key' => 'new',
|
||||
'tmpTableFilter' => true,
|
||||
'icon' => array(
|
||||
0 => 'blank.gif',
|
||||
@@ -90,7 +89,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
),
|
||||
'customer' => array(
|
||||
'title' => $this->l('Customer'),
|
||||
'filter_key' => 'customer',
|
||||
'tmpTableFilter' => true
|
||||
),
|
||||
'total_paid_tax_incl' => array(
|
||||
@@ -192,14 +190,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if ($this->display == 'view')
|
||||
{
|
||||
$order = new Order((int)Tools::getValue('id_order'));
|
||||
if ($order->hasBeenDelivered())
|
||||
if ($order->hasBeenShipped())
|
||||
$type = $this->l('Return products');
|
||||
elseif ($order->hasBeenPaid())
|
||||
$type = $this->l('Standard refund');
|
||||
else
|
||||
$type = $this->l('Cancel products');
|
||||
|
||||
if (!$order->hasBeenDelivered())
|
||||
if (!$order->hasBeenShipped() && !$this->lite_display)
|
||||
$this->toolbar_btn['new'] = array(
|
||||
'short' => 'Create',
|
||||
'href' => '#',
|
||||
@@ -207,7 +205,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'class' => 'add_product'
|
||||
);
|
||||
|
||||
if (Configuration::get('PS_ORDER_RETURN'))
|
||||
if (Configuration::get('PS_ORDER_RETURN') && !$this->lite_display)
|
||||
$this->toolbar_btn['standard_refund'] = array(
|
||||
'short' => 'Create',
|
||||
'href' => '',
|
||||
@@ -215,7 +213,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'class' => 'process-icon-standardRefund'
|
||||
);
|
||||
|
||||
if ($order->hasInvoice())
|
||||
if ($order->hasInvoice() && !$this->lite_display)
|
||||
$this->toolbar_btn['partial_refund'] = array(
|
||||
'short' => 'Create',
|
||||
'href' => '',
|
||||
@@ -474,9 +472,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_detail_list[$id_order_detail]['amount'] = $order_detail->unit_price_tax_incl * $order_detail_list[$id_order_detail]['quantity'];
|
||||
}
|
||||
else
|
||||
$order_detail_list[$id_order_detail]['amount'] = (float)$amount_detail;
|
||||
|
||||
$order_detail_list[$id_order_detail]['amount'] = (float)str_replace(',', '.', $amount_detail);
|
||||
$amount += $order_detail_list[$id_order_detail]['amount'];
|
||||
|
||||
$order_detail = new OrderDetail((int)$id_order_detail);
|
||||
if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Tools::isSubmit('reinjectQuantities')) && $order_detail_list[$id_order_detail]['quantity'] > 0)
|
||||
$this->reinjectQuantity($order_detail, $order_detail_list[$id_order_detail]['quantity']);
|
||||
}
|
||||
|
||||
$shipping_cost_amount = (float)str_replace(',', '.', Tools::getValue('partialRefundShippingCost'));
|
||||
@@ -529,6 +530,11 @@ class AdminOrdersControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$currency = $this->context->currency;
|
||||
$customer = new Customer((int)($order->id_customer));
|
||||
$params['{lastname}'] = $customer->lastname;
|
||||
$params['{firstname}'] = $customer->firstname;
|
||||
$params['{id_order}'] = $order->id;
|
||||
$params['{order_name}'] = $order->getUniqReference();
|
||||
$params['{voucher_amount}'] = Tools::displayPrice($cart_rule->reduction_amount, $currency, false);
|
||||
$params['{voucher_num}'] = $cart_rule->code;
|
||||
$customer = new Customer((int)$order->id_customer);
|
||||
@@ -636,58 +642,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$qty_cancel_product = abs($qtyList[$key]);
|
||||
$order_detail = new OrderDetail((int)($id_order_detail));
|
||||
|
||||
// Reinject product
|
||||
if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Tools::isSubmit('reinjectQuantities')))
|
||||
{
|
||||
$reinjectable_quantity = (int)$order_detail->product_quantity - (int)$order_detail->product_quantity_reinjected;
|
||||
$quantity_to_reinject = $qty_cancel_product > $reinjectable_quantity ? $reinjectable_quantity : $qty_cancel_product;
|
||||
|
||||
// @since 1.5.0 : Advanced Stock Management
|
||||
$product_to_inject = new Product($order_detail->product_id, false, $this->context->language->id, $order->id_shop);
|
||||
|
||||
$product = new Product($order_detail->product_id);
|
||||
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||
&& $product->advanced_stock_management
|
||||
&& $order_detail->id_warehouse != 0)
|
||||
{
|
||||
|
||||
$manager = StockManagerFactory::getManager();
|
||||
|
||||
$movements = StockMvt::getNegativeStockMvts(
|
||||
$order_detail->id_order,
|
||||
$order_detail->product_id,
|
||||
$order_detail->product_attribute_id,
|
||||
$quantity_to_reinject
|
||||
);
|
||||
|
||||
foreach ($movements as $movement)
|
||||
{
|
||||
$manager->addProduct(
|
||||
$order_detail->product_id,
|
||||
$order_detail->product_attribute_id,
|
||||
new Warehouse($movement['id_warehouse']),
|
||||
$movement['physical_quantity'],
|
||||
null,
|
||||
$movement['price_te'],
|
||||
true
|
||||
);
|
||||
}
|
||||
StockAvailable::synchronize($order_detail->product_id);
|
||||
}
|
||||
else if ($order_detail->id_warehouse == 0)
|
||||
{
|
||||
StockAvailable::updateQuantity(
|
||||
$order_detail->product_id,
|
||||
$order_detail->product_attribute_id,
|
||||
$quantity_to_reinject,
|
||||
$order->id_shop
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('Cannot re-stock product');
|
||||
}
|
||||
|
||||
if (!$order->hasBeenDelivered() || ($order->hasBeenDelivered() && Tools::isSubmit('reinjectQuantities')) && $qty_cancel_product > 0)
|
||||
$this->reinjectQuantity($order_detail, $qty_cancel_product);
|
||||
|
||||
// Delete product
|
||||
$order_detail = new OrderDetail((int)$id_order_detail);
|
||||
if (!$order->deleteProduct($order, $order_detail, $qtyCancelProduct))
|
||||
@@ -929,24 +886,25 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'ecotax',
|
||||
'product_price',
|
||||
'reduction_amount',
|
||||
'total_shipping',
|
||||
'total_shipping_tax_excl',
|
||||
'total_shipping_tax_incl',
|
||||
'total_products',
|
||||
'total_products_wt',
|
||||
'total_paid',
|
||||
'total_paid_tax_incl',
|
||||
'total_paid_tax_excl',
|
||||
'total_paid_real',
|
||||
'total_shipping_price_tax_excl',
|
||||
'total_shipping_price_tax_incl',
|
||||
'total_price_tax_incl',
|
||||
'total_price_tax_excl',
|
||||
'product_quantity_discount',
|
||||
'purchase_supplier_price',
|
||||
'reduction_amount',
|
||||
'reduction_amount_tax_incl',
|
||||
'reduction_amount_tax_excl'
|
||||
'reduction_amount_tax_excl',
|
||||
'unit_price_tax_incl',
|
||||
'unit_price_tax_excl',
|
||||
'original_product_price'
|
||||
|
||||
);
|
||||
foreach ($fields as $field)
|
||||
$order_detail->{$field} = Tools::convertPriceFull($order_detail->{$field}, $old_currency, $currency);
|
||||
|
||||
$order_detail->update();
|
||||
$order_detail->updateTaxAmount($order);
|
||||
}
|
||||
|
||||
$id_order_carrier = Db::getInstance()->getValue('
|
||||
@@ -961,11 +919,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_carrier->update();
|
||||
}
|
||||
|
||||
// Update order amount
|
||||
// Update order && order_invoice amount
|
||||
$fields = array(
|
||||
'total_discounts',
|
||||
'total_discounts_tax_incl',
|
||||
'total_discounts_tax_excl',
|
||||
'total_discount_tax_excl',
|
||||
'total_discount_tax_incl',
|
||||
'total_paid',
|
||||
'total_paid_tax_incl',
|
||||
'total_paid_tax_excl',
|
||||
@@ -979,12 +939,25 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'total_wrapping_tax_incl',
|
||||
'total_wrapping_tax_excl',
|
||||
);
|
||||
|
||||
$invoices = $order->getInvoicesCollection();
|
||||
if ($invoices)
|
||||
foreach ($invoices as $invoice)
|
||||
{
|
||||
foreach ($fields as $field)
|
||||
if (isset($invoice->$field))
|
||||
$invoice->{$field} = Tools::convertPriceFull($invoice->{$field}, $old_currency, $currency);
|
||||
$invoice->save();
|
||||
}
|
||||
|
||||
foreach ($fields as $field)
|
||||
$order->{$field} = Tools::convertPriceFull($order->{$field}, $old_currency, $currency);
|
||||
if (isset($order->$field))
|
||||
$order->{$field} = Tools::convertPriceFull($order->{$field}, $old_currency, $currency);
|
||||
|
||||
// Update currency in order
|
||||
$order->id_currency = $currency->id;
|
||||
|
||||
// Update conversion rate
|
||||
$order->conversion_rate = (float)$currency->conversion_rate;
|
||||
$order->update();
|
||||
}
|
||||
else
|
||||
@@ -1254,7 +1227,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$customer = new Customer($order->id_customer);
|
||||
$carrier = new Carrier($order->id_carrier);
|
||||
$products = $this->getProducts($order);
|
||||
|
||||
$currency = new Currency((int)$order->id_currency);
|
||||
// Carrier module call
|
||||
$carrier_module_call = null;
|
||||
if ($carrier->is_module)
|
||||
@@ -1326,7 +1299,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
|
||||
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
|
||||
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
|
||||
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
|
||||
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
|
||||
$product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
|
||||
$product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
|
||||
|
||||
@@ -1394,7 +1367,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
public function ajaxProcessSearchProducts()
|
||||
{
|
||||
Context::getContext()->customer = new Customer((int)Tools::getValue('id_customer'));
|
||||
$currency = new Currency(Tools::getValue('id_currency'));
|
||||
$currency = new Currency((int)Tools::getValue('id_currency'));
|
||||
if ($products = Product::searchByName((int)$this->context->language->id, pSQL(Tools::getValue('product_search'))))
|
||||
{
|
||||
foreach ($products as &$product)
|
||||
@@ -1556,13 +1529,14 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->context->cart = $cart;
|
||||
$this->context->customer = new Customer($order->id_customer);
|
||||
|
||||
$use_taxes = ($order->getTaxCalculationMethod() == PS_TAX_INC);
|
||||
// always add taxes even if there are not displayed to the customer
|
||||
$use_taxes = true;
|
||||
|
||||
$initial_prodcut_price_tax_incl = Product::getPriceStatic($product->id, $use_taxes, isset($combination) ? $combination->id : null, 2, null, false, true, 1,
|
||||
$initial_product_price_tax_incl = Product::getPriceStatic($product->id, $use_taxes, isset($combination) ? $combination->id : null, 2, null, false, true, 1,
|
||||
false, $order->id_customer, $cart->id, $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
// Creating specific price if needed
|
||||
if ($product_informations['product_price_tax_incl'] != $initial_prodcut_price_tax_incl)
|
||||
if ($product_informations['product_price_tax_incl'] != $initial_product_price_tax_incl)
|
||||
{
|
||||
$specific_price = new SpecificPrice();
|
||||
$specific_price->id_shop = 0;
|
||||
@@ -1640,7 +1614,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
else
|
||||
$order_invoice->number = Order::getLastInvoiceNumber() + 1;
|
||||
|
||||
$invoice_address = new Address((int)$order->id_address_invoice);
|
||||
$invoice_address = new Address((int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$carrier = new Carrier((int)$order->id_carrier);
|
||||
$tax_calculator = $carrier->getTaxCalculator($invoice_address);
|
||||
|
||||
@@ -1683,10 +1657,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_invoice->total_paid_tax_incl += Tools::ps_round((float)($cart->getOrderTotal($use_taxes, $total_method)), 2);
|
||||
$order_invoice->total_products += (float)$cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);
|
||||
$order_invoice->total_products_wt += (float)$cart->getOrderTotal($use_taxes, Cart::ONLY_PRODUCTS);
|
||||
$order_invoice->total_shipping_tax_excl += (float)$cart->getTotalShippingCost(null, false);
|
||||
$order_invoice->total_shipping_tax_incl += (float)$cart->getTotalShippingCost(null, $use_taxes);
|
||||
$order_invoice->total_wrapping_tax_excl += abs($cart->getOrderTotal(false, Cart::ONLY_WRAPPING));
|
||||
$order_invoice->total_wrapping_tax_incl += abs($cart->getOrderTotal($use_taxes, Cart::ONLY_WRAPPING));
|
||||
$order_invoice->update();
|
||||
}
|
||||
}
|
||||
@@ -1702,7 +1672,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order->total_paid += Tools::ps_round((float)($cart->getOrderTotal(true, $total_method)), 2);
|
||||
$order->total_paid_tax_excl += Tools::ps_round((float)($cart->getOrderTotal(false, $total_method)), 2);
|
||||
$order->total_paid_tax_incl += Tools::ps_round((float)($cart->getOrderTotal($use_taxes, $total_method)), 2);
|
||||
|
||||
|
||||
if (isset($order_invoice) && Validate::isLoadedObject($order_invoice))
|
||||
{
|
||||
$order->total_shipping = $order_invoice->total_shipping_tax_incl;
|
||||
$order->total_shipping_tax_incl = $order_invoice->total_shipping_tax_incl;
|
||||
$order->total_shipping_tax_excl = $order_invoice->total_shipping_tax_excl;
|
||||
}
|
||||
// discount
|
||||
$order->total_discounts += (float)abs($cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
|
||||
$order->total_discounts_tax_excl += (float)abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS));
|
||||
@@ -1711,6 +1687,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// Save changes of order
|
||||
$order->update();
|
||||
|
||||
// Update Tax lines
|
||||
$order_detail->updateTaxAmount($order);
|
||||
|
||||
// Delete specific price if exists
|
||||
if (isset($specific_price))
|
||||
$specific_price->delete();
|
||||
@@ -1819,10 +1798,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// Return value
|
||||
$res = true;
|
||||
|
||||
$order = new Order(Tools::getValue('id_order'));
|
||||
$order_detail = new OrderDetail(Tools::getValue('product_id_order_detail'));
|
||||
$order = new Order((int)Tools::getValue('id_order'));
|
||||
$order_detail = new OrderDetail((int)Tools::getValue('product_id_order_detail'));
|
||||
if (Tools::isSubmit('product_invoice'))
|
||||
$order_invoice = new OrderInvoice(Tools::getValue('product_invoice'));
|
||||
$order_invoice = new OrderInvoice((int)Tools::getValue('product_invoice'));
|
||||
|
||||
// Check fields validity
|
||||
$this->doEditProductValidation($order_detail, $order, isset($order_invoice) ? $order_invoice : null);
|
||||
@@ -1906,6 +1885,10 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$old_quantity = $order_detail->product_quantity;
|
||||
|
||||
$order_detail->product_quantity = $product_quantity;
|
||||
|
||||
// update taxes
|
||||
$res &= $order_detail->updateTaxAmount($order);
|
||||
|
||||
// Save order detail
|
||||
$res &= $order_detail->update();
|
||||
// Save order invoice
|
||||
@@ -2152,6 +2135,53 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
return $products;
|
||||
}
|
||||
|
||||
protected function reinjectQuantity($order_detail, $qty_cancel_product)
|
||||
{
|
||||
// Reinject product
|
||||
$reinjectable_quantity = (int)$order_detail->product_quantity - (int)$order_detail->product_quantity_reinjected;
|
||||
$quantity_to_reinject = $qty_cancel_product > $reinjectable_quantity ? $reinjectable_quantity : $qty_cancel_product;
|
||||
// @since 1.5.0 : Advanced Stock Management
|
||||
$product_to_inject = new Product($order_detail->product_id, false, (int)$this->context->language->id, (int)$order_detail->id_shop);
|
||||
|
||||
$product = new Product($order_detail->product_id, false, (int)$this->context->language->id, (int)$order_detail->id_shop);
|
||||
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $product->advanced_stock_management && $order_detail->id_warehouse != 0)
|
||||
{
|
||||
$manager = StockManagerFactory::getManager();
|
||||
$movements = StockMvt::getNegativeStockMvts(
|
||||
$order_detail->id_order,
|
||||
$order_detail->product_id,
|
||||
$order_detail->product_attribute_id,
|
||||
$quantity_to_reinject
|
||||
);
|
||||
|
||||
foreach ($movements as $movement)
|
||||
{
|
||||
$manager->addProduct(
|
||||
$order_detail->product_id,
|
||||
$order_detail->product_attribute_id,
|
||||
new Warehouse($movement['id_warehouse']),
|
||||
$movement['physical_quantity'],
|
||||
null,
|
||||
$movement['price_te'],
|
||||
true
|
||||
);
|
||||
}
|
||||
StockAvailable::synchronize($order_detail->product_id);
|
||||
}
|
||||
elseif ($order_detail->id_warehouse == 0)
|
||||
{
|
||||
StockAvailable::updateQuantity(
|
||||
$order_detail->product_id,
|
||||
$order_detail->product_attribute_id,
|
||||
$quantity_to_reinject,
|
||||
$order_detail->id_shop
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('Cannot re-stock product');
|
||||
}
|
||||
|
||||
protected function applyDiscountOnInvoice($order_invoice, $value_tax_incl, $value_tax_excl)
|
||||
{
|
||||
|
||||
@@ -47,8 +47,8 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_COMPARATOR_MAX_ITEM' => array(
|
||||
'title' => $this->l('Set the maximum number of products that can be selected for comparison'),
|
||||
'desc' => $this->l('Set the threshold at which a message will announce the product is close to being out of stock.').' '.$this->l('Set to 0 to disable this feature'),
|
||||
'title' => $this->l('Products comparison'),
|
||||
'desc' => $this->l('Set the maximum number of products that can be selected for comparison.').' '.$this->l('Set to 0 to disable this feature'),
|
||||
'validation' => 'isUnsignedId',
|
||||
'required' => true,
|
||||
'cast' => 'intval',
|
||||
|
||||
@@ -49,19 +49,19 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
array(
|
||||
'id' => 'smarty_force_compile_'._PS_SMARTY_NO_COMPILE_,
|
||||
'value' => _PS_SMARTY_NO_COMPILE_,
|
||||
'label' => $this->l('Never compile cache'),
|
||||
'label' => $this->l('Never recompile template files'),
|
||||
'desc' => $this->l('Templates are never recompiled, performance is better and this option should be used in production environment')
|
||||
),
|
||||
array(
|
||||
'id' => 'smarty_force_compile_'._PS_SMARTY_CHECK_COMPILE_,
|
||||
'value' => _PS_SMARTY_CHECK_COMPILE_,
|
||||
'label' => $this->l('Compile cache if templates are updated'),
|
||||
'label' => $this->l('Recompile templates if the files have been updated'),
|
||||
'desc' => $this->l('Templates are recompiled when they are updated, if you experience compilation troubles when you update your template files, you should use Force Compile instead of this option. It should never be used in a production environment.')
|
||||
),
|
||||
array(
|
||||
'id' => 'smarty_force_compile_'._PS_SMARTY_FORCE_COMPILE_,
|
||||
'value' => _PS_SMARTY_FORCE_COMPILE_,
|
||||
'label' => $this->l('Force Compile'),
|
||||
'label' => $this->l('Force compilation'),
|
||||
'desc' => $this->l('This forces Smarty to (re)compile templates on every invocation. This is handy for development and debugging. It should never be used in a production environment.')
|
||||
)
|
||||
)
|
||||
@@ -485,6 +485,21 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$this->tpl_form_vars['servers'] = CacheMemcache::getMemcachedServers();
|
||||
}
|
||||
|
||||
public function initFieldsetCloudCache()
|
||||
{
|
||||
if (!class_exists('CloudCache'))
|
||||
$this->fields_form[6]['form'] = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('CloudCache'),
|
||||
'image' => '../img/admin/subdomain.gif'
|
||||
),
|
||||
'desc' => $this->l('Performance matters! Improve speed and conversions the easy way.').'<br />'.
|
||||
$this->l('CloudCache supercharges your site in minutes through its state-of-the-art content delivery network.').'<br /><br />'.
|
||||
$this->l('Subscribe now using the code "presta25" and get an exclusive discount of 25% per month on every available package.').'<br /><br />
|
||||
<a style="color: blue" href="index.php?controller=AdminModules&token='.Tools::getAdminTokenLite('AdminModules').'&filtername=cloudcache" id="installCloudCache">> '.$this->l('Click here to install the CloudCache module for PrestaShop').'</a><br />'
|
||||
);
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
// Initialize fieldset for a form
|
||||
@@ -494,6 +509,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$this->initFieldsetMediaServer();
|
||||
$this->initFieldsetCiphering();
|
||||
$this->initFieldsetCaching();
|
||||
$this->initFieldsetCloudCache();
|
||||
|
||||
// Activate multiple fieldset
|
||||
$this->multiple_fieldsets = true;
|
||||
@@ -649,6 +665,7 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$base_urls['_MEDIA_SERVER_2_'] = Tools::getValue('_MEDIA_SERVER_2_');
|
||||
$base_urls['_MEDIA_SERVER_3_'] = Tools::getValue('_MEDIA_SERVER_3_');
|
||||
rewriteSettingsFile($base_urls, null, null);
|
||||
Tools::generateHtaccess(null, null, null, '', null, array($base_urls['_MEDIA_SERVER_1_'], $base_urls['_MEDIA_SERVER_2_'], $base_urls['_MEDIA_SERVER_3_']));
|
||||
unset($this->_fieldsGeneral['_MEDIA_SERVER_1_']);
|
||||
unset($this->_fieldsGeneral['_MEDIA_SERVER_2_']);
|
||||
unset($this->_fieldsGeneral['_MEDIA_SERVER_3_']);
|
||||
|
||||
@@ -60,6 +60,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->table = 'product';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->explicitSelect = true;
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
if (!Tools::getValue('id_product'))
|
||||
@@ -72,84 +73,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->max_file_size = (int)(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1000000);
|
||||
$this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
|
||||
|
||||
$this->fields_list = array();
|
||||
$this->fields_list['id_product'] = array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 20
|
||||
);
|
||||
$this->fields_list['image'] = array(
|
||||
'title' => $this->l('Photo'),
|
||||
'align' => 'center',
|
||||
'image' => 'p',
|
||||
'width' => 70,
|
||||
'orderby' => false,
|
||||
'filter' => false,
|
||||
'search' => false
|
||||
);
|
||||
$this->fields_list['name'] = array(
|
||||
'title' => $this->l('Name'),
|
||||
'filter_key' => 'b!name'
|
||||
);
|
||||
$this->fields_list['reference'] = array(
|
||||
'title' => $this->l('Reference'),
|
||||
'align' => 'left',
|
||||
'width' => 80
|
||||
);
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
$this->fields_list['shopname'] = array(
|
||||
'title' => $this->l('Default Shop'),
|
||||
'width' => 230,
|
||||
'filter_key' => 'shop!name',
|
||||
);
|
||||
else
|
||||
$this->fields_list['name_category'] = array(
|
||||
'title' => $this->l('Category'),
|
||||
'width' => 230,
|
||||
'filter_key' => 'cl!name',
|
||||
);
|
||||
$this->fields_list['price'] = array(
|
||||
'title' => $this->l('Base price'),
|
||||
'width' => 90,
|
||||
'type' => 'price',
|
||||
'align' => 'right',
|
||||
'filter_key' => 'a!price'
|
||||
);
|
||||
$this->fields_list['price_final'] = array(
|
||||
'title' => $this->l('Final price'),
|
||||
'width' => 90,
|
||||
'type' => 'price',
|
||||
'align' => 'right',
|
||||
'havingFilter' => true,
|
||||
'orderby' => false
|
||||
);
|
||||
$this->fields_list['sav_quantity'] = array(
|
||||
'title' => $this->l('Quantity'),
|
||||
'width' => 90,
|
||||
'align' => 'right',
|
||||
'filter_key' => 'sav!quantity',
|
||||
'orderby' => true,
|
||||
'hint' => $this->l('This is the quantity available in the current shop/group'),
|
||||
);
|
||||
$this->fields_list['active'] = array(
|
||||
'title' => $this->l('Displayed'),
|
||||
'width' => 70,
|
||||
'active' => 'status',
|
||||
'filter_key' => 'sa!active',
|
||||
'align' => 'center',
|
||||
'type' => 'bool',
|
||||
'orderby' => false
|
||||
);
|
||||
if ((int)Tools::getValue('id_category'))
|
||||
$this->fields_list['position'] = array(
|
||||
'title' => $this->l('Position'),
|
||||
'width' => 70,
|
||||
'filter_key' => 'cp!position',
|
||||
'align' => 'center',
|
||||
'position' => 'position'
|
||||
);
|
||||
|
||||
|
||||
// @since 1.5 : translations for tabs
|
||||
$this->available_tabs_lang = array (
|
||||
'Informations' => $this->l('Information'),
|
||||
@@ -215,36 +138,122 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($this->_category) && empty($this->_filter))
|
||||
$join_category = true;
|
||||
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` '.(!Shop::isFeatureActive() ? ' AND i.cover=1' : '').')';
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$alias = 'sa';
|
||||
$alias_image = 'image_shop';
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
{
|
||||
$this->_join .= ' JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = '.(int)$this->context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = '.(int)$this->context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.(int)$this->context->shop->id.') ';
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.(int)$this->context->shop->id.')
|
||||
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='.(int)$this->context->shop->id.')';
|
||||
$this->_where .= 'AND (i.id_image IS NULL OR image_shop.id_shop='.(int)$this->context->shop->id.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = a.id_shop_default) ';
|
||||
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = a.id_shop_default)
|
||||
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=a.id_shop_default)';
|
||||
$this->_where .= 'AND (i.id_image IS NULL OR image_shop.id_shop=a.id_shop_default)';
|
||||
}
|
||||
$this->_select .= 'shop.name as shopname, ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alias = 'a';
|
||||
$alias_image = 'i';
|
||||
$this->_join .= 'LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = 1)';
|
||||
}
|
||||
|
||||
$this->_join .= '
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
|
||||
'.($join_category ? 'INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.')' : '').'
|
||||
$this->_join .= ($join_category ? 'INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.')' : '').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON ('.$alias.'.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
|
||||
'.StockAvailable::addSqlShopRestriction(null, null, 'sav').') ';
|
||||
$this->_select .= 'cl.name `name_category` '.($join_category ? ', cp.`position`' : '').', '.$alias_image.'.`id_image`, '.$alias.'.`price`, ('.$alias.'.`price` * ((100 + (t.`rate`))/100)) AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';
|
||||
|
||||
$this->fields_list = array();
|
||||
$this->fields_list['id_product'] = array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 20
|
||||
);
|
||||
$this->fields_list['image'] = array(
|
||||
'title' => $this->l('Photo'),
|
||||
'align' => 'center',
|
||||
'image' => 'p',
|
||||
'width' => 70,
|
||||
'orderby' => false,
|
||||
'filter' => false,
|
||||
'search' => false
|
||||
);
|
||||
$this->fields_list['name'] = array(
|
||||
'title' => $this->l('Name'),
|
||||
'filter_key' => 'b!name'
|
||||
);
|
||||
$this->fields_list['reference'] = array(
|
||||
'title' => $this->l('Reference'),
|
||||
'align' => 'left',
|
||||
'width' => 80
|
||||
);
|
||||
|
||||
$this->_select .= 'cl.name `name_category` '.($join_category ? ', cp.`position`' : '').', i.`id_image`, '.$alias.'.`price`, ('.$alias.'.`price` * ((100 + (t.`rate`))/100)) AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';
|
||||
|
||||
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
|
||||
$this->fields_list['shopname'] = array(
|
||||
'title' => $this->l('Default Shop'),
|
||||
'width' => 230,
|
||||
'filter_key' => 'shop!name',
|
||||
);
|
||||
else
|
||||
$this->fields_list['name_category'] = array(
|
||||
'title' => $this->l('Category'),
|
||||
'width' => 230,
|
||||
'filter_key' => 'cl!name',
|
||||
);
|
||||
$this->fields_list['price'] = array(
|
||||
'title' => $this->l('Base price'),
|
||||
'width' => 90,
|
||||
'type' => 'price',
|
||||
'align' => 'right',
|
||||
'filter_key' => 'a!price'
|
||||
);
|
||||
$this->fields_list['price_final'] = array(
|
||||
'title' => $this->l('Final price'),
|
||||
'width' => 90,
|
||||
'type' => 'price',
|
||||
'align' => 'right',
|
||||
'havingFilter' => true,
|
||||
'orderby' => false
|
||||
);
|
||||
$this->fields_list['sav_quantity'] = array(
|
||||
'title' => $this->l('Quantity'),
|
||||
'width' => 90,
|
||||
'align' => 'right',
|
||||
'filter_key' => 'sav!quantity',
|
||||
'orderby' => true,
|
||||
'hint' => $this->l('This is the quantity available in the current shop/group'),
|
||||
);
|
||||
$this->fields_list['active'] = array(
|
||||
'title' => $this->l('Displayed'),
|
||||
'width' => 70,
|
||||
'active' => 'status',
|
||||
'filter_key' => $alias.'!active',
|
||||
'align' => 'center',
|
||||
'type' => 'bool',
|
||||
'orderby' => false
|
||||
);
|
||||
if ((int)Tools::getValue('id_category'))
|
||||
$this->fields_list['position'] = array(
|
||||
'title' => $this->l('Position'),
|
||||
'width' => 70,
|
||||
'filter_key' => 'cp!position',
|
||||
'align' => 'center',
|
||||
'position' => 'position'
|
||||
);
|
||||
}
|
||||
|
||||
protected function _cleanMetaKeywords($keywords)
|
||||
{
|
||||
if (!empty($keywords) && $keywords != '')
|
||||
@@ -285,7 +294,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
if (Tools::getIsset('unit_price') != null)
|
||||
$object->unit_price = str_replace(',', '.', Tools::getValue('unit_price'));
|
||||
if (Tools::getIsset('unit_price') != null)
|
||||
if (Tools::getIsset('ecotax') != null)
|
||||
$object->ecotax = str_replace(',', '.', Tools::getValue('ecotax'));
|
||||
$object->available_for_order = (int)Tools::getValue('available_for_order');
|
||||
$object->show_price = $object->available_for_order ? 1 : (int)Tools::getValue('show_price');
|
||||
@@ -649,7 +658,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
public function processProductAttribute()
|
||||
{
|
||||
// Don't process if the combination fields have not been submitted
|
||||
if (!Combination::isFeatureActive() || !Tools::getIsset('attribute'))
|
||||
if (!Combination::isFeatureActive() || !Tools::getValue('attribute_combination_list'))
|
||||
return;
|
||||
|
||||
if (Validate::isLoadedObject($product = $this->object))
|
||||
@@ -1398,7 +1407,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
$res &= Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'image`
|
||||
SET `cover` = 1
|
||||
WHERE `id_product` = '.(int)$image->id_product.' LIMIT 1');
|
||||
WHERE `id_product` = '.(int)$image->id_product.'
|
||||
AND id_shop='.(int)$this->context->shop->id.'
|
||||
LIMIT 1');
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.'product_'.$image->id_product.'.jpg'))
|
||||
@@ -1574,12 +1585,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
Search::indexation(false, $this->object->id);
|
||||
}
|
||||
|
||||
// If the product is virtual, set out_of_stock = 1 (allow sales when out of stock)
|
||||
if (Tools::getValue('type_product') == Product::PTYPE_VIRTUAL)
|
||||
StockAvailable::setProductOutOfStock($this->object->id, 1);
|
||||
else
|
||||
StockAvailable::setProductOutOfStock($this->object->id, 2);
|
||||
|
||||
// Save and preview
|
||||
if (Tools::isSubmit('submitAddProductAndPreview'))
|
||||
{
|
||||
@@ -2049,10 +2054,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
// Check if Module
|
||||
if (substr($this->tab_display, 0, 6) == 'Module')
|
||||
{
|
||||
$this->tab_display_module = strtolower(substr($this->tab_display, 6, strlen($this->tab_display) - 6));
|
||||
$this->tab_display_module = strtolower(substr($this->tab_display, 6, Tools::strlen($this->tab_display) - 6));
|
||||
$this->tab_display = 'Modules';
|
||||
}
|
||||
|
||||
if (method_exists($this, 'initForm'.$this->tab_display))
|
||||
$this->tpl_form = strtolower($this->tab_display).'.tpl';
|
||||
|
||||
@@ -2062,13 +2066,6 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$product_tabs = array();
|
||||
|
||||
// Check if Module
|
||||
if (substr($this->tab_display, 0, 6) == 'Module')
|
||||
{
|
||||
$this->tab_display = 'Modules';
|
||||
$this->tab_display_module = strtolower(substr($this->tab_display, 6, strlen($this->tab_display) - 6));
|
||||
}
|
||||
|
||||
// tab_display defines which tab to display first
|
||||
if (!method_exists($this, 'initForm'.$this->tab_display))
|
||||
$this->tab_display = $this->default_tab;
|
||||
@@ -2088,7 +2085,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$product_tabs[$product_tab] = array(
|
||||
'id' => $product_tab,
|
||||
'selected' => (strtolower($product_tab) == strtolower($this->tab_display) || (substr($this->tab_display, 0, 6) == 'Module')),
|
||||
'selected' => (strtolower($product_tab) == strtolower($this->tab_display) || (isset($this->tab_display_module) && 'module'.$this->tab_display_module == Tools::strtolower($product_tab))),
|
||||
'name' => $this->available_tabs_lang[$product_tab],
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)Tools::getValue('id_product').'&action='.$product_tab,
|
||||
);
|
||||
@@ -3334,7 +3331,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$images = Image::getImages($this->context->language->id, $product->id);
|
||||
|
||||
foreach ($images as $k => $image)
|
||||
$images[$k]['src'] = $this->context->link->getImageLink($product->link_rewrite[$this->context->language->id], $product->id.'-'.$image['id_image'], 'small');
|
||||
$images[$k]['src'] = $this->context->link->getImageLink($product->link_rewrite[$this->context->language->id], $product->id.'-'.$image['id_image'], 'small_default');
|
||||
$data->assign('images', $images);
|
||||
$data->assign('imagesTypes', ImageType::getImagesTypes('products'));
|
||||
|
||||
@@ -3379,7 +3376,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
protected function getCarrierList()
|
||||
{
|
||||
$carrier_list = Carrier::getCarriers($this->context->language->id);
|
||||
$carrier_list = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::ALL_CARRIERS);
|
||||
if ($product = $this->loadObject(true))
|
||||
{
|
||||
$carrier_selected_list = $product->getCarriers();
|
||||
@@ -3419,6 +3416,12 @@ class AdminProductsControllerCore extends AdminController
|
||||
$shops = false;
|
||||
if (Shop::isFeatureActive())
|
||||
$shops = Shop::getShops();
|
||||
|
||||
if ($shops)
|
||||
foreach ($shops as $key => $shop)
|
||||
if (!$obj->isAssociatedToShop($shop['id_shop']))
|
||||
unset($shops[$key]);
|
||||
|
||||
$data->assign('shops', $shops);
|
||||
|
||||
$count_images = Db::getInstance()->getValue('
|
||||
@@ -3426,23 +3429,29 @@ class AdminProductsControllerCore extends AdminController
|
||||
FROM '._DB_PREFIX_.'image
|
||||
WHERE id_product = '.(int)$obj->id
|
||||
);
|
||||
$data->assign('countImages', $count_images);
|
||||
|
||||
|
||||
$images = Image::getImages($this->context->language->id, $obj->id);
|
||||
$data->assign('id_product', (int)Tools::getValue('id_product'));
|
||||
$data->assign('id_category_default', (int)$this->_category->id);
|
||||
|
||||
foreach ($images as $k => $image)
|
||||
$images[$k] = new Image($image['id_image']);
|
||||
|
||||
$data->assign('images', $images);
|
||||
|
||||
$data->assign('token', $this->token);
|
||||
$data->assign('table', $this->table);
|
||||
$data->assign('max_image_size', $this->max_image_size / 1024 / 1024);
|
||||
|
||||
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename_attribute')));
|
||||
$data->assign('currency', $this->context->currency);
|
||||
if ($this->context->shop->getContext() == Shop::CONTEXT_SHOP)
|
||||
$current_shop_id = (int)$this->context->shop->id;
|
||||
else
|
||||
$current_shop_id = 0;
|
||||
|
||||
$data->assign(array(
|
||||
'countImages' => $count_images,
|
||||
'id_product' => (int)Tools::getValue('id_product'),
|
||||
'id_category_default' => (int)$this->_category->id,
|
||||
'images' => $images,
|
||||
'token' => $this->token,
|
||||
'table' => $this->table,
|
||||
'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
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
$this->displayWarning($this->l('You must save this product in this shop before adding images.'));
|
||||
@@ -3499,7 +3508,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$data->assign('available_date', ($this->getFieldValue($product, 'available_date') != 0) ? stripslashes(htmlentities(Tools::displayDate($this->getFieldValue($product, 'available_date'), $this->context->language->id))) : '0000-00-00');
|
||||
|
||||
$i = 0;
|
||||
$data->assign('imageType', ImageType::getByNameNType('small', 'products'));
|
||||
$data->assign('imageType', ImageType::getByNameNType('small_default', 'products'));
|
||||
$data->assign('imageWidth', (isset($image_type['width']) ? (int)($image_type['width']) : 64) + 25);
|
||||
foreach ($images as $k => $image)
|
||||
{
|
||||
@@ -3687,7 +3696,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
// Check if product has combination, to display the available date only for the product or for each combination
|
||||
if (Combination::isFeatureActive())
|
||||
$data->assign('countAttributes', (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.(int)$obj->id));
|
||||
|
||||
else
|
||||
$data->assign('countAttributes', false);
|
||||
// if advanced stock management is active, checks associations
|
||||
$advanced_stock_management_warning = false;
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $obj->advanced_stock_management)
|
||||
@@ -3908,7 +3918,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if ($this->product_exists_in_shop)
|
||||
{
|
||||
$features = Feature::getFeatures($this->context->language->id);
|
||||
$features = Feature::getFeatures($this->context->language->id, (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP));
|
||||
|
||||
foreach ($features as $k => $tab_features)
|
||||
{
|
||||
|
||||
@@ -77,14 +77,14 @@ class AdminScenesControllerCore extends AdminController
|
||||
|
||||
foreach ($images_types as $k => $image_type)
|
||||
{
|
||||
if ($image_type['name'] == 'large_scene' && isset($_FILES['image']))
|
||||
if ($image_type['name'] == 'scene_default' && isset($_FILES['image']))
|
||||
ImageManager::resize(
|
||||
$base_img_path,
|
||||
_PS_SCENE_IMG_DIR_.$obj->id.'-'.stripslashes($image_type['name']).'.jpg',
|
||||
(int)$image_type['width'],
|
||||
(int)$image_type['height']
|
||||
);
|
||||
else if ($image_type['name'] == 'thumb_scene')
|
||||
else if ($image_type['name'] == 'm_scene_default')
|
||||
{
|
||||
if (isset($_FILES['thumb']) && !$_FILES['thumb']['error'])
|
||||
$base_thumb_path = _PS_SCENE_THUMB_IMG_DIR_.$obj->id.'.jpg';
|
||||
@@ -135,9 +135,9 @@ class AdminScenesControllerCore extends AdminController
|
||||
$thumb_scene_image_type = null;
|
||||
foreach ($scene_image_types as $scene_image_type)
|
||||
{
|
||||
if ($scene_image_type['name'] == 'large_scene')
|
||||
if ($scene_image_type['name'] == 'scene_default')
|
||||
$large_scene_image_type = $scene_image_type;
|
||||
if ($scene_image_type['name'] == 'thumb_scene')
|
||||
if ($scene_image_type['name'] == 'm_scene_default')
|
||||
$thumb_scene_image_type = $scene_image_type;
|
||||
}
|
||||
$fields_form = array(
|
||||
@@ -202,13 +202,13 @@ class AdminScenesControllerCore extends AdminController
|
||||
$large_scene_image_type['width'], $large_scene_image_type['height'])
|
||||
.$this->l('If smaller than the image size setting, a white background will be added in order to achieve the correct image size.').'<br />'.
|
||||
$this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).');
|
||||
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg'))
|
||||
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-scene_default.jpg'))
|
||||
{
|
||||
$this->addJqueryPlugin('autocomplete');
|
||||
$this->addJqueryPlugin('imgareaselect');
|
||||
$this->addJs(_PS_JS_DIR_.'admin-scene-cropping.js' );
|
||||
$image_to_map_desc .= '<br /><img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'.
|
||||
_THEME_SCENE_DIR_.$obj->id.'-large_scene.jpg" /><br />';
|
||||
_THEME_SCENE_DIR_.$obj->id.'-scene_default.jpg" /><br />';
|
||||
|
||||
$image_to_map_desc .= '
|
||||
<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
|
||||
@@ -221,7 +221,7 @@ class AdminScenesControllerCore extends AdminController
|
||||
|
||||
if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg'))
|
||||
$image_to_map_desc .= '<br/>
|
||||
<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg" />
|
||||
<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-m_scene_default.jpg" />
|
||||
<br />';
|
||||
|
||||
$img_alt_desc = '';
|
||||
@@ -281,10 +281,8 @@ class AdminScenesControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_to_map_desc .= '<br/><span class="bold">'.$this->l('Please add a picture to continue mapping the image.').'</span><br/><br/>';
|
||||
$image_to_map_desc .= '</div>';
|
||||
}
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$this->fields_form['input'][] = array(
|
||||
|
||||
@@ -193,7 +193,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
}
|
||||
$this->fields_list['customers'] = (array(
|
||||
'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'id_gender' => array('title' => $this->l('Gender'), 'align' => 'center', 'icon' => $genders_icon, 'list' => $genders, 'width' => 25),
|
||||
'id_gender' => array('title' => $this->l('Titles'), 'align' => 'center', 'icon' => $genders_icon, 'list' => $genders, 'width' => 25),
|
||||
'firstname' => array('title' => $this->l('First Name'), 'align' => 'left', 'width' => 150),
|
||||
'lastname' => array('title' => $this->l('Name'), 'align' => 'left', 'width' => 'auto'),
|
||||
'email' => array('title' => $this->l('E-mail address'), 'align' => 'left', 'width' => 250),
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminStatsControllerCore extends AdminStatsTabControllerCore
|
||||
class AdminStatsControllerCore extends AdminStatsTabController
|
||||
{
|
||||
}
|
||||
@@ -461,7 +461,7 @@ class AdminStoresControllerCore extends AdminController
|
||||
'type' => 'text'
|
||||
),
|
||||
'PS_SHOP_ADDR2' => array(
|
||||
'title' => 'Address line 2',
|
||||
'title' => $this->l('Shop address line 2'),
|
||||
'validation' => 'isAddress',
|
||||
'size' => 30,
|
||||
'type' => 'text'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user