Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl admin-dev/themes/default/template/controllers/modules_positions/form.tpl admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl admin-dev/themes/default/template/controllers/products/input_text_lang.tpl admin-dev/themes/default/template/controllers/products/shipping.tpl admin-dev/themes/default/template/controllers/shipping/content.tpl admin-dev/themes/default/template/helpers/form/form.tpl admin-dev/themes/default/template/helpers/list/list_header.tpl admin-dev/themes/default/template/toolbar.tpl classes/helper/HelperList.php controllers/admin/AdminCategoriesController.php controllers/admin/AdminManufacturersController.php controllers/admin/AdminModulesPositionsController.php controllers/admin/AdminPerformanceController.php controllers/admin/AdminStockInstantStateController.php css/admin.css js/admin-products.js js/admin.js
This commit is contained in:
@@ -70,7 +70,8 @@
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
var infos = msg.infos.split('_');
|
||||
var infos = msg.infos.replace("\\'", "'").split('_');
|
||||
|
||||
$('input[name=firstname]').val(infos[0]);
|
||||
$('input[name=lastname]').val(infos[1]);
|
||||
$('input[name=company]').val(infos[2]);
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
{if $input.type == 'color'}
|
||||
<div id="colorAttributeProperties" "{if !$colorAttributeProperties}style="display:none"{/if};">
|
||||
{/if}
|
||||
{if $input.type == 'closediv'}
|
||||
</div>
|
||||
{/if}
|
||||
{$smarty.block.parent}
|
||||
{/block}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
{block name="script"}
|
||||
var string_price = '{l s='Will be applied when the price is' js=1}';
|
||||
var string_weight = '{l s='Will be applied when the weight is' js=1}';
|
||||
{/block}
|
||||
|
||||
{block name="field"}
|
||||
{if $input.name == 'zones'}
|
||||
<div class="ranges_not_follow warn" style="display:none">
|
||||
<label>{l s="Ranges are not correctly ordered:"}</label>
|
||||
<a href="#" class="button" style="text-decoration:none">{l s="Reordering"}</a>
|
||||
</div>
|
||||
{include file='controllers/carrier_wizard/helpers/form/form_ranges.tpl'}
|
||||
<!--
|
||||
<div class="validate_range" style="display:none">
|
||||
<a href="#" class="button" id="validate_range_button">{l s="Validate"}</a>
|
||||
</div>
|
||||
-->
|
||||
<div class="new_range">
|
||||
<a href="#" onclick="add_new_range();return false;" class="button" id="add_new_range">{l s='Add new range'}</a>
|
||||
</div>
|
||||
{/if}
|
||||
{if $input.name == 'logo'}
|
||||
<div class="margin-form">
|
||||
<input id="carrier_logo_input" type="file" onchange="uploadCarrierLogo();" name="carrier_logo_input" />
|
||||
<input type="hidden" id="logo" name="logo" value="" />
|
||||
<p class="preference_description">
|
||||
{l s='Format:'} JPG, GIF, PNG. {l s='Filesize:'} {$max_image_size|string_format:"%.2f"} {l s='MB max.'}
|
||||
<br />{l s='Current size:'} <span id="carrier_logo_size">{l s='undefined'}</span>.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
{$smarty.block.parent}
|
||||
{/block}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
<script>var zones_nbr = {$zones|count +3} ; /*corresponds to the third input text (max, min and all)*/</script>
|
||||
<div style="float:left" id="zone_ranges">
|
||||
<table cellpadding="5" cellspacing="0" id="zones_table">
|
||||
<tr class="range_inf">
|
||||
<td class="range_type"></td>
|
||||
<td class="border_left border_bottom range_sign">>=</td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="border_bottom center"><input name="range_inf[{$range.id_range|intval}]" type="text" value="{$range.delimiter1|string_format:"%.6f"}" /><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
{foreachelse}
|
||||
<td class="border_bottom center"><input name="range_inf[{$range.id_range|intval}]" type="text" /><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
<tr class="range_sup">
|
||||
<td class="center range_type"></td>
|
||||
<td class="border_left range_sign"><</td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" {if isset($form_id) && !$form_id} value="" {else} value="{if isset($change_ranges) && $range.id_range == 0} {else}{$range.delimiter2|string_format:"%.6f"}{/if}" {/if}/><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
{foreachelse}
|
||||
<td class="center"><input name="range_sup[{$range.id_range|intval}]" type="text" /><sup>*</sup><span class="weight_unit"> {$PS_WEIGHT_UNIT}</span><span class="price_unit"> {$currency_sign}</span></td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
<tr class="fees_all">
|
||||
<td class="border_top border_bottom border_bold"><span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span></td>
|
||||
<td></td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="center border_top border_bottom {if $range.id_range != 0} validated {/if}" >
|
||||
<input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == 0} style="display:none"{/if} /><span class="currency_sign" {if $range.id_range == 0} style="display:none" {/if}> {$currency_sign}</span>
|
||||
</td>
|
||||
{foreachelse}
|
||||
<td class="center border_top border_bottom">
|
||||
<input style="display:none" type="text" /><span class="currency_sign" style="display:none"> {$currency_sign}</span>
|
||||
</td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
{foreach from=$zones key=i item=zone}
|
||||
<tr class="fees {if $i is odd}alt_row{/if}" data-zoneid="{$zone.id_zone}">
|
||||
<td><label for="zone_{$zone.id_zone}">{$zone.name}</label></td>
|
||||
<td class="zone">
|
||||
<input class="input_zone" id="zone_{$zone.id_zone}" name="zone_{$zone.id_zone}" value="1" type="checkbox" {if isset($fields_value['zones'][$zone.id_zone]) && $fields_value['zones'][$zone.id_zone]} checked="checked"{/if}/>
|
||||
</td>
|
||||
{foreach from=$ranges key=r item=range}
|
||||
<td class="center">
|
||||
<input name="fees[{$zone.id_zone|intval}][{$range.id_range|intval}]" type="text"
|
||||
{if !isset($fields_value['zones'][$zone.id_zone]) || (isset($fields_value['zones'][$zone.id_zone]) && !$fields_value['zones'][$zone.id_zone])} disabled="disabled"{/if} {if isset($price_by_range[$range.id_range][$zone.id_zone]) && $price_by_range[$range.id_range][$zone.id_zone] && isset($fields_value['zones'][$zone.id_zone]) && $fields_value['zones'][$zone.id_zone]} value="{$price_by_range[$range.id_range][$zone.id_zone]|string_format:'%.6f'}" {else} value="" {/if} /> {$currency_sign}
|
||||
</td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr class="delete_range">
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
{foreach from=$ranges name=ranges key=r item=range}
|
||||
{if $smarty.foreach.ranges.first}
|
||||
<td class="center"> </td>
|
||||
{else}
|
||||
<td class="center"><button class="button">{l s='Delete'}</button</td>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,65 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/view/view.tpl"}
|
||||
{block name="override_tpl"}
|
||||
<script>
|
||||
var labelNext = '{$labels.next|addslashes}';
|
||||
var labelPrevious = '{$labels.previous|addslashes}';
|
||||
var labelFinish = '{$labels.finish|addslashes}';
|
||||
var labelDelete = '{l s='Delete' js=1}';
|
||||
var labelValidate = '{l s='Validate' js=1}';
|
||||
var validate_url = '{$validate_url|addslashes}';
|
||||
var carrierlist_url = '{$carrierlist_url|addslashes}';
|
||||
var nbr_steps = {$wizard_steps.steps|count};
|
||||
var enableAllSteps = {if $enableAllSteps|intval == 1}true{else}false{/if};
|
||||
var need_to_validate = '{l s='Please validate the last range before create a new one.' js=1}';
|
||||
var delete_range_confirm = '{l s='Are you sure to delete this range ?' js=1}';
|
||||
var currency_sign = '{$currency_sign}';
|
||||
var PS_WEIGHT_UNIT = '{$PS_WEIGHT_UNIT}';
|
||||
var invalid_range = '{l s='This range is not valid' js=1}';
|
||||
var range_is_overlapping = '{l s='Ranges are overlapping' js=1}';
|
||||
</script>
|
||||
<div id="carrier_wizard" class="swMain">
|
||||
<ul class="nbr_steps_{$wizard_steps.steps|count}">
|
||||
{foreach from=$wizard_steps.steps key=step_nbr item=step}
|
||||
<li>
|
||||
<a href="#step-{$step_nbr + 1}">
|
||||
<label class="stepNumber">{$step_nbr + 1}</label>
|
||||
<span class="stepDesc">
|
||||
{$step.title}<br />
|
||||
{if isset($step.desc)}<small>{$step.desc}</small>{/if}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{foreach from=$wizard_contents.contents key=step_nbr item=content}
|
||||
<div id="step-{$step_nbr + 1}" class="step_container">
|
||||
{$content}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/block}
|
||||
@@ -0,0 +1,91 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div id="carrier_logo_block">
|
||||
<img id="carrier_logo_img" src="{if $carrier_logo}{$carrier_logo}{else}../img/admin/carrier-default.jpg{/if}" />
|
||||
<br/>
|
||||
<a id="carrier_logo_remove" {if !$carrier_logo}style="display:none"{/if} href="javascript:removeCarrierLogo();"><img src="../img/admin/disabled.gif" /> {l s='Remove the logo'}</a>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var carrier_translation_undefined = '{l s='undefined' js=1}';
|
||||
|
||||
function removeCarrierLogo()
|
||||
{
|
||||
$('#carrier_logo_img').attr('src', '../img/admin/carrier-default.jpg');
|
||||
$('#logo').val('null');
|
||||
fixCarrierLogoDisplay();
|
||||
$('#carrier_logo_remove').hide();
|
||||
}
|
||||
|
||||
function uploadCarrierLogo()
|
||||
{
|
||||
$.ajaxFileUpload({
|
||||
url: 'ajax-tab.php?tab=AdminCarrierWizard&token={$token|addslashes}&action=uploadLogo',
|
||||
secureuri: false,
|
||||
fileElementId: 'carrier_logo_input',
|
||||
dataType: 'xml',
|
||||
success: function (data, status) {
|
||||
data = data.getElementsByTagName('return')[0];
|
||||
var message = data.getAttribute("message");
|
||||
if (data.getAttribute("result") == "success")
|
||||
{
|
||||
$('#carrier_logo_img').attr('src', message);
|
||||
$('#logo').val(message);
|
||||
$('#carrier_logo_remove').show();
|
||||
fixCarrierLogoDisplay();
|
||||
}
|
||||
else
|
||||
alert(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function fixCarrierLogoDisplay()
|
||||
{
|
||||
$('<img/>').attr('src', $('#carrier_logo_img').attr('src')).load(function(){
|
||||
var maxHeight = 200;
|
||||
var maxWidth = 200;
|
||||
var res = this.width / this.height;
|
||||
$('#carrier_logo_size').text(this.width + 'x' + this.height + ' px');
|
||||
$('#carrier_logo_img').width(this.width);
|
||||
$('#carrier_logo_img').height(this.height);
|
||||
if ($('#carrier_logo_img').width() > maxWidth)
|
||||
{
|
||||
$('#carrier_logo_img').width(maxWidth);
|
||||
$('#carrier_logo_img').height(maxWidth / res);
|
||||
}
|
||||
if ($('#carrier_logo_img').height() > maxHeight)
|
||||
{
|
||||
$('#carrier_logo_img').height(maxHeight);
|
||||
$('#carrier_logo_img').width(maxHeight * res);
|
||||
}
|
||||
if ($('#logo').val() == 'null')
|
||||
$('#carrier_logo_size').text(carrier_translation_undefined);
|
||||
});
|
||||
}
|
||||
|
||||
fixCarrierLogoDisplay();
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
var summary_translation_undefined = '{l s='[undefined]' js=1}';
|
||||
|
||||
var summary_translation_meta_informations = '{l s='This carrier is @s1 and the displayed delivery time is: @s2.' js=1}';
|
||||
var summary_translation_free = '<strong>{l s='free' js=1}</strong>';
|
||||
var summary_translation_paid = '<strong>{l s='paid' js=1}</strong>';
|
||||
|
||||
var summary_translation_range = '{l s='This carrier can deliver orders from @s1 to @s2. If the order is out of range, the behavior is to @s3.' js=1}';
|
||||
|
||||
var summary_translation_shipping_cost = '{l s='The shipping cost is calculated @s1 and the tax rule @s2 is applied.' js=1}';
|
||||
var summary_translation_price = '<strong>{l s='according to the price' js=1}</strong>';
|
||||
var summary_translation_weight = '<strong>{l s='according to the weight' js=1}</strong>';
|
||||
</script>
|
||||
<div class="defaultForm">
|
||||
<fieldset>
|
||||
{l s='Carrier name:'} <strong id="summary_name"></strong>
|
||||
<div class="clear"> </div>
|
||||
<div id="summary_meta_informations"></div>
|
||||
<div class="clear"> </div>
|
||||
<div id="summary_shipping_cost"></div>
|
||||
<div class="clear"> </div>
|
||||
<div id="summary_range"></div>
|
||||
<div class="clear"> </div>
|
||||
<div>
|
||||
{l s='It will be displayed only for the following zones:'}
|
||||
<ul id="summary_zones"></ul>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<div>
|
||||
{l s='It will be displayed only for the following groups:'}
|
||||
<ul id="summary_groups"></ul>
|
||||
</div>
|
||||
{if $is_multishop}
|
||||
<div class="clear"> </div>
|
||||
<div>
|
||||
{l s='It will be displayed only for the following shops:'}
|
||||
<ul id="summary_shops"></ul>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="clear"> </div>
|
||||
{$active_form}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/list/list_content.tpl"}
|
||||
{block name="open_td"}
|
||||
<td
|
||||
{if isset($params.position)}
|
||||
id="td_{if !empty($id_category)}{$id_category}{else}0{/if}_{$tr.$identifier}"
|
||||
{/if}
|
||||
class="{if !$no_link}pointer{/if}
|
||||
{if isset($params.position) && $order_by == 'position' && $order_way != 'DESC'} dragHandle{/if}
|
||||
{if isset($params.align)} {$params.align}{/if}"
|
||||
{if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))}
|
||||
onclick="document.location = '{$link->getAdminLink('AdminCarrierWizard', true)}&{$identifier}={$tr.$identifier}'">
|
||||
{else}
|
||||
>
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -103,8 +103,6 @@
|
||||
<i class="icon-edit"></i> {l s='Edit'}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-file"></i> {l s='Orders'} <span class="badge">{count($orders)}</span>
|
||||
@@ -542,6 +540,5 @@
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{/block}
|
||||
{/block}
|
||||
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
|
||||
<form action="{$current}&token={$token}" method="post" id="import_form" name="import_form">
|
||||
{l s='Skip'} <input type="text" size="2" name="skip" value="0" /> {l s='lines'}
|
||||
{l s='Skip'} <input type="text" size="2" name="skip" value="1" /> {l s='lines'}
|
||||
<input type="hidden" name="csv" value="{$fields_value.csv}" />
|
||||
<input type="hidden" name="convert" value="{$fields_value.convert}" />
|
||||
<input type="hidden" name="entity" value="{$fields_value.entity}" />
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
|
||||
<div class="leadin">{block name="leadin"}{/block}</div>
|
||||
|
||||
<form action="{$url_submit}" id={$table}_form method="post" class="form-horizontal">
|
||||
<form action="{$url_submit}" id="{$table}_form" method="post" class="form-horizontal">
|
||||
|
||||
{if $display_key}
|
||||
<input type="hidden" name="show_modules" value="{$display_key}" />
|
||||
{/if}
|
||||
@@ -55,20 +56,21 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label class="control-label col-lg-3">{l s='Exceptions'} :</label>
|
||||
<div class="col-lg-6">
|
||||
{if !$except_diff}
|
||||
{$exception_list}
|
||||
{else}
|
||||
{foreach $exception_list_diff as $value}
|
||||
{$value}
|
||||
{/foreach}
|
||||
{/if}
|
||||
<div class="alert alert-block">
|
||||
<p>{l s='Please specify the files for which you do not want the module to be displayed.'}.</p>
|
||||
<p>{l s='Please input each filename, separated by a comma.'}.</p>
|
||||
<p>
|
||||
{l s='Please specify the files for which you do not want the module to be displayed.'}<br />
|
||||
{l s='Please input each filename, separated by a comma.'}<br />
|
||||
{if !$except_diff}
|
||||
{$exception_list}
|
||||
{else}
|
||||
{foreach $exception_list_diff as $value}
|
||||
{$value}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,42 +82,43 @@
|
||||
<input type="hidden" name="id_hook" value="{$id_hook}" />
|
||||
{/if}
|
||||
<input type="submit" value="{l s='Save'}" name="{if $edit_graft}submitEditGraft{else}submitAddToHook{/if}" id="{$table}_form_submit_btn" class="btn btn-primary" />
|
||||
<p>
|
||||
<span class="text-danger">*</span>
|
||||
{l s='Required field'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA
|
||||
function position_exception_add(shopID)
|
||||
{
|
||||
var listValue = $('#em_list_'+shopID).val();
|
||||
var inputValue = $('#em_text_'+shopID).val();
|
||||
var r = new RegExp('(^|,) *'+listValue+' *(,|$)');
|
||||
if (!r.test(inputValue))
|
||||
$('#em_text_'+shopID).val(inputValue + ((inputValue.trim()) ? ', ' : '') + listValue);
|
||||
}
|
||||
|
||||
function position_exception_remove(shopID)
|
||||
{
|
||||
var listValue = $('#em_list_'+shopID).val();
|
||||
var inputValue = $('#em_text_'+shopID).val();
|
||||
var r = new RegExp('(^|,) *'+listValue+' *(,|$)');
|
||||
if (r.test(inputValue))
|
||||
{
|
||||
var rep = '';
|
||||
if (new RegExp(', *'+listValue+' *,').test(inputValue))
|
||||
$('#em_text_'+shopID).val(inputValue.replace(r, ','));
|
||||
else if (new RegExp(listValue+' *,').test(inputValue))
|
||||
$('#em_text_'+shopID).val(inputValue.replace(r, ''));
|
||||
else
|
||||
$('#em_text_'+shopID).val(inputValue.replace(r, ''));
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA
|
||||
function position_exception_textchange()
|
||||
{
|
||||
// TODO : Add & Remove automatically the "custom pages" in the "em_list_x"
|
||||
var obj = $(this);
|
||||
var shopID = obj.attr('id').replace(/\D/g, '');
|
||||
var list = obj.parent().find('#em_list_' + shopID);
|
||||
var values = obj.val().split(',');
|
||||
var len = values.length;
|
||||
|
||||
list.find('option').prop('selected', false);
|
||||
for (var i = 0; i < len; i++)
|
||||
list.find('option[value="' + $.trim(values[i]) + '"]').prop('selected', true);
|
||||
}
|
||||
|
||||
function position_exception_listchange()
|
||||
{
|
||||
var obj = $(this);
|
||||
var shopID = obj.attr('id').replace(/\D/g, '');
|
||||
var str = obj.val().join(', ');
|
||||
|
||||
obj.parent().find('#em_text_' + shopID).val(str);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('form[id="hook_module_form"] input[id^="em_text_"]').each(function(){
|
||||
$(this).change(position_exception_textchange).change();
|
||||
});
|
||||
|
||||
$('form[id="hook_module_form"] select[id^="em_list_"]').each(function(){
|
||||
$(this).change(position_exception_listchange);
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
$('input[name="smarty_force_compile"], input[name="smarty_cache"], input[name="smarty_console"]').change(function(){
|
||||
$('input[name="smarty_force_compile"], input[name="smarty_cache"], input[name="smarty_console"], input[name="smarty_console_key"]').change(function(){
|
||||
$('#smarty_up').val(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -46,4 +46,5 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
var msg_select_one = "{l s="Please select at least one product." js=1}";
|
||||
var msg_set_quantity = "{l s="Please set a quantity to add a product." js=1}";
|
||||
var msg_select_one = "{l s='Please select at least one product.' js=1}";
|
||||
var msg_set_quantity = "{l s='Please set a quantity to add a product.' js=1}";
|
||||
</script>
|
||||
<input type="hidden" name="submitted_tabs[]" value="Pack" />
|
||||
<h3>{l s='Pack'}</h3>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
{$bullet_common_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<label class="control-label col-lg-5" for="depth">{l s='Depth (package):'}</label>
|
||||
<div class="input-group col-lg-2">
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ $(document).ready(function() {
|
||||
$('#id_attribute_group option[value="{$condition.id_attribute_group}"]').attr('selected', true);
|
||||
$('#id_attribute_{$condition.id_attribute_group} option[value="{$condition.value}"]').attr('selected', true);
|
||||
{elseif $condition.type == 'feature'}
|
||||
$('#id_feature[value="{$condition.id_feature}"]').attr('selected', true);
|
||||
$('#id_feature option[value="{$condition.id_feature}"]').attr('selected', true);
|
||||
$('#id_feature_{$condition.id_feature} option[value="{$condition.value}"]').attr('selected', true);
|
||||
{else}
|
||||
$('#id_{$condition.type} option[value="{$condition.value}"]').attr('selected', true);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div id="statsContainer">
|
||||
<div id="calendar">
|
||||
<form action="{$current}&token={$token}{if $action && $table}&{$action|escape}{$table|escape}{/if}{if $identifier && $id}&{$identifier|escape}={$id|escape}{/if}" method="post" id="calendar_form" name="calendar_form">
|
||||
<form action="{$current}&token={$token}{if $action && $table}&{$action|escape}{$table|escape}{/if}{if $identifier && $id}&{$identifier|escape}={$id|escape}{/if}{if isset($smarty.get.module)}&module={$smarty.get.module|escape}{/if}{if isset($smarty.get.id_product)}&id_product={$smarty.get.id_product|escape}{/if}" method="post" id="calendar_form" name="calendar_form">
|
||||
<input type="submit" name="submitDateDay" class="button submitDateDay" value="{$translations.Day}">
|
||||
<input type="submit" name="submitDateMonth" class="button submitDateMonth" value="{$translations.Month}">
|
||||
<input type="submit" name="submitDateYear" class="button submitDateYear" value="{$translations.Year}">
|
||||
@@ -51,4 +51,4 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
{if isset($fields.title)}<h3>{$fields.title}</h3>{/if}
|
||||
|
||||
{block name="defaultForm"}
|
||||
<form id="{$table}_form" class="form-horizontal defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
|
||||
<form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{$table}_form{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}>
|
||||
{if $form_id}
|
||||
<input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" />
|
||||
{/if}
|
||||
@@ -339,6 +339,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
<<<<<<< HEAD
|
||||
|
||||
<div class="col-lg-7">
|
||||
<div class="row">
|
||||
@@ -370,6 +371,22 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
=======
|
||||
|
||||
{if isset($input.lang) AND $input.lang}
|
||||
<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;">
|
||||
<input type="file" name="{$input.name}_{$language.id_lang}" {if isset($input.id)}id="{$input.id}_{$language.id_lang}"{/if} />
|
||||
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{else}
|
||||
<input type="file" name="{$input.name}" {if isset($input.id)}id="{$input.id}"{/if} />
|
||||
{/if}
|
||||
{if !empty($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
>>>>>>> f610b0d844c37cc9b1dc1b94c17f3d0e5a3ca21a
|
||||
{elseif $input.type == 'password'}
|
||||
<input type="password"
|
||||
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
|
||||
@@ -426,7 +443,6 @@
|
||||
{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'}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
{block name="td_content"}
|
||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||
{if isset($params.color) && isset($tr[$params.color])}
|
||||
<span class="color_field" style="background-color:{$tr.color};color:{if Tools::getBrightness($tr.color) < 128}white{else}#383838{/if}">
|
||||
<span class="color_field" style="background-color:{$tr[$params.color]};color:{if Tools::getBrightness($tr[$params.color]) < 128}white{else}#383838{/if}">
|
||||
{/if}
|
||||
{if isset($tr.$key)}
|
||||
{if isset($params.active)}
|
||||
|
||||
@@ -24,46 +24,51 @@
|
||||
*}
|
||||
|
||||
{if !$simple_header}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('table.{$table} .filter').keypress(function(event){
|
||||
formSubmit(event, 'submitFilterButton{$table}')
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
{* Display column names and arrows for ordering (ASC, DESC) *}
|
||||
{if $is_order_position}
|
||||
<script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script>
|
||||
<script type="text/javascript">
|
||||
var token = '{$token}';
|
||||
var come_from = '{$table}';
|
||||
var alternate = {if $order_way == 'DESC'}'1'{else}'0'{/if};
|
||||
$(document).ready(function() {
|
||||
$('table.{$list_id} .filter').keypress(function(event){
|
||||
formSubmit(event, 'submitFilterButton{$list_id}')
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/admin-dnd.js"></script>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
if ($("table.{$table} .datepicker").length > 0)
|
||||
$("table.{$table} .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
{* Display column names and arrows for ordering (ASC, DESC) *}
|
||||
{if $is_order_position}
|
||||
<script type="text/javascript" src="../js/jquery/plugins/jquery.tablednd.js"></script>
|
||||
<script type="text/javascript">
|
||||
var token = '{$token}';
|
||||
var come_from = '{$list_id}';
|
||||
var alternate = {if $order_way == 'DESC'}'1'{else}'0'{/if};
|
||||
</script>
|
||||
<script type="text/javascript" src="../js/admin-dnd.js"></script>
|
||||
{/if}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
if ($("table.{$list_id} .datepicker").length > 0)
|
||||
$("table.{$list_id} .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
{/if}{* End if simple_header *}
|
||||
|
||||
{if $show_toolbar}
|
||||
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
|
||||
{/if}
|
||||
|
||||
{if !$simple_header}
|
||||
<div class="leadin">{block name="leadin"}{/block}</div>
|
||||
<div class="leadin">{block name="leadin"}{/block}</div>
|
||||
{/if}
|
||||
|
||||
{hook h='displayAdminListBefore'}
|
||||
{block name="override_header"}{/block}
|
||||
|
||||
|
||||
{hook h='displayAdminListBefore'}
|
||||
{if isset($name_controller)}
|
||||
{capture name=hookName assign=hookName}display{$name_controller|ucfirst}ListBefore{/capture}
|
||||
{hook h=$hookName}
|
||||
@@ -72,130 +77,147 @@
|
||||
{hook h=$hookName}
|
||||
{/if}
|
||||
|
||||
|
||||
{if !$simple_header}
|
||||
<form method="post" action="{$action}" class="form-horizontal">
|
||||
<fieldset>
|
||||
{block name="override_header"}{/block}
|
||||
<form method="post" action="{$action}" class="form">
|
||||
|
||||
{if $show_filters}
|
||||
<input type="hidden" id="submitFilter{$table}" name="submitFilter{$table}" value="0"/>
|
||||
<span class="pull-right">
|
||||
<button type="submit" name="submitReset{$table}" class="btn {if !$filters_has_value}btn-default{else}btn-primary{/if} btn-small"{if !$filters_has_value} disabled="disabled"{/if}>
|
||||
<i class="icon-eraser"></i> {l s='Reset'}
|
||||
</button>
|
||||
<button type="submit" id="submitFilterButton{$table}" name="submitFilter" class="btn btn-default btn-small" />
|
||||
<i class="icon-filter"></i> {l s='Filter'}
|
||||
</button>
|
||||
</span>
|
||||
{/if}
|
||||
{block name="override_form_extra"}{/block}
|
||||
|
||||
<input type="hidden" id="submitFilter{$list_id}" name="submitFilter{$list_id}" value="0"/>
|
||||
{/if}
|
||||
<table
|
||||
class="table"
|
||||
name="list_table"
|
||||
{if $table_id} id={$table_id}{/if}
|
||||
class="table {if $table_dnd}tableDnD{/if} {$table}"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="center">
|
||||
</th>
|
||||
<table class="table_grid" name="list_table">
|
||||
{if !$simple_header}
|
||||
<tr>
|
||||
<td style="vertical-align: bottom;">
|
||||
<span style="float: left;">
|
||||
{if $page > 1}
|
||||
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE('submitFilter{$list_id}').value=1"/>
|
||||
<input type="image" src="../img/admin/list-prev.gif" onclick="getE('submitFilter{$list_id}').value={$page - 1}"/>
|
||||
{/if}
|
||||
{l s='Page'} <b>{$page}</b> / {$total_pages}
|
||||
{if $page < $total_pages}
|
||||
<input type="image" src="../img/admin/list-next.gif" onclick="getE('submitFilter{$list_id}').value={$page + 1}"/>
|
||||
<input type="image" src="../img/admin/list-next2.gif" onclick="getE('submitFilter{$list_id}').value={$total_pages}"/>
|
||||
{/if}
|
||||
| {l s='Display'}
|
||||
<select name="{$list_id}_pagination" onchange="submit()">
|
||||
{* Choose number of results per page *}
|
||||
{foreach $pagination AS $value}
|
||||
<option value="{$value|intval}"{if $selected_pagination == $value} selected="selected" {elseif $selected_pagination == NULL && $value == $pagination[1]} selected="selected2"{/if}>{$value|intval}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
</span>
|
||||
<span style="float: right;">
|
||||
<input type="submit" name="submitReset{$list_id}" value="{l s='Reset'}" class="button" />
|
||||
<input type="submit" id="submitFilterButton{$list_id}" name="submitFilter" value="{l s='Filter'}" class="button" />
|
||||
</span>
|
||||
<span class="clear"></span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td{if $simple_header} style="border:none;"{/if}>
|
||||
<table
|
||||
{if $table_id} id={$table_id}{/if}
|
||||
class="table {if $table_dnd}tableDnD{/if} {$list_id}"
|
||||
cellpadding="0" cellspacing="0"
|
||||
style="width: 100%; margin-bottom:10px;">
|
||||
<col width="10px" />
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th {if isset($params.align)} class="{$params.align}"{/if}>
|
||||
|
||||
<span class="title_box {if isset($order_by) && ($key == $order_by)} active{/if}">
|
||||
|
||||
{if isset($params.hint)}
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
title="
|
||||
{if is_array($params.hint)}
|
||||
{foreach $params.hint as $hint}
|
||||
{if is_array($hint)}
|
||||
{$hint.text}
|
||||
{else}
|
||||
{$hint}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$params.hint}
|
||||
{/if}
|
||||
">
|
||||
{$params.title}
|
||||
</span>
|
||||
{else}
|
||||
{$params.title}
|
||||
{/if}
|
||||
|
||||
{if (!isset($params.orderby) || $params.orderby) && !$simple_header}
|
||||
<a {if isset($order_by) && ($key == $order_by) && ($order_way == 'DESC')}class="active"{/if} href="{$currentIndex}&{$table}Orderby={$key|urlencode}&{$table}Orderway=desc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<i class="icon-caret-down"></i>
|
||||
</a>
|
||||
<a {if isset($order_by) && ($key == $order_by) && ($order_way == 'ASC')}class="active"{/if} href="{$currentIndex}&{$table}Orderby={$key|urlencode}&{$table}Orderway=asc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<i class="icon-caret-up"></i>
|
||||
</a>
|
||||
</span>
|
||||
{/if}
|
||||
</th>
|
||||
<col {if isset($params.width) && $params.width != 'auto'}width="{$params.width}px"{/if}/>
|
||||
{/foreach}
|
||||
{if $shop_link_type}
|
||||
<th>
|
||||
{if $shop_link_type == 'shop'}
|
||||
{l s='Shop'}
|
||||
{else}
|
||||
{l s='Group shop'}
|
||||
{/if}
|
||||
</th>
|
||||
<col width="80px" />
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<th>{l s='Actions'}{if !$simple_header}{/if}</th>
|
||||
<col width="52px" />
|
||||
{/if}
|
||||
</tr>
|
||||
{if !$simple_header && $show_filters}
|
||||
<tr class="filter {if $row_hover}row_hover{/if}">
|
||||
<td class="center">
|
||||
{if $has_bulk_actions}
|
||||
--
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
{* Filters (input, select, date or bool) *}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<td {if isset($params.align)} class="{$params.align}" {/if}>
|
||||
{if isset($params.search) && !$params.search}
|
||||
--
|
||||
{else}
|
||||
{if $params.type == 'bool'}
|
||||
<select class="filter" onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$key}">
|
||||
<option value="">--</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
{l s='From'} <input type="text" class="filter datepicker" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($params.value.0)}{$params.value.0}{/if}"{if isset($params.width)} style="width:70px"{/if}/>
|
||||
{l s='To'} <input type="text" class="filter datepicker" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}"{if isset($params.width)} style="width:70px"{/if}/>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select class="filter" onchange="$('#submitFilterButton{$table}').focus();$('#submitFilterButton{$table}').click();" name="{$table}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>--</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if $option_display == $params.value || $option_value == $params.value} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
<thead>
|
||||
<tr class="nodrag nodrop" style="height: 40px">
|
||||
<th class="center">
|
||||
{if $has_bulk_actions}
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$list_id}Box[]', this.checked)" />
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" class="filter" name="{$table}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'htmlall':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
|
||||
</th>
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th {if isset($params.align)} class="{$params.align}"{/if}>
|
||||
{if isset($params.hint)}<span class="hint" name="help_box">{$params.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
<span class="title_box">
|
||||
{$params.title}
|
||||
</span>
|
||||
{if (!isset($params.orderby) || $params.orderby) && !$simple_header}
|
||||
<br />
|
||||
<a href="{$currentIndex}&{$list_id}Orderby={$key|urlencode}&{$list_id}Orderway=desc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<img border="0" src="../img/admin/down{if isset($order_by) && ($key == $order_by) && ($order_way == 'DESC')}_d{/if}.gif" /></a>
|
||||
<a href="{$currentIndex}&{$list_id}Orderby={$key|urlencode}&{$list_id}Orderway=asc&token={$token}{if isset($smarty.get.$identifier)}&{$identifier}={$smarty.get.$identifier|intval}{/if}">
|
||||
<img border="0" src="../img/admin/up{if isset($order_by) && ($key == $order_by) && ($order_way == 'ASC')}_d{/if}.gif" /></a>
|
||||
{elseif !$simple_header}
|
||||
<br />
|
||||
{/if}
|
||||
</th>
|
||||
{/foreach}
|
||||
{if $shop_link_type}
|
||||
<th>
|
||||
{if $shop_link_type == 'shop'}
|
||||
{l s='Shop'}
|
||||
{else}
|
||||
{l s='Group shop'}
|
||||
{/if}
|
||||
<br />
|
||||
</th>
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
{/foreach}
|
||||
{if $has_actions}
|
||||
<th class="center">{l s='Actions'}{if !$simple_header}<br /> {/if}</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{if !$simple_header}
|
||||
<tr class="nodrag nodrop filter {if $row_hover}row_hover{/if}" style="height: 35px;">
|
||||
<td class="center">
|
||||
{if $has_bulk_actions}
|
||||
--
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
{if $shop_link_type}
|
||||
<td>--</td>
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<td class="center">--</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
</thead>
|
||||
{* Filters (input, select, date or bool) *}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<td {if isset($params.align)} class="{$params.align}" {/if}>
|
||||
{if isset($params.search) && !$params.search}
|
||||
--
|
||||
{else}
|
||||
{if $params.type == 'bool'}
|
||||
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$key}">
|
||||
<option value="">--</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
{l s='From'} <input type="text" class="filter datepicker" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($params.value.0)}{$params.value.0}{/if}"{if isset($params.width)} style="width:70px"{/if}/><br />
|
||||
{l s='To'} <input type="text" class="filter datepicker" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}"{if isset($params.width)} style="width:70px"{/if}/>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>--</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if $option_display == $params.value || $option_value == $params.value} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" class="filter" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'htmlall':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{else}style="width:95%"{/if} />
|
||||
{/if}
|
||||
{/if}
|
||||
</td>
|
||||
{/foreach}
|
||||
|
||||
{if $shop_link_type}
|
||||
<td>--</td>
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<td class="center">--</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
</thead>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
|
||||
{if count($errors) == 1}
|
||||
{$errors[0]}
|
||||
{reset($errors)}
|
||||
{else}
|
||||
{l s='%d errors' sprintf=$errors|count}
|
||||
<br/>
|
||||
|
||||
@@ -36,167 +36,166 @@
|
||||
{block name=toolbarBox}
|
||||
<ul class="cc_button nav nav-pills pull-right">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
<li>
|
||||
<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="toolbar_btn" {if isset($btn.href)}href="{$btn.href}"{/if} title="{$btn.desc}" {if isset($btn.target) && $btn.target}target="_blank"{/if}{if isset($btn.js) && $btn.js}onclick="{$btn.js}"{/if}>
|
||||
<i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if} {if isset($btn.class)}{$btn.class}{/if}" ></i>
|
||||
<div {if isset($btn.force_desc) && $btn.force_desc == true } class="locked" {/if}>{$btn.desc}</div>
|
||||
</a>
|
||||
{if $k == 'modules-list'}
|
||||
<div class="modal fade" id="modules_list_container">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">{l s='Modules'}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="modules_list_container_tab" style="display:none;"></div>
|
||||
<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0"></div>
|
||||
</div>
|
||||
</div>
|
||||
<li>
|
||||
<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="toolbar_btn" {if isset($btn.href)}href="{$btn.href}"{/if} title="{$btn.desc}" {if isset($btn.target) && $btn.target}target="_blank"{/if}{if isset($btn.js) && $btn.js}onclick="{$btn.js}"{/if}>
|
||||
<i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if} {if isset($btn.class)}{$btn.class}{/if}" ></i>
|
||||
<div {if isset($btn.force_desc) && $btn.force_desc == true } class="locked" {/if}>{$btn.desc}</div>
|
||||
</a>
|
||||
{if $k == 'modules-list'}
|
||||
<div class="modal fade" id="modules_list_container">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 class="modal-title">{l s='Modules'}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="modules_list_container_tab" style="display:none;"></div>
|
||||
<div id="modules_list_loader"><img src="../img/loader.gif" alt=""/></div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
//<![CDATA[
|
||||
var submited = false
|
||||
var modules_list_loaded = false;
|
||||
$(function() {
|
||||
//get reference on save link
|
||||
btn_save = $('i[class~="process-icon-save"]').parent();
|
||||
<script language="javascript" type="text/javascript">
|
||||
//<![CDATA[
|
||||
var submited = false
|
||||
var modules_list_loaded = false;
|
||||
$(function() {
|
||||
//get reference on save link
|
||||
btn_save = $('i[class~="process-icon-save"]').parent();
|
||||
|
||||
//get reference on form submit button
|
||||
btn_submit = $('#{$table}_form_submit_btn');
|
||||
//get reference on form submit button
|
||||
btn_submit = $('#{$table}_form_submit_btn');
|
||||
|
||||
if (btn_save.length > 0 && btn_submit.length > 0)
|
||||
{
|
||||
//get reference on save and stay link
|
||||
btn_save_and_stay = $('i[class~="process-icon-save-and-stay"]').parent();
|
||||
|
||||
//get reference on current save link label
|
||||
lbl_save = $('#desc-{$table}-save div');
|
||||
|
||||
//override save link label with submit button value
|
||||
if (btn_submit.val().length > 0)
|
||||
lbl_save.html(btn_submit.attr("value"));
|
||||
|
||||
if (btn_save_and_stay.length > 0)
|
||||
if (btn_save.length > 0 && btn_submit.length > 0)
|
||||
{
|
||||
//get reference on save and stay link
|
||||
btn_save_and_stay = $('i[class~="process-icon-save-and-stay"]').parent();
|
||||
|
||||
//get reference on current save link label
|
||||
lbl_save_and_stay = $('#desc-{$table}-save-and-stay div');
|
||||
lbl_save = $('#desc-{$table}-save div');
|
||||
|
||||
//override save and stay link label with submit button value
|
||||
if (btn_submit.val().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked'))
|
||||
//override save link label with submit button value
|
||||
if (btn_submit.val().length > 0)
|
||||
lbl_save.html(btn_submit.attr("value"));
|
||||
|
||||
if (btn_save_and_stay.length > 0)
|
||||
{
|
||||
lbl_save_and_stay.html(btn_submit.val() + " {l s='and stay'} ");
|
||||
|
||||
//get reference on current save link label
|
||||
lbl_save_and_stay = $('#desc-{$table}-save-and-stay div');
|
||||
|
||||
//override save and stay link label with submit button value
|
||||
if (btn_submit.val().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked'))
|
||||
{
|
||||
lbl_save_and_stay.html(btn_submit.val() + " {l s='and stay'} ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//hide standard submit button
|
||||
btn_submit.hide();
|
||||
//bind enter key press to validate form
|
||||
$('#{$table}_form').keypress(function (e) {
|
||||
if (e.which == 13 && e.target.localName != 'textarea')
|
||||
$('#desc-{$table}-save').click();
|
||||
});
|
||||
//submit the form
|
||||
{block name=formSubmit}
|
||||
btn_save.click(function() {
|
||||
// Avoid double click
|
||||
if (submited)
|
||||
return false;
|
||||
submited = true;
|
||||
|
||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />');
|
||||
|
||||
$('#{$table}_form').submit();
|
||||
return false;
|
||||
//hide standard submit button
|
||||
btn_submit.hide();
|
||||
//bind enter key press to validate form
|
||||
$('#{$table}_form').keypress(function (e) {
|
||||
if (e.which == 13 && e.target.localName != 'textarea')
|
||||
$('#desc-{$table}-save').click();
|
||||
});
|
||||
|
||||
if (btn_save_and_stay)
|
||||
{
|
||||
btn_save_and_stay.click(function() {
|
||||
//submit the form
|
||||
{block name=formSubmit}
|
||||
btn_save.click(function() {
|
||||
// Avoid double click
|
||||
if (submited)
|
||||
return false;
|
||||
submited = true;
|
||||
|
||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />');
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />');
|
||||
|
||||
$('#{$table}_form').submit();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
{/block}
|
||||
|
||||
if (btn_save_and_stay)
|
||||
{
|
||||
btn_save_and_stay.click(function() {
|
||||
//add hidden input to emulate submit button click when posting the form -> field name posted
|
||||
btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />');
|
||||
|
||||
$('#{$table}_form').submit();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
{/block}
|
||||
}
|
||||
{if isset($tab_modules_open)}
|
||||
if ({$tab_modules_open})
|
||||
openModulesList();
|
||||
{/if}
|
||||
});
|
||||
{if isset($tab_modules_list)}
|
||||
$('.process-icon-modules-list').parent('a').unbind().bind('click', function (){
|
||||
openModulesList();
|
||||
});
|
||||
|
||||
function openModulesList()
|
||||
{
|
||||
$('#modules_list_container').modal('show');
|
||||
if (!modules_list_loaded)
|
||||
{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url : '{$admin_module_ajax_url}',
|
||||
async: true,
|
||||
data : {
|
||||
ajax : "1",
|
||||
controller : "AdminModules",
|
||||
action : "getTabModulesList",
|
||||
tab_modules_list : '{$tab_modules_list}',
|
||||
back_tab_modules_list : '{$back_tab_modules_list}'
|
||||
},
|
||||
success : function(data)
|
||||
{
|
||||
$('#modules_list_container_tab').html(data).slideDown();
|
||||
$('#modules_list_loader').hide();
|
||||
modules_list_loaded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#modules_list_container_tab').slideDown();
|
||||
$('#modules_list_loader').hide();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
{if isset($tab_modules_open)}
|
||||
if ({$tab_modules_open})
|
||||
openModulesList();
|
||||
{/if}
|
||||
});
|
||||
{if isset($tab_modules_list)}
|
||||
$('.process-icon-modules-list').parent('a').unbind().bind('click', function (){
|
||||
openModulesList();
|
||||
});
|
||||
|
||||
function openModulesList()
|
||||
{
|
||||
$('#modules_list_container').modal('show');
|
||||
if (!modules_list_loaded)
|
||||
{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url : '{$admin_module_ajax_url}',
|
||||
async: true,
|
||||
data : {
|
||||
ajax : "1",
|
||||
controller : "AdminModules",
|
||||
action : "getTabModulesList",
|
||||
tab_modules_list : '{$tab_modules_list}',
|
||||
back_tab_modules_list : '{$back_tab_modules_list}'
|
||||
},
|
||||
success : function(data)
|
||||
{
|
||||
$('#modules_list_container_tab').html(data).slideDown();
|
||||
$('#modules_list_loader').hide();
|
||||
modules_list_loaded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#modules_list_container_tab').slideDown();
|
||||
$('#modules_list_loader').hide();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
{/if}
|
||||
//]]>
|
||||
</script>
|
||||
{/block}
|
||||
//]]>
|
||||
</script>
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{block name=pageBreadcrumb}
|
||||
<ul class="breadcrumb hide">
|
||||
<li>
|
||||
{if $title}
|
||||
{foreach $title as $key => $item name=title}
|
||||
{* Use strip_tags because if the string already has been through htmlentities using escape will break it *}
|
||||
<span class="item-{$key} ">{$item|strip_tags}
|
||||
{if !$smarty.foreach.title.last}
|
||||
<img alt=">" style="margin-right:5px" src="../img/admin/separator_breadcrumb.png" />
|
||||
{/if}
|
||||
</span>
|
||||
{/foreach}
|
||||
{else}
|
||||
|
||||
{/if}
|
||||
</li>
|
||||
</ul>
|
||||
{/block}
|
||||
{block name=pageBreadcrumb}
|
||||
<ul class="breadcrumb hide">
|
||||
<li>
|
||||
{if $title}
|
||||
{foreach $title as $key => $item name=title}
|
||||
{* Use strip_tags because if the string already has been through htmlentities using escape will break it *}
|
||||
<span class="item-{$key} ">{$item|strip_tags}
|
||||
{if !$smarty.foreach.title.last}
|
||||
<img alt=">" style="margin-right:5px" src="../img/admin/separator_breadcrumb.png" />
|
||||
{/if}
|
||||
</span>
|
||||
{/foreach}
|
||||
{else}
|
||||
|
||||
{/if}
|
||||
</li>
|
||||
</ul>
|
||||
{/block}
|
||||
|
||||
Vendored
+2
@@ -25,6 +25,8 @@
|
||||
'AdminAttributesGroupsControllerCore' => 'controllers/admin/AdminAttributesGroupsController.php',
|
||||
'AdminBackupController' => '',
|
||||
'AdminBackupControllerCore' => 'controllers/admin/AdminBackupController.php',
|
||||
'AdminCarrierWizardController' => '',
|
||||
'AdminCarrierWizardControllerCore' => 'controllers/admin/AdminCarrierWizardController.php',
|
||||
'AdminCarriersController' => '',
|
||||
'AdminCarriersControllerCore' => 'controllers/admin/AdminCarriersController.php',
|
||||
'AdminCartRulesController' => '',
|
||||
|
||||
+4
-5
@@ -313,11 +313,10 @@ class AddressCore extends ObjectModel
|
||||
{
|
||||
$key = 'address_exists_'.(int)$id_address;
|
||||
if (!Cache::isStored($key))
|
||||
Cache::store(
|
||||
$key, Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `id_address`
|
||||
FROM '._DB_PREFIX_.'address a
|
||||
WHERE a.`id_address` = '.(int)$id_address));
|
||||
{
|
||||
$id_address = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_address` FROM '._DB_PREFIX_.'address a WHERE a.`id_address` = '.(int)$id_address);
|
||||
Cache::store($key, (bool)$id_address);
|
||||
}
|
||||
return Cache::retrieve($key);
|
||||
}
|
||||
|
||||
|
||||
+61
-13
@@ -165,6 +165,14 @@ class CarrierCore extends ObjectModel
|
||||
public function __construct($id = null, $id_lang = null)
|
||||
{
|
||||
parent::__construct($id, $id_lang);
|
||||
|
||||
/**
|
||||
* keep retrocompatibility SHIPPING_METHOD_DEFAULT
|
||||
* @deprecated 1.5.5
|
||||
*/
|
||||
if ($this->shipping_method == Carrier::SHIPPING_METHOD_DEFAULT)
|
||||
$this->shipping_method = ((int)Configuration::get('PS_SHIPPING_METHOD') ? Carrier::SHIPPING_METHOD_WEIGHT : Carrier::SHIPPING_METHOD_PRICE);
|
||||
|
||||
/**
|
||||
* keep retrocompatibility id_tax_rules_group
|
||||
* @deprecated 1.5.0
|
||||
@@ -370,13 +378,12 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public static function getDeliveryPriceByRanges($range_table, $id_carrier)
|
||||
{
|
||||
$range_table = pSQL($range_table);
|
||||
$sql = 'SELECT d.id_'.$range_table.', d.id_carrier, d.id_zone, d.price
|
||||
$sql = 'SELECT d.`id_'.bqSQL($range_table).'`, d.id_carrier, d.id_zone, d.price
|
||||
FROM '._DB_PREFIX_.'delivery d
|
||||
LEFT JOIN '._DB_PREFIX_.$range_table.' r ON r.id_'.$range_table.' = d.id_'.$range_table.'
|
||||
LEFT JOIN `'._DB_PREFIX_.bqSQL($range_table).'` r ON r.`id_'.bqSQL($range_table).'` = d.`id_'.bqSQL($range_table).'`
|
||||
WHERE d.id_carrier = '.(int)$id_carrier.'
|
||||
AND d.id_'.$range_table.' IS NOT NULL
|
||||
AND d.id_'.$range_table.' != 0
|
||||
AND d.`id_'.bqSQL($range_table).'` IS NOT NULL
|
||||
AND d.`id_'.bqSQL($range_table).'` != 0
|
||||
'.Carrier::sqlDeliveryRangeShop($range_table).'
|
||||
ORDER BY r.delimiter1';
|
||||
return Db::getInstance()->executeS($sql);
|
||||
@@ -456,6 +463,22 @@ class CarrierCore extends ObjectModel
|
||||
return $carriers;
|
||||
}
|
||||
|
||||
public static function getIdTaxRulesGroupMostUsed()
|
||||
{
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT id_tax_rules_group
|
||||
FROM (
|
||||
SELECT COUNT(*) n, c.id_tax_rules_group
|
||||
FROM '._DB_PREFIX_.'carrier c
|
||||
JOIN '._DB_PREFIX_.'tax_rules_group trg ON (c.id_tax_rules_group = trg.id_tax_rules_group)
|
||||
WHERE trg.active = 1
|
||||
GROUP BY c.id_tax_rules_group
|
||||
ORDER BY n DESC
|
||||
LIMIT 1
|
||||
) most_used'
|
||||
);
|
||||
}
|
||||
|
||||
public static function getDeliveredCountries($id_lang, $active_countries = false, $active_carriers = false, $contain_states = null)
|
||||
{
|
||||
if (!Validate::isBool($active_countries) || !Validate::isBool($active_carriers))
|
||||
@@ -712,7 +735,7 @@ class CarrierCore extends ObjectModel
|
||||
*/
|
||||
public function deleteDeliveryPrice($range_table)
|
||||
{
|
||||
$where = '`id_carrier` = '.(int)$this->id.' AND (`id_'.$range_table.'` IS NOT NULL OR `id_'.$range_table.'` = 0) ';
|
||||
$where = '`id_carrier` = '.(int)$this->id.' AND (`id_'.bqSQL($range_table).'` IS NOT NULL OR `id_'.bqSQL($range_table).'` = 0) ';
|
||||
|
||||
if (Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
$where .= 'AND id_shop IS NULL AND id_shop_group IS NULL';
|
||||
@@ -730,7 +753,7 @@ class CarrierCore extends ObjectModel
|
||||
* @param array $priceList Prices list in multiple arrays (changed to array since 1.5.0)
|
||||
* @return boolean Insertion result
|
||||
*/
|
||||
public function addDeliveryPrice($price_list)
|
||||
public function addDeliveryPrice($price_list, $delete = false)
|
||||
{
|
||||
if (!$price_list)
|
||||
return false;
|
||||
@@ -749,6 +772,17 @@ class CarrierCore extends ObjectModel
|
||||
if (!isset($values['id_shop_group']))
|
||||
$values['id_shop_group'] = (Shop::getContext() != Shop::CONTEXT_ALL) ? Shop::getContextShopGroupID() : null;
|
||||
|
||||
if ($delete)
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'delivery`
|
||||
WHERE id_shop = '.(int)$values['id_shop'].'
|
||||
AND id_shop_group='.(int)$values['id_shop_group'].'
|
||||
AND id_carrier='.(int)$values['id_carrier'].
|
||||
($values['id_range_price'] !== null ? ' AND id_range_price='.(int)$values['id_range_price'] : '').
|
||||
($values['id_range_weight'] !== null ? ' AND id_range_weight='.(int)$values['id_range_weight'] : '').'
|
||||
AND id_zone='.(int)$values['id_zone']
|
||||
);
|
||||
|
||||
$sql .= '(';
|
||||
foreach ($values as $v)
|
||||
{
|
||||
@@ -912,9 +946,11 @@ class CarrierCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getRangeObject()
|
||||
public function getRangeObject($shipping_method = false)
|
||||
{
|
||||
$shipping_method = $this->getShippingMethod();
|
||||
if (!$shipping_method)
|
||||
$shipping_method = $this->getShippingMethod();
|
||||
|
||||
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT)
|
||||
return new RangeWeight();
|
||||
elseif ($shipping_method == Carrier::SHIPPING_METHOD_PRICE)
|
||||
@@ -1032,9 +1068,9 @@ class CarrierCore extends ObjectModel
|
||||
$sql = 'AND '.$alias.'.id_delivery = (
|
||||
SELECT d2.id_delivery
|
||||
FROM '._DB_PREFIX_.'delivery d2
|
||||
WHERE d2.id_carrier = '.$alias.'.id_carrier
|
||||
AND d2.id_zone = '.$alias.'.id_zone
|
||||
AND d2.id_'.$range_table.' = '.$alias.'.id_'.$range_table.'
|
||||
WHERE d2.id_carrier = `'.bqSQL($alias).'`.id_carrier
|
||||
AND d2.id_zone = `'.bqSQL($alias).'`.id_zone
|
||||
AND d2.`id_'.bqSQL($range_table).'` = `'.bqSQL($alias).'`.`id_'.bqSQL($range_table).'`
|
||||
'.$where.'
|
||||
ORDER BY d2.id_shop DESC, d2.id_shop_group DESC
|
||||
LIMIT 1
|
||||
@@ -1250,5 +1286,17 @@ class CarrierCore extends ObjectModel
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function setGroups($groups, $delete = true)
|
||||
{
|
||||
if ($delete)
|
||||
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$this->id);
|
||||
if (!count($groups))
|
||||
return true;
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'carrier_group (id_carrier, id_group) VALUES ';
|
||||
foreach ($groups as $id_group)
|
||||
$sql .= '('.(int)$this->id.', '.(int)$id_group.'),';
|
||||
|
||||
return Db::getInstance()->execute(rtrim($sql, ','));
|
||||
}
|
||||
}
|
||||
|
||||
+16
-11
@@ -134,6 +134,7 @@ class CartCore extends ObjectModel
|
||||
'cart_rows' => array('resource' => 'cart_row', 'virtual_entity' => true, 'fields' => array(
|
||||
'id_product' => array('required' => true, 'xlink_resource' => 'products'),
|
||||
'id_product_attribute' => array('required' => true, 'xlink_resource' => 'combinations'),
|
||||
'id_address_delivery' => array('required' => true, 'xlink_resource' => 'addresses'),
|
||||
'quantity' => array('required' => true),
|
||||
)
|
||||
),
|
||||
@@ -209,7 +210,7 @@ class CartCore extends ObjectModel
|
||||
if (!isset($this->id_address_invoice) || $this->id_address_invoice == $id_address)
|
||||
{
|
||||
$to_update = true;
|
||||
$this->context->cart->id_address_invoice = $id_address_new;
|
||||
$this->id_address_invoice = $id_address_new;
|
||||
}
|
||||
if (!isset($this->id_address_delivery) || $this->id_address_delivery == $id_address)
|
||||
{
|
||||
@@ -764,6 +765,9 @@ class CartCore extends ObjectModel
|
||||
if (!Validate::isLoadedObject($cartRule))
|
||||
return false;
|
||||
|
||||
if (Db::getInstance()->getValue('SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$this->id))
|
||||
return false;
|
||||
|
||||
// Add the cart rule to the cart
|
||||
if (!Db::getInstance()->insert('cart_cart_rule', array(
|
||||
'id_cart_rule' => (int)$id_cart_rule,
|
||||
@@ -3030,8 +3034,10 @@ class CartCore extends ObjectModel
|
||||
public function addTextFieldToProduct($id_product, $index, $type, $text_value)
|
||||
{
|
||||
$text_value = str_replace(array("\n", "\r"), '', nl2br($text_value));
|
||||
$text_value = str_replace('\\', '\\\\', $text_value);
|
||||
$text_value = str_replace('\'', '\\\'', $text_value);
|
||||
if (!_PS_MAGIC_QUOTES_GPC_){
|
||||
$text_value = str_replace('\\', '\\\\', $text_value);
|
||||
$text_value = str_replace('\'', '\\\'', $text_value);
|
||||
}
|
||||
return $this->_addCustomization($id_product, 0, $index, $type, $text_value, 0);
|
||||
}
|
||||
|
||||
@@ -3207,25 +3213,24 @@ class CartCore extends ObjectModel
|
||||
|
||||
public function getWsCartRows()
|
||||
{
|
||||
$query = '
|
||||
return Db::getInstance()->executeS('
|
||||
SELECT id_product, id_product_attribute, quantity
|
||||
FROM `'._DB_PREFIX_.'cart_product`
|
||||
WHERE id_cart = '.(int)$this->id.'
|
||||
AND id_shop = '.(int)Context::getContext()->shop->id;
|
||||
|
||||
$result = Db::getInstance()->executeS($query);
|
||||
return $result;
|
||||
WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id
|
||||
);
|
||||
}
|
||||
|
||||
public function setWsCartRows($values)
|
||||
{
|
||||
if ($this->deleteAssociations())
|
||||
{
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `quantity`, `date_add`, `id_shop`) VALUES ';
|
||||
$query = 'INSERT INTO `'._DB_PREFIX_.'cart_product`(`id_cart`, `id_product`, `id_product_attribute`, `id_address_delivery`, `quantity`, `date_add`, `id_shop`) VALUES ';
|
||||
|
||||
foreach ($values as $value)
|
||||
$query .= '('.(int)$this->id.', '.(int)$value['id_product'].', '.
|
||||
(isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '.(int)$value['quantity'].', NOW(), '.(int)Context::getContext()->shop->id.'),';
|
||||
(isset($value['id_product_attribute']) ? (int)$value['id_product_attribute'] : 'NULL').', '.
|
||||
(isset($value['id_address_delivery']) ? (int)$value['id_address_delivery'] : 0).', '.
|
||||
(int)$value['quantity'].', NOW(), '.(int)Context::getContext()->shop->id.'),';
|
||||
|
||||
Db::getInstance()->execute(rtrim($query, ','));
|
||||
}
|
||||
|
||||
+9
-31
@@ -10,7 +10,7 @@
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy 502immediately.
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
@@ -495,36 +495,14 @@ class CartRuleCore extends ObjectModel
|
||||
$cartTotal = $context->cart->getOrderTotal($this->minimum_amount_tax, Cart::ONLY_PRODUCTS);
|
||||
if ($this->minimum_amount_shipping)
|
||||
$cartTotal += $context->cart->getOrderTotal($this->minimum_amount_tax, Cart::ONLY_SHIPPING);
|
||||
$products = $context->cart->getProducts();
|
||||
$cart_rules = $context->cart->getCartRules();
|
||||
|
||||
// If a product is given for free in this rule and already in the cart, the price is subtracted
|
||||
if ($this->gift_product && $alreadyInCart)
|
||||
{
|
||||
$query = new DbQuery();
|
||||
|
||||
$query->select('id_product');
|
||||
$query->from('cart_product');
|
||||
$query->where('id_product = '.(int)$this->gift_product);
|
||||
$query->where('id_cart = '.(int)$context->cart->id);
|
||||
|
||||
if ((int)$this->gift_product_attribute)
|
||||
$query->where('id_product_attribute = '.(int)$this->gift_product_attribute);
|
||||
|
||||
if (Db::getInstance()->getValue($query))
|
||||
{
|
||||
$ref = false;
|
||||
$product_price = Product::getPriceStatic(
|
||||
$this->gift_product,
|
||||
$this->minimum_amount_tax,
|
||||
$this->gift_product_attribute,
|
||||
null, null, false, true, 1, null,
|
||||
$context->cart->id_customer ? $context->cart->id_customer : null,
|
||||
$context->cart->id,
|
||||
(int)$context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} ? (int)$context->cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')} : null,
|
||||
$ref, true, true, $context, true
|
||||
);
|
||||
$cartTotal -= $product_price;
|
||||
}
|
||||
}
|
||||
foreach ($cart_rules as &$cart_rule)
|
||||
if ($cart_rule['gift_product'])
|
||||
foreach ($products as $key => &$product)
|
||||
if (empty($product['gift']) && $product['id_product'] == $cart_rule['gift_product'] && $product['id_product_attribute'] == $cart_rule['gift_product_attribute'])
|
||||
$cartTotal = Tools::ps_round($cartTotal - $product[$this->minimum_amount_tax ? 'price_wt' : 'price'], (int)$context->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
|
||||
|
||||
if ($cartTotal < $minimum_amount)
|
||||
return (!$display_error) ? false : Tools::displayError('You have not reached the minimum amount required to use this voucher');
|
||||
@@ -1130,7 +1108,7 @@ class CartRuleCore extends ObjectModel
|
||||
WHERE `id_cart` = '.(int)$context->cart->id.'
|
||||
)
|
||||
)
|
||||
AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$context->cart->id.')
|
||||
AND cr.id_cart_rule NOT IN (SELECT id_cart_rule FROM '._DB_PREFIX_.'cart_cart_rule WHERE id_cart = '.(int)$context->cart->id.')
|
||||
ORDER BY priority';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
if ($result)
|
||||
|
||||
@@ -74,6 +74,16 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
||||
* @var int Total of elements for iteration
|
||||
*/
|
||||
protected $total;
|
||||
|
||||
/**
|
||||
* @var int Page number
|
||||
*/
|
||||
protected $page_number = 0;
|
||||
|
||||
/**
|
||||
* @var int Size of a page
|
||||
*/
|
||||
protected $page_size = 0;
|
||||
|
||||
protected $fields = array();
|
||||
protected $alias = array();
|
||||
@@ -334,6 +344,11 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// All limit clause
|
||||
if ($this->page_size)
|
||||
$this->query->limit($this->page_size, $this->page_number * $this->page_size);
|
||||
|
||||
|
||||
// Shall we display query for debug ?
|
||||
if ($display_query)
|
||||
@@ -659,6 +674,34 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
||||
}
|
||||
return $this->fields[$field];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the page number
|
||||
*
|
||||
* @param int $page_number
|
||||
* @return Collection
|
||||
*/
|
||||
public function setPageNumber($page_number)
|
||||
{
|
||||
$page_number = (int)$page_number;
|
||||
if ($page_number > 0)
|
||||
$page_number--;
|
||||
|
||||
$this->page_number = $page_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the nuber of item per page
|
||||
*
|
||||
* @param int $page_size
|
||||
* @return Collection
|
||||
*/
|
||||
public function setPageSize($page_size)
|
||||
{
|
||||
$this->page_size = (int)$page_size;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate uniq alias from association name
|
||||
|
||||
@@ -49,7 +49,6 @@ class ConfigurationTestCore
|
||||
'mysql_support' => false,
|
||||
'config_dir' => 'config',
|
||||
'cache_dir' => 'cache',
|
||||
'sitemap' => 'sitemap.xml',
|
||||
'log_dir' => 'log',
|
||||
'img_dir' => 'img',
|
||||
'mails_dir' => 'mails',
|
||||
|
||||
@@ -298,7 +298,11 @@ class CookieCore
|
||||
|
||||
//checks if the language exists, if not choose the default language
|
||||
if (!$this->_standalone && !Language::getLanguage((int)$this->id_lang))
|
||||
{
|
||||
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
// set detect_language to force going through Tools::setCookieLanguage to figure out browser lang
|
||||
$this->detect_language = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+33
-19
@@ -126,7 +126,9 @@ class HookCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'hook_alias` ha
|
||||
INNER JOIN `'._DB_PREFIX_.'hook` h ON ha.name = h.name');
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$hook_ids[$row['name']] = $row['id_hook'];
|
||||
}
|
||||
Cache::store($cache_id, $hook_ids);
|
||||
}
|
||||
else
|
||||
@@ -147,9 +149,23 @@ class HookCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'hook`
|
||||
WHERE `id_hook` = '.(int)$hook_id)
|
||||
);
|
||||
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return hook live edit bool from ID
|
||||
*/
|
||||
public static function getLiveEditById($hook_id)
|
||||
{
|
||||
$cache_id = 'hook_live_editbyid_'.$hook_id;
|
||||
if (!Cache::isStored($cache_id))
|
||||
Cache::store($cache_id, Db::getInstance()->getValue('
|
||||
SELECT `live_edit`
|
||||
FROM `'._DB_PREFIX_.'hook`
|
||||
WHERE `id_hook` = '.(int)$hook_id)
|
||||
);
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of hook alias
|
||||
@@ -315,15 +331,9 @@ class HookCore extends ObjectModel
|
||||
|
||||
$sql->orderBy('hm.`position`');
|
||||
|
||||
// Store results per hook name
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$list = array();
|
||||
|
||||
// Get all available payment module
|
||||
$payment_modules = array();
|
||||
|
||||
if ($results)
|
||||
foreach ($results as $row)
|
||||
if ($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$row['hook'] = strtolower($row['hook']);
|
||||
if (!isset($list[$row['hook']]))
|
||||
@@ -353,14 +363,17 @@ class HookCore extends ObjectModel
|
||||
$hook_name = strtolower($hook_name);
|
||||
|
||||
$return = array();
|
||||
$inserted_modules = array();
|
||||
if (isset($list[$hook_name]))
|
||||
$return = $list[$hook_name];
|
||||
foreach ($return as $module)
|
||||
$inserted_modules[] = $module['id_module'];
|
||||
if (isset($list[$retro_hook_name]))
|
||||
$return = array_merge($return, $list[$retro_hook_name]);
|
||||
foreach ($list[$retro_hook_name] as $retro_module_call)
|
||||
if (!in_array($retro_module_call['id_module'], $inserted_modules))
|
||||
$return[] = $retro_module_call;
|
||||
|
||||
if (count($return) > 0)
|
||||
return $return;
|
||||
return false;
|
||||
return (count($return) > 0 ? $return : false);
|
||||
}
|
||||
else
|
||||
return $list;
|
||||
@@ -404,6 +417,7 @@ class HookCore extends ObjectModel
|
||||
// Look on modules list
|
||||
$altern = 0;
|
||||
$output = '';
|
||||
|
||||
foreach ($module_list as $array)
|
||||
{
|
||||
// Check errors
|
||||
@@ -417,7 +431,7 @@ class HookCore extends ObjectModel
|
||||
{
|
||||
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
||||
$controller = Dispatcher::getInstance()->getController();
|
||||
|
||||
|
||||
if (in_array($controller, $exceptions))
|
||||
continue;
|
||||
|
||||
@@ -425,7 +439,7 @@ class HookCore extends ObjectModel
|
||||
$matching_name = array(
|
||||
'authentication' => 'auth',
|
||||
'compare' => 'products-comparison',
|
||||
);
|
||||
);
|
||||
if (isset($matching_name[$controller]) && in_array($matching_name[$controller], $exceptions))
|
||||
continue;
|
||||
if (Validate::isLoadedObject($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
||||
@@ -459,7 +473,7 @@ class HookCore extends ObjectModel
|
||||
if ($array_return)
|
||||
return $output;
|
||||
else
|
||||
return ($live_edit ? '<script type="text/javascript">hooks_list.push(\''.$hook_name.'\'); </script>
|
||||
return ($live_edit ? '<script type="text/javascript">hooks_list.push(\''.$hook_name.'\');</script>
|
||||
<div id="'.$hook_name.'" class="dndHook" style="min-height:50px">' : '').$output.($live_edit ? '</div>' : '');// Return html string
|
||||
}
|
||||
|
||||
@@ -468,13 +482,13 @@ class HookCore extends ObjectModel
|
||||
return '<script type="text/javascript"> modules_list.push(\''.Tools::safeOutput($moduleInstance->name).'\');</script>
|
||||
<div id="hook_'.(int)$id_hook.'_module_'.(int)$moduleInstance->id.'_moduleName_'.str_replace('_', '-', Tools::safeOutput($moduleInstance->name)).'"
|
||||
class="dndModule" style="border: 1px dotted red;'.(!strlen($display) ? 'height:50px;' : '').'">
|
||||
<span style="font-family: Georgia;font-size:13px;font-style:italic;">
|
||||
<img style="padding-right:5px;" src="'._MODULE_DIR_.Tools::safeOutput($moduleInstance->name).'/logo.gif">'
|
||||
<span style="font-family: Georgia;font-size:13px;font-style:italic;">
|
||||
<img style="padding-right:5px;" src="'._MODULE_DIR_.Tools::safeOutput($moduleInstance->name).'/logo.gif">'
|
||||
.Tools::safeOutput($moduleInstance->displayName).'<span style="float:right">
|
||||
<a href="#" id="'.(int)$id_hook.'_'.(int)$moduleInstance->id.'" class="moveModule">
|
||||
<img src="'._PS_ADMIN_IMG_.'arrow_out.png"></a>
|
||||
<a href="#" id="'.(int)$id_hook.'_'.(int)$moduleInstance->id.'" class="unregisterHook">
|
||||
<img src="'._PS_ADMIN_IMG_.'delete.gif"></span></a>
|
||||
<img src="'._PS_ADMIN_IMG_.'delete.gif"></a></span>
|
||||
</span>'.$display.'</div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -407,6 +407,7 @@ class ImageManagerCore
|
||||
case 'jpeg':
|
||||
default:
|
||||
$quality = (Configuration::get('PS_JPEG_QUALITY') === false ? 90 : Configuration::get('PS_JPEG_QUALITY'));
|
||||
imageinterlace($resource,1); /// make it PROGRESSIVE
|
||||
$success = imagejpeg($resource, $filename, (int)$quality);
|
||||
break;
|
||||
}
|
||||
|
||||
+25
-31
@@ -192,7 +192,7 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
public function add($autodate = true, $nullValues = false, $only_add = false)
|
||||
{
|
||||
if (!parent::add($autodate))
|
||||
if (!parent::add($autodate, $nullValues))
|
||||
return false;
|
||||
|
||||
if ($only_add)
|
||||
@@ -202,10 +202,9 @@ class LanguageCore extends ObjectModel
|
||||
$this->_generateFiles();
|
||||
|
||||
// @todo Since a lot of modules are not in right format with their primary keys name, just get true ...
|
||||
$resUpdateSQL = $this->loadUpdateSQL();
|
||||
$resUpdateSQL = true;
|
||||
Tools::generateHtaccess();
|
||||
return $resUpdateSQL;
|
||||
$this->loadUpdateSQL();
|
||||
|
||||
return Tools::generateHtaccess();
|
||||
}
|
||||
|
||||
public function toggleStatus()
|
||||
@@ -488,7 +487,8 @@ class LanguageCore extends ObjectModel
|
||||
// Files deletion
|
||||
foreach (Language::getFilesList($this->iso_code, _THEME_NAME_, false, false, false, true, true) as $key => $file)
|
||||
if (file_exists($key))
|
||||
unlink($key);
|
||||
unlink($key);
|
||||
|
||||
$modList = scandir(_PS_MODULE_DIR_);
|
||||
foreach ($modList as $mod)
|
||||
{
|
||||
@@ -510,37 +510,32 @@ class LanguageCore extends ObjectModel
|
||||
Language::recurseDeleteDir(_PS_MAIL_DIR_.$this->iso_code);
|
||||
if (file_exists(_PS_TRANSLATIONS_DIR_.$this->iso_code))
|
||||
Language::recurseDeleteDir(_PS_TRANSLATIONS_DIR_.$this->iso_code);
|
||||
}
|
||||
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
|
||||
{
|
||||
// delete images
|
||||
$files_copy = array(
|
||||
'/en.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('thickbox').'.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('home').'.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('large').'.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('medium').'.jpg',
|
||||
'/en-default-'.ImageType::getFormatedName('small').'.jpg'
|
||||
|
||||
$images = array(
|
||||
'.jpg',
|
||||
'-default-'.ImageType::getFormatedName('thickbox').'.jpg',
|
||||
'-default-'.ImageType::getFormatedName('home').'.jpg',
|
||||
'-default-'.ImageType::getFormatedName('large').'.jpg',
|
||||
'-default-'.ImageType::getFormatedName('medium').'.jpg',
|
||||
'-default-'.ImageType::getFormatedName('small').'.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)
|
||||
$image_directories = array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_);
|
||||
foreach ($images_directories as $image_directory)
|
||||
foreach ($images as $image)
|
||||
{
|
||||
$name = str_replace('/en', ''.$this->iso_code, $file);
|
||||
|
||||
if (file_exists($to.$name))
|
||||
unlink($to.$name);
|
||||
if (file_exists($image_directory.$this->iso_code.$image))
|
||||
unlink($image_directory.$this->iso_code.$image);
|
||||
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
|
||||
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
if (!parent::delete())
|
||||
return false;
|
||||
|
||||
return Tools::generateHtaccess();
|
||||
}
|
||||
|
||||
|
||||
public function deleteSelection($selection)
|
||||
{
|
||||
if (!is_array($selection))
|
||||
@@ -549,11 +544,10 @@ class LanguageCore extends ObjectModel
|
||||
$result = true;
|
||||
foreach ($selection as $id)
|
||||
{
|
||||
$this->id = (int)($id);
|
||||
$result = $result && $this->delete();
|
||||
$language = new Language($id);
|
||||
$result = $result && $language->delete();
|
||||
}
|
||||
|
||||
Tools::generateHtaccess();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -91,10 +91,10 @@ class LinkCore
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
if ($id_shop === null)
|
||||
$shop = Context::getContext()->shop;
|
||||
else
|
||||
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null)
|
||||
$shop = new Shop($id_shop);
|
||||
else
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$url = 'http://'.$shop->domain.$shop->getBaseURI().$this->getLangLink($id_lang);
|
||||
|
||||
|
||||
@@ -70,8 +70,16 @@ class LocalizationPackCore
|
||||
return $res;
|
||||
}
|
||||
foreach ($selection as $selected)
|
||||
if (!Validate::isLocalizationPackSelection($selected) || !$this->{'_install'.ucfirst($selected)}($xml))
|
||||
return false;
|
||||
if (strtolower((string)$selected) == 'currencies')
|
||||
{
|
||||
if (!Validate::isLocalizationPackSelection($selected) || !$this->{'_install'.ucfirst($selected)}($xml, true))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Validate::isLocalizationPackSelection($selected) || !$this->{'_install'.ucfirst($selected)}($xml))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -239,8 +247,6 @@ class LocalizationPackCore
|
||||
{
|
||||
if (isset($xml->currencies->currency))
|
||||
{
|
||||
|
||||
|
||||
foreach ($xml->currencies->currency as $data)
|
||||
{
|
||||
$attributes = $data->attributes();
|
||||
|
||||
+12
-3
@@ -52,7 +52,8 @@ class MailCore
|
||||
* @param bool $die
|
||||
*/
|
||||
public static function Send($id_lang, $template, $subject, $template_vars, $to,
|
||||
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
|
||||
$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,
|
||||
$template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
|
||||
{
|
||||
$configuration = Configuration::getMultiple(array(
|
||||
'PS_SHOP_EMAIL',
|
||||
@@ -146,7 +147,10 @@ class MailCore
|
||||
if ($to_name == null)
|
||||
$to_name = $addr;
|
||||
/* Encode accentuated chars */
|
||||
$to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||
if (function_exists('mb_encode_mimeheader'))
|
||||
$to_list->addTo($addr, mb_encode_mimeheader($to_name, 'utf-8'));
|
||||
else
|
||||
$to_list->addTo($addr, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||
}
|
||||
$to_plugin = $to[0];
|
||||
$to = $to_list;
|
||||
@@ -155,7 +159,10 @@ class MailCore
|
||||
$to_plugin = $to;
|
||||
if ($to_name == null)
|
||||
$to_name = $to;
|
||||
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||
if (function_exists('mb_encode_mimeheader'))
|
||||
$to = new Swift_Address($to, mb_encode_mimeheader($to_name, 'utf-8'));
|
||||
else
|
||||
$to = new Swift_Address($to, '=?UTF-8?B?'.base64_encode($to_name).'?=');
|
||||
}
|
||||
try {
|
||||
/* Connect with the appropriate configuration */
|
||||
@@ -230,6 +237,8 @@ class MailCore
|
||||
/* Create mail and attach differents parts */
|
||||
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
|
||||
|
||||
$message->setCharset('utf-8');
|
||||
|
||||
/* Set Message-ID - getmypid() is blocked on some hosting */
|
||||
$message->setId(Mail::generateId());
|
||||
|
||||
|
||||
+10
-2
@@ -224,7 +224,7 @@ class MediaCore
|
||||
$url_data = parse_url($css_uri);
|
||||
$file_uri = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']);
|
||||
// check if css files exists
|
||||
if (!@filemtime($file_uri))
|
||||
if (!@filemtime($file_uri) && !array_key_exists('host', $url_data))
|
||||
return false;
|
||||
|
||||
if (Context::getContext()->controller->controller_type == 'admin')
|
||||
@@ -386,6 +386,7 @@ class MediaCore
|
||||
{
|
||||
//inits
|
||||
$css_files_by_media = array();
|
||||
$external_css_files = array();
|
||||
$compressed_css_files = array();
|
||||
$compressed_css_files_not_found = array();
|
||||
$compressed_css_files_infos = array();
|
||||
@@ -400,6 +401,13 @@ class MediaCore
|
||||
$infos = array();
|
||||
$infos['uri'] = $filename;
|
||||
$url_data = parse_url($filename);
|
||||
|
||||
if(array_key_exists('host', $url_data))
|
||||
{
|
||||
$external_css_files[$filename] = $media;
|
||||
continue;
|
||||
}
|
||||
|
||||
$infos['path'] = _PS_ROOT_DIR_.Tools::str_replace_once(__PS_BASE_URI__, '/', $url_data['path']);
|
||||
$css_files_by_media[$media]['files'][] = $infos;
|
||||
if (!array_key_exists('date', $css_files_by_media[$media]))
|
||||
@@ -461,7 +469,7 @@ class MediaCore
|
||||
$url = str_replace(_PS_THEME_DIR_, _THEMES_DIR_._THEME_NAME_.'/', $filename);
|
||||
$css_files[$protocol_link.Tools::getMediaServer($url).$url] = $media;
|
||||
}
|
||||
return $css_files;
|
||||
return array_merge($external_css_files, $css_files);
|
||||
}
|
||||
|
||||
public static function getBackTrackLimit()
|
||||
|
||||
+29
-24
@@ -535,28 +535,28 @@ abstract class ObjectModelCore
|
||||
return false;
|
||||
|
||||
$object_id = Db::getInstance()->Insert_ID();
|
||||
|
||||
|
||||
if (isset($definition['multilang']) && $definition['multilang'])
|
||||
{
|
||||
$res = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.bqSQL($definition['table']).'_lang`
|
||||
WHERE `'.bqSQL($definition['primary']).'` = '.(int)$this->id
|
||||
);
|
||||
|
||||
if (!$res)
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.bqSQL($definition['table']).'_lang`
|
||||
WHERE `'.bqSQL($definition['primary']).'` = '.(int)$this->id);
|
||||
if (!$result)
|
||||
return false;
|
||||
|
||||
foreach ($res as $field => &$value)
|
||||
if (isset($definition['fields'][$field]))
|
||||
$value = ObjectModel::formatValue($value, $definition['fields'][$field]['type']);
|
||||
|
||||
foreach ($res as $row)
|
||||
|
||||
foreach ($result as &$row)
|
||||
foreach ($row as $field => &$value)
|
||||
if (isset($definition['fields'][$field]))
|
||||
$value = ObjectModel::formatValue($value, $definition['fields'][$field]['type']);
|
||||
|
||||
// Keep $row2, you cannot use $row because there is an unexplicated conflict with the previous usage of this variable
|
||||
foreach ($result as $row2)
|
||||
{
|
||||
$row[$definition['primary']] = (int)$object_id;
|
||||
if (!Db::getInstance()->insert($definition['table'].'_lang', $row))
|
||||
$row2[$definition['primary']] = (int)$object_id;
|
||||
if (!Db::getInstance()->insert($definition['table'].'_lang', $row2))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object_duplicated = new $definition['classname']((int)$object_id);
|
||||
@@ -857,8 +857,12 @@ abstract class ObjectModelCore
|
||||
continue;
|
||||
|
||||
$values = $this->$field;
|
||||
|
||||
// If the object has not been loaded in multilanguage, then the value is the one for the current language of the object
|
||||
if (!is_array($values))
|
||||
$values = array($this->id_lang => $values);
|
||||
|
||||
// The value for the default must always be set, so we put an empty string if it does not exists
|
||||
if (!isset($values[Configuration::get('PS_LANG_DEFAULT')]))
|
||||
$values[Configuration::get('PS_LANG_DEFAULT')] = '';
|
||||
|
||||
@@ -979,17 +983,18 @@ abstract class ObjectModelCore
|
||||
$required_fields_database = (isset(self::$fieldsRequiredDatabase[get_class($this)])) ? self::$fieldsRequiredDatabase[get_class($this)] : array();
|
||||
foreach ($this->def['fields'] as $field => $data)
|
||||
{
|
||||
$value = Tools::getValue($field, $this->{$field});
|
||||
// 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 (isset($data['required']) && $data['required'] && empty($value) && $value !== '0')
|
||||
if (!$this->id || $field != 'passwd')
|
||||
$errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is required.');
|
||||
|
||||
// Checking for maximum fields sizes
|
||||
if (isset($data['size']) && ($value = Tools::getValue($field, $this->{$field})) && Tools::strlen($value) > $data['size'])
|
||||
if (isset($data['size']) && !empty($value) && Tools::strlen($value) > $data['size'])
|
||||
$errors[$field] = sprintf(
|
||||
Tools::displayError('%1$s is too long. Maximum length: %2$d'),
|
||||
self::displayFieldName($field, get_class($this), $htmlentities),
|
||||
@@ -998,7 +1003,7 @@ abstract class ObjectModelCore
|
||||
|
||||
// Checking for fields validity
|
||||
// Hack for postcode required for country which does not have postcodes
|
||||
if (($value = Tools::getValue($field, $this->{$field})) || ($field == 'postcode' && $value == '0'))
|
||||
if (!empty($value) || $value === '0' || ($field == 'postcode' && $value == '0'))
|
||||
{
|
||||
if (isset($data['validate']) && !Validate::$data['validate']($value) && (!empty($value) || $data['required']))
|
||||
$errors[$field] = '<b>'.self::displayFieldName($field, get_class($this), $htmlentities).'</b> '.Tools::displayError('is invalid.');
|
||||
@@ -1322,7 +1327,7 @@ abstract class ObjectModelCore
|
||||
* @param string $specific_where Only executed for common table
|
||||
* @return bool
|
||||
*/
|
||||
public static function updateMultishopTable($classname, $data, $where, $specific_where = '')
|
||||
public static function updateMultishopTable($classname, $data, $where = '', $specific_where = '')
|
||||
{
|
||||
$def = ObjectModel::getDefinition($classname);
|
||||
$update_data = array();
|
||||
@@ -1342,8 +1347,8 @@ abstract class ObjectModelCore
|
||||
|
||||
$sql = 'UPDATE '._DB_PREFIX_.$def['table'].' a
|
||||
'.Shop::addSqlAssociation($def['table'], 'a', true, null, true).'
|
||||
SET '.implode(', ', $update_data).'
|
||||
WHERE '.$where;
|
||||
SET '.implode(', ', $update_data).
|
||||
(!empty($where) ? ' WHERE '.$where : '');
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
|
||||
@@ -1632,4 +1637,4 @@ abstract class ObjectModelCore
|
||||
{
|
||||
$this->update_fields = $fields;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,7 +348,8 @@ abstract class PaymentModuleCore extends Module
|
||||
// Construct order detail table for the email
|
||||
$products_list = '';
|
||||
$virtual_product = true;
|
||||
foreach ($products as $key => $product)
|
||||
|
||||
foreach ($order->product_list as $key => $product)
|
||||
{
|
||||
$price = Product::getPriceStatic((int)$product['id_product'], false, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$price_wt = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
@@ -604,7 +605,8 @@ abstract class PaymentModuleCore extends Module
|
||||
'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $this->context->currency, false),
|
||||
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false),
|
||||
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false),
|
||||
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false));
|
||||
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false),
|
||||
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false));
|
||||
|
||||
if (is_array($extra_vars))
|
||||
$data = array_merge($data, $extra_vars);
|
||||
|
||||
+142
-51
@@ -364,7 +364,7 @@ class ProductCore extends ObjectModel
|
||||
),
|
||||
'type' => array(
|
||||
'getter' => 'getWsType',
|
||||
'setter' => false,
|
||||
'setter' => 'setWsType',
|
||||
),
|
||||
),
|
||||
'associations' => array(
|
||||
@@ -668,6 +668,45 @@ class ProductCore extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given id_product and id_product_attribute, return available date
|
||||
*
|
||||
* @param int $id_product
|
||||
* @param int $id_product_attribute Optional
|
||||
* @return string/null
|
||||
*/
|
||||
public static function getAvailableDate($id_product, $id_product_attribute = null)
|
||||
{
|
||||
$sql = 'SELECT';
|
||||
|
||||
if ($id_product_attribute === null)
|
||||
$sql .= ' p.`available_date`';
|
||||
else
|
||||
$sql .= ' IF(pa.`available_date` = "0000-00-00", p.`available_date`, pa.`available_date`) AS available_date';
|
||||
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'product` p';
|
||||
|
||||
if ($id_product_attribute !== null)
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product` = p.`id_product`)';
|
||||
|
||||
$sql .= Shop::addSqlAssociation('product', 'p');
|
||||
|
||||
if ($id_product_attribute !== null)
|
||||
$sql .= Shop::addSqlAssociation('product_attribute', 'pa');
|
||||
|
||||
$sql .= ' WHERE p.`id_product` = '.(int)$id_product;
|
||||
|
||||
if ($id_product_attribute !== null)
|
||||
$sql .= ' AND pa.`id_product` = '.(int)$id_product.' AND pa.`id_product_attribute` = '.(int)$id_product_attribute;
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
|
||||
if ($result == '0000-00-00')
|
||||
$result = null;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function updateIsVirtual($id_product)
|
||||
{
|
||||
Db::getInstance()->update('product', array(
|
||||
@@ -1300,7 +1339,7 @@ class ProductCore extends ObjectModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Supplier Reference
|
||||
* Sets or updates Supplier Reference
|
||||
*
|
||||
* @param int $id_supplier
|
||||
* @param int $id_product_attribute
|
||||
@@ -1313,30 +1352,25 @@ class ProductCore extends ObjectModel
|
||||
//in some case we need to add price without supplier reference
|
||||
if ($supplier_reference === null)
|
||||
$supplier_reference = '';
|
||||
|
||||
|
||||
//Try to set the default supplier reference
|
||||
if ($id_supplier > 0)
|
||||
if (($id_supplier > 0) && ($id_product > 0))
|
||||
{
|
||||
$id_product_supplier = (int)ProductSupplier::getIdByProductAndSupplier($this->id, $id_product_attribute, $id_supplier);
|
||||
|
||||
$product_supplier = new ProductSupplier($id_product_supplier);
|
||||
|
||||
if (!$id_product_supplier)
|
||||
{
|
||||
//create new record
|
||||
$product_supplier_entity = new ProductSupplier();
|
||||
$product_supplier_entity->id_product = (int)$this->id;
|
||||
$product_supplier_entity->id_product_attribute = (int)$id_product_attribute;
|
||||
$product_supplier_entity->id_supplier = (int)$id_supplier;
|
||||
$product_supplier_entity->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier_entity->product_supplier_price_te = (int)$price;
|
||||
$product_supplier_entity->id_currency = (int)$id_currency;
|
||||
$product_supplier_entity->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
$product_supplier = new ProductSupplier((int)$id_product_supplier);
|
||||
$product_supplier->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier->update();
|
||||
$product_supplier->id_product = (int)$this->id;
|
||||
$product_supplier->id_product_attribute = (int)$id_product_attribute;
|
||||
$product_supplier->id_supplier = (int)$id_supplier;
|
||||
}
|
||||
|
||||
$product_supplier->product_supplier_reference = pSQL($supplier_reference);
|
||||
$product_supplier->product_supplier_price_te = (float)$price;
|
||||
$product_supplier->id_currency = (int)$id_currency;
|
||||
$product_supplier->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1978,13 +2012,7 @@ class ProductCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
WHERE product_shop.`active` = 1
|
||||
AND 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).' DAY
|
||||
)
|
||||
) > 0
|
||||
AND product_shop.`date_add` > "'.date('Y-m-d', strtotime('-'.(Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int)Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY')).'"
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
|
||||
AND p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
@@ -1999,13 +2027,7 @@ class ProductCore extends ObjectModel
|
||||
$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`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name,
|
||||
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).' DAY
|
||||
)
|
||||
) > 0 AS new'
|
||||
product_shop.`date_add` > "'.date('Y-m-d', strtotime('-'.(Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int)Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY')).'" as new'
|
||||
);
|
||||
|
||||
$sql->from('product', 'p');
|
||||
@@ -2020,25 +2042,15 @@ class ProductCore extends ObjectModel
|
||||
$sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`');
|
||||
|
||||
$sql->where('product_shop.`active` = 1');
|
||||
|
||||
if ($front)
|
||||
$sql->where('product_shop.`visibility` IN ("both", "catalog")');
|
||||
$sql->where('
|
||||
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).' DAY
|
||||
)
|
||||
) > 0'
|
||||
);
|
||||
|
||||
$sql->where('product_shop.`date_add` > "'.date('Y-m-d', strtotime('-'.(Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int)Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY')).'"');
|
||||
$sql->where('p.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_group` cg
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)
|
||||
WHERE cg.`id_group` '.$sql_groups.')'
|
||||
);
|
||||
WHERE cg.`id_group` '.$sql_groups.'
|
||||
)');
|
||||
$sql->groupBy('product_shop.id_product');
|
||||
|
||||
$sql->orderBy((isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way));
|
||||
@@ -2372,8 +2384,14 @@ class ProductCore extends ObjectModel
|
||||
WHERE id_product = '.(int)$this->id.'
|
||||
AND id_shop = '.(int)$this->id_shop
|
||||
);
|
||||
if (count($data))
|
||||
Db::getInstance()->insert('product_carrier', $data);
|
||||
|
||||
$uniqueArray = array();
|
||||
foreach($data as $subArray)
|
||||
if(!in_array($subArray, $uniqueArray))
|
||||
$uniqueArray[] = $subArray;
|
||||
|
||||
if (count($uniqueArray))
|
||||
Db::getInstance()->insert('product_carrier', $uniqueArray, false, true, Db::INSERT_IGNORE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4740,6 +4758,44 @@ class ProductCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'product_tag`
|
||||
WHERE `id_product` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Webservice setter : set tag ids of current product for association
|
||||
*
|
||||
* @param $tag_ids tag ids
|
||||
*/
|
||||
public function setWsTags($tag_ids)
|
||||
{
|
||||
$ids = array();
|
||||
foreach ($tag_ids as $value)
|
||||
$ids[] = $value['id'];
|
||||
if ($this->deleteWsTags())
|
||||
{
|
||||
if ($ids)
|
||||
{
|
||||
$sql_values = '';
|
||||
$ids = array_map('intval', $ids);
|
||||
foreach ($ids as $position => $id)
|
||||
$sql_values[] = '('.(int)$this->id.', '.(int)$id.')';
|
||||
$result = Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'product_tag` (`id_product`, `id_tag`)
|
||||
VALUES '.implode(',', $sql_values)
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete products tags entries without delete tags for webservice usage
|
||||
*
|
||||
* @return array Deletion result
|
||||
*/
|
||||
public function deleteWsTags()
|
||||
{
|
||||
return Db::getInstance()->delete('product_tag', 'id_product = '.(int)$this->id);
|
||||
}
|
||||
|
||||
|
||||
public function getWsManufacturerName()
|
||||
@@ -4751,7 +4807,7 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
return ObjectModel::updateMultishopTable('product', array(
|
||||
'ecotax' => 0,
|
||||
), '');
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5344,6 +5400,41 @@ class ProductCore extends ObjectModel
|
||||
|
||||
public function getWsProductBundle()
|
||||
{
|
||||
return Db::getInstance()->executeS('SELECT id_product_item as id, quantity FROM '._DB_PREFIX_.'pack where id_product_pack = '.(int)$this->id);
|
||||
return Db::getInstance()->executeS('SELECT id_product_item as id, quantity FROM '._DB_PREFIX_.'pack WHERE id_product_pack = '.(int)$this->id);
|
||||
}
|
||||
}
|
||||
|
||||
public function setWsType($type_str)
|
||||
{
|
||||
$reverse_type_information = array(
|
||||
'simple' => Product::PTYPE_SIMPLE,
|
||||
'pack' => Product::PTYPE_PACK,
|
||||
'virtual' => Product::PTYPE_VIRTUAL,
|
||||
);
|
||||
|
||||
if (!isset($reverse_type_information[$type_str]))
|
||||
return false;
|
||||
|
||||
$type = $reverse_type_information[$type_str];
|
||||
|
||||
if (Pack::isPack((int)$this->id) && $type != Product::PTYPE_PACK)
|
||||
Pack::deleteItems($this->id);
|
||||
|
||||
$this->cache_is_pack = ($type == Product::PTYPE_PACK);
|
||||
$this->is_virtual = ($type == Product::PTYPE_VIRTUAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setWsProductBundle($items)
|
||||
{
|
||||
if($this->is_virtual)
|
||||
return false;
|
||||
|
||||
Pack::deleteItems($this->id);
|
||||
|
||||
foreach ($items as $item)
|
||||
if((int)$item['id'] > 0)
|
||||
Pack::addItem($this->id, (int)$item['id'], (int)$item['quantity']);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,10 +299,10 @@ class ProductDownloadCore extends ObjectModel
|
||||
*/
|
||||
public static function getNewFilename()
|
||||
{
|
||||
$ret = sha1(microtime());
|
||||
if (file_exists(_PS_DOWNLOAD_DIR_.$ret))
|
||||
$ret = ProductDownload::getNewFilename();
|
||||
return $ret;
|
||||
do {
|
||||
$filename = sha1(microtime());
|
||||
} while (file_exists(_PS_DOWNLOAD_DIR_.$filename));
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,4 +314,4 @@ class ProductDownloadCore extends ObjectModel
|
||||
{
|
||||
return Configuration::get('PS_VIRTUAL_PROD_FEATURE_ACTIVE');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class ProductSaleCore
|
||||
if ($nb_products < 1) $nb_products = 10;
|
||||
$final_order_by = $order_by;
|
||||
if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales';
|
||||
if (is_null($order_way) || $order_by == 'sales') $order_way == 'DESC';
|
||||
if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC';
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1');
|
||||
$interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20;
|
||||
|
||||
+1
-1
@@ -410,7 +410,7 @@ class SearchCore
|
||||
{
|
||||
$db->execute('TRUNCATE '._DB_PREFIX_.'search_index');
|
||||
$db->execute('TRUNCATE '._DB_PREFIX_.'search_word');
|
||||
ObjectModel::updateMultishopTable('Product', array('indexed' => 0), '1');
|
||||
ObjectModel::updateMultishopTable('Product', array('indexed' => 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+41
-6
@@ -343,8 +343,8 @@ class ToolsCore
|
||||
$cookie->id_lang = null;
|
||||
}
|
||||
|
||||
/* Automatically detect language if not already defined */
|
||||
if (!$cookie->id_lang && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
/* Automatically detect language if not already defined, detect_language is set in Cookie::update */
|
||||
if ((!$cookie->id_lang || isset($cookie->detect_language)) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
{
|
||||
$array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
|
||||
if (Tools::strlen($array[0]) > 2)
|
||||
@@ -358,9 +358,17 @@ class ToolsCore
|
||||
{
|
||||
$lang = new Language(Language::getIdByIso($string));
|
||||
if (Validate::isLoadedObject($lang) && $lang->active)
|
||||
{
|
||||
$language = new Language((int)$lang->id);
|
||||
if (Validate::isLoadedObject($language))
|
||||
Context::getContext()->language = $language;
|
||||
$cookie->id_lang = (int)$lang->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($cookie->detect_language))
|
||||
unset($cookie->detect_language);
|
||||
|
||||
/* If language file not present, you must use default language file */
|
||||
if (!$cookie->id_lang || !Validate::isUnsignedId($cookie->id_lang))
|
||||
@@ -769,6 +777,33 @@ class ToolsCore
|
||||
{
|
||||
return (Tools::dieObject($object, $kill));
|
||||
}
|
||||
|
||||
public static function debug_backtrace($start = 0, $limit = null)
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
array_shift($backtrace);
|
||||
for ($i = 0; $i < $start; ++$i)
|
||||
array_shift($backtrace);
|
||||
|
||||
echo '
|
||||
<div style="margin:10px;padding:10px;border:1px solid #666666">
|
||||
<ul>';
|
||||
$i = 0;
|
||||
foreach ($backtrace as $id => $trace)
|
||||
{
|
||||
if ((int)$limit && (++$i > $limit ))
|
||||
break;
|
||||
$relative_file = (isset($trace['file'])) ? 'in /'.ltrim(str_replace(array(_PS_ROOT_DIR_, '\\'), array('', '/'), $trace['file']), '/') : '';
|
||||
$current_line = (isset($trace['line'])) ? ':'.$trace['line'] : '';
|
||||
|
||||
echo '<li>
|
||||
<b>'.((isset($trace['class'])) ? $trace['class'] : '').((isset($trace['type'])) ? $trace['type'] : '').$trace['function'].'</b>
|
||||
'.$relative_file.$current_line.'
|
||||
</li>';
|
||||
}
|
||||
echo '</ul>
|
||||
</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* ALIAS OF dieObject() - Display an error with detailed object but don't stop the execution
|
||||
@@ -1388,13 +1423,13 @@ class ToolsCore
|
||||
|
||||
/**
|
||||
* Translates a string with underscores into camel case (e.g. first_name -> firstName)
|
||||
* @prototype string public static function toCamelCase(string $str[, bool $catapitalise_first_char = false])
|
||||
* @prototype string public static function toCamelCase(string $str[, bool $capitalise_first_char = false])
|
||||
*/
|
||||
public static function toCamelCase($str, $catapitalise_first_char = false)
|
||||
{
|
||||
$str = strtolower($str);
|
||||
$str = Tools::strtolower($str);
|
||||
if ($catapitalise_first_char)
|
||||
$str = ucfirst($str);
|
||||
$str = Tools::ucfirst($str);
|
||||
return preg_replace_callback('/_+([a-z])/', create_function('$c', 'return strtoupper($c[1]);'), $str);
|
||||
}
|
||||
|
||||
@@ -2528,7 +2563,7 @@ exit;
|
||||
$fileAttachment = null;
|
||||
if (isset($_FILES[$input]['name']) && !empty($_FILES[$input]['name']) && !empty($_FILES[$input]['tmp_name']))
|
||||
{
|
||||
$fileAttachment['rename'] = uniqid(). self::strtolower(substr($_FILES[$input]['name'], -5));
|
||||
$fileAttachment['rename'] = uniqid(). Tools::strtolower(substr($_FILES[$input]['name'], -5));
|
||||
$fileAttachment['content'] = file_get_contents($_FILES[$input]['tmp_name']);
|
||||
$fileAttachment['tmp_name'] = $_FILES[$input]['tmp_name'];
|
||||
$fileAttachment['name'] = $_FILES[$input]['name'];
|
||||
|
||||
@@ -174,7 +174,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isMailName($mail_name)
|
||||
{
|
||||
return preg_match(Tools::cleanNonUnicodeSupport('/^[^<>;=#{}]*$/u'), $mail_name);
|
||||
return (is_string($mail_name) && preg_match(Tools::cleanNonUnicodeSupport('/^[^<>;=#{}]*$/u'), $mail_name));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -592,7 +592,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isOrderBy($order)
|
||||
{
|
||||
return preg_match('/^[a-zA-Z0-9._-]+$/', $order);
|
||||
return preg_match('/^[a-zA-Z0-9.!_-]+$/', $order);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,8 @@ class AdminControllerCore extends Controller
|
||||
/** @var string Associated table name */
|
||||
public $table;
|
||||
|
||||
public $list_id;
|
||||
|
||||
/** @var string Object identifier inside the associated table */
|
||||
protected $identifier = false;
|
||||
|
||||
@@ -380,6 +382,39 @@ class AdminControllerCore extends Controller
|
||||
break;
|
||||
}
|
||||
$this->toolbar_title = $bread_extended;
|
||||
|
||||
if (Tools::isSubmit('submitFilter'))
|
||||
{
|
||||
$filter = '';
|
||||
foreach ($this->fields_list AS $field => $t)
|
||||
{
|
||||
if ($val = Tools::getValue($this->table.'Filter_'.$field))
|
||||
{
|
||||
if(!is_array($val) && !empty($val))
|
||||
$filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : ';
|
||||
|
||||
if (isset($t['type']) && $t['type'] == 'bool')
|
||||
$filter .= ((bool)$val) ? $this->l('yes') : $this->l('no');
|
||||
elseif(is_string($val))
|
||||
$filter .= $val;
|
||||
elseif(is_array($val))
|
||||
{
|
||||
$tmp = '';
|
||||
foreach($val as $v)
|
||||
if(is_string($v) && !empty($v))
|
||||
$tmp .= ' - '.$v;
|
||||
if(Tools::strlen($tmp))
|
||||
{
|
||||
$tmp = ltrim($tmp, ' - ');
|
||||
$filter .= ($filter ? ', ' : $this->l(' filter by ')).$t['title'].' : ';
|
||||
$filter .= $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($filter)
|
||||
$this->toolbar_title[] = $filter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,29 +465,33 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function processFilter()
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
|
||||
// Filter memorization
|
||||
if (isset($_POST) && !empty($_POST) && isset($this->table))
|
||||
if (isset($_POST) && !empty($_POST) && isset($this->list_id))
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
if (stripos($key, $this->table.'Filter_') === 0)
|
||||
if (stripos($key, $this->list_id.'Filter_') === 0)
|
||||
$this->context->cookie->{$prefix.$key} = !is_array($value) ? $value : serialize($value);
|
||||
elseif(stripos($key, 'submitFilter') === 0)
|
||||
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
|
||||
}
|
||||
|
||||
if (isset($_GET) && !empty($_GET) && isset($this->table))
|
||||
if (isset($_GET) && !empty($_GET) && isset($this->list_id))
|
||||
foreach ($_GET as $key => $value)
|
||||
if (stripos($key, $this->table.'OrderBy') === 0 || stripos($key, $this->table.'Orderway') === 0)
|
||||
if (stripos($key, $this->list_id.'OrderBy') === 0 || stripos($key, $this->list_id.'Orderway') === 0)
|
||||
$this->context->cookie->{$prefix.$key} = $value;
|
||||
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->list_id.'Filter_');
|
||||
|
||||
foreach ($filters as $key => $value)
|
||||
{
|
||||
/* Extracting filters from $_POST on key filter_ */
|
||||
if ($value != null && !strncmp($key, $prefix.$this->table.'Filter_', 7 + Tools::strlen($prefix.$this->table)))
|
||||
if ($value != null && !strncmp($key, $prefix.$this->list_id.'Filter_', 7 + Tools::strlen($prefix.$this->list_id)))
|
||||
{
|
||||
$key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->table));
|
||||
$key = Tools::substr($key, 7 + Tools::strlen($prefix.$this->list_id));
|
||||
/* Table alias could be specified using a ! eg. alias!field */
|
||||
$tmp_tab = explode('!', $key);
|
||||
$filter = count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0];
|
||||
@@ -888,30 +927,32 @@ class AdminControllerCore extends Controller
|
||||
/**
|
||||
* Cancel all filters for this tab
|
||||
*/
|
||||
public function processResetFilters()
|
||||
public function processResetFilters($list_id = null)
|
||||
{
|
||||
if (!isset($list_id))
|
||||
$list_id = isset($this->list_id) ? $this->list_id : $this->table;
|
||||
|
||||
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
|
||||
$filters = $this->context->cookie->getFamily($prefix.$list_id.'Filter_');
|
||||
|
||||
foreach ($filters as $cookie_key => $filter)
|
||||
if (strncmp($cookie_key, $prefix.$this->table.'Filter_', 7 + Tools::strlen($prefix.$this->table)) == 0)
|
||||
if (strncmp($cookie_key, $prefix.$list_id.'Filter_', 7 + Tools::strlen($prefix.$list_id)) == 0)
|
||||
{
|
||||
$key = substr($cookie_key, 7 + Tools::strlen($prefix.$this->table));
|
||||
/* Table alias could be specified using a ! eg. alias!field */
|
||||
$tmp_tab = explode('!', $key);
|
||||
$key = (count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0]);
|
||||
$key = substr($cookie_key, 7 + Tools::strlen($prefix.$list_id));
|
||||
|
||||
if (is_array($this->fields_list) && array_key_exists($key, $this->fields_list))
|
||||
$this->context->cookie->$cookie_key = null;
|
||||
unset($this->context->cookie->$cookie_key);
|
||||
}
|
||||
|
||||
if (isset($this->context->cookie->{'submitFilter'.$this->table}))
|
||||
unset($this->context->cookie->{'submitFilter'.$this->table});
|
||||
if (isset($this->context->cookie->{'submitFilter'.$list_id}))
|
||||
unset($this->context->cookie->{'submitFilter'.$list_id});
|
||||
|
||||
if (isset($this->context->cookie->{$prefix.$this->table.'Orderby'}))
|
||||
unset($this->context->cookie->{$prefix.$this->table.'Orderby'});
|
||||
if (isset($this->context->cookie->{$prefix.$list_id.'Orderby'}))
|
||||
unset($this->context->cookie->{$prefix.$list_id.'Orderby'});
|
||||
|
||||
if (isset($this->context->cookie->{$prefix.$this->table.'Orderway'}))
|
||||
unset($this->context->cookie->{$prefix.$this->table.'Orderway'});
|
||||
if (isset($this->context->cookie->{$prefix.$list_id.'Orderway'}))
|
||||
unset($this->context->cookie->{$prefix.$list_id.'Orderway'});
|
||||
|
||||
unset($_POST);
|
||||
$this->_filter = false;
|
||||
@@ -1287,7 +1328,7 @@ class AdminControllerCore extends Controller
|
||||
$current_id = Tab::getCurrentParentId();
|
||||
foreach ($tabs as $index => $tab)
|
||||
{
|
||||
if ($tab['class_name'] == 'AdminStock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0)
|
||||
if (($tab['class_name'] == 'AdminStock' && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 0) || $tab['class_name'] == 'AdminCarrierWizard')
|
||||
{
|
||||
unset($tabs[$index]);
|
||||
continue;
|
||||
@@ -1327,7 +1368,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($sub_tabs as $index2 => $sub_tab)
|
||||
{
|
||||
// class_name is the name of the class controller
|
||||
if (Tab::checkTabRights($sub_tab['id_tab']) === true && (bool)$sub_tab['active'])
|
||||
if (Tab::checkTabRights($sub_tab['id_tab']) === true && (bool)$sub_tab['active'] && $sub_tab['class_name'] != 'AdminCarrierWizard')
|
||||
{
|
||||
$sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']);
|
||||
$sub_tabs[$index2]['current'] = ($sub_tab['class_name'].'Controller' == get_class($this));
|
||||
@@ -1471,6 +1512,8 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
protected function initTabModuleList()
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 86400))
|
||||
@file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'));
|
||||
if (!$this->isFresh(Module::CACHE_FILE_TAB_MODULES_LIST, 604800))
|
||||
$this->refresh(Module::CACHE_FILE_TAB_MODULES_LIST, 'http://'.Tab::TAB_MODULE_LIST_URL);
|
||||
|
||||
@@ -1691,6 +1734,7 @@ class AdminControllerCore extends Controller
|
||||
$helper->row_hover = $this->row_hover;
|
||||
$helper->position_identifier = $this->position_identifier;
|
||||
$helper->controller_name = $this->controller_name;
|
||||
$helper->list_id = isset($this->list_id) ? $this->list_id : $this->table;
|
||||
|
||||
// For each action, try to add the corresponding skip elements list
|
||||
$helper->list_skip_actions = $this->list_skip_actions;
|
||||
@@ -1898,11 +1942,14 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
// Manage list filtering
|
||||
if (Tools::isSubmit('submitFilter'.$this->table)
|
||||
|| $this->context->cookie->{'submitFilter'.$this->table} !== false
|
||||
|| Tools::getValue($this->table.'Orderby')
|
||||
|| Tools::getValue($this->table.'Orderway'))
|
||||
if (Tools::isSubmit('submitFilter'.$this->list_id)
|
||||
|| $this->context->cookie->{'submitFilter'.$this->list_id} !== false
|
||||
|| Tools::getValue($this->list_id.'Orderby')
|
||||
|| Tools::getValue($this->list_id.'Orderway'))
|
||||
$this->filter = true;
|
||||
|
||||
$this->id_object = (int)Tools::getValue($this->identifier);
|
||||
@@ -2004,7 +2051,7 @@ class AdminControllerCore extends Controller
|
||||
$this->action = 'export';
|
||||
}
|
||||
/* Cancel all filters for this tab */
|
||||
elseif (isset($_POST['submitReset'.$this->table]))
|
||||
elseif (isset($_POST['submitReset'.$this->list_id]))
|
||||
$this->action = 'reset_filters';
|
||||
/* Submit options list */
|
||||
elseif (Tools::getValue('submitOptions'.$this->table) || Tools::getValue('submitOptions'))
|
||||
@@ -2058,14 +2105,17 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
/* Manage default params values */
|
||||
$use_limit = true;
|
||||
if ($limit === false)
|
||||
$use_limit = false;
|
||||
elseif (empty($limit))
|
||||
{
|
||||
if (isset($this->context->cookie->{$this->table.'_pagination'}) && $this->context->cookie->{$this->table.'_pagination'})
|
||||
$limit = $this->context->cookie->{$this->table.'_pagination'};
|
||||
if (isset($this->context->cookie->{$this->list_id.'_pagination'}) && $this->context->cookie->{$this->list_id.'_pagination'})
|
||||
$limit = $this->context->cookie->{$this->list_id.'_pagination'};
|
||||
else
|
||||
$limit = $this->_pagination[1];
|
||||
}
|
||||
@@ -2075,8 +2125,8 @@ class AdminControllerCore extends Controller
|
||||
$prefix = str_replace(array('admin', 'controller'), '', Tools::strtolower(get_class($this)));
|
||||
if (empty($order_by))
|
||||
{
|
||||
if ($this->context->cookie->{$prefix.$this->table.'Orderby'})
|
||||
$order_by = $this->context->cookie->{$prefix.$this->table.'Orderby'};
|
||||
if ($this->context->cookie->{$prefix.$this->list_id.'Orderby'})
|
||||
$order_by = $this->context->cookie->{$prefix.$this->list_id.'Orderby'};
|
||||
elseif ($this->_orderBy)
|
||||
$order_by = $this->_orderBy;
|
||||
else
|
||||
@@ -2085,16 +2135,16 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if (empty($order_way))
|
||||
{
|
||||
if ($this->context->cookie->{$prefix.$this->table.'Orderway'})
|
||||
$order_way = $this->context->cookie->{$prefix.$this->table.'Orderway'};
|
||||
if ($this->context->cookie->{$prefix.$this->list_id.'Orderway'})
|
||||
$order_way = $this->context->cookie->{$prefix.$this->list_id.'Orderway'};
|
||||
elseif ($this->_orderWay)
|
||||
$order_way = $this->_orderWay;
|
||||
else
|
||||
$order_way = $this->_defaultOrderWay;
|
||||
}
|
||||
|
||||
$limit = (int)Tools::getValue('pagination', $limit);
|
||||
$this->context->cookie->{$this->table.'_pagination'} = $limit;
|
||||
$limit = (int)Tools::getValue($this->list_id.'_pagination', $limit);
|
||||
$this->context->cookie->{$this->list_id.'_pagination'} = $limit;
|
||||
|
||||
/* Check params validity */
|
||||
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)
|
||||
@@ -2106,24 +2156,23 @@ class AdminControllerCore extends Controller
|
||||
$order_by = $this->fields_list[$order_by]['filter_key'];
|
||||
|
||||
/* Determine offset from current page */
|
||||
if ((isset($_POST['submitFilter'.$this->table]) ||
|
||||
isset($_POST['submitFilter'.$this->table.'_x']) ||
|
||||
isset($_POST['submitFilter'.$this->table.'_y'])) &&
|
||||
!empty($_POST['submitFilter'.$this->table]) &&
|
||||
is_numeric($_POST['submitFilter'.$this->table]))
|
||||
$start = ((int)$_POST['submitFilter'.$this->table] - 1) * $limit;
|
||||
if ((isset($_POST['submitFilter'.$this->list_id]) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_x']) ||
|
||||
isset($_POST['submitFilter'.$this->list_id.'_y'])) &&
|
||||
!empty($_POST['submitFilter'.$this->list_id]) &&
|
||||
is_numeric($_POST['submitFilter'.$this->list_id]))
|
||||
$start = ((int)$_POST['submitFilter'.$this->list_id] - 1) * $limit;
|
||||
|
||||
/* Cache */
|
||||
$this->_lang = (int)$id_lang;
|
||||
$this->_orderBy = $order_by;
|
||||
|
||||
if (preg_match('/[.!]/', $order_by))
|
||||
{
|
||||
$order_by_split = preg_split('/[.!]/', $order_by);
|
||||
$order_by = pSQL($order_by_split[0]).'.`'.pSQL($order_by_split[1]).'`';
|
||||
$this->_orderBy = (isset($order_by_split) && isset($order_by_split[1])) ? $order_by_split[1] : $order_by;
|
||||
}
|
||||
else
|
||||
$this->_orderBy = $order_by;
|
||||
|
||||
$this->_orderWay = Tools::strtoupper($order_way);
|
||||
|
||||
/* SQL table : orders, but class name is Order */
|
||||
@@ -2222,6 +2271,7 @@ class AdminControllerCore extends Controller
|
||||
($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').
|
||||
(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||
|
||||
$this->_listTotal = 0;
|
||||
if (!($this->_list = Db::getInstance()->executeS($this->_listsql)))
|
||||
$this->_list_error = Db::getInstance()->getMsgError();
|
||||
else
|
||||
@@ -2384,7 +2434,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($rules['required'] as $field)
|
||||
if (($value = Tools::getValue($field)) == false && (string)$value != '0')
|
||||
if (!Tools::getValue($this->identifier) || ($field != 'passwd' && $field != 'no-picture'))
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors[$field] = sprintf(
|
||||
Tools::displayError('The %s field is required.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
|
||||
);
|
||||
@@ -2393,7 +2443,7 @@ class AdminControllerCore extends Controller
|
||||
if (isset($rules['requiredLang']) && is_array($rules['requiredLang']))
|
||||
foreach ($rules['requiredLang'] as $field_lang)
|
||||
if (($empty = Tools::getValue($field_lang.'_'.$default_language->id)) === false || $empty !== '0' && empty($empty))
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors[$field_lang.'_'.$default_language->id] = sprintf(
|
||||
Tools::displayError('The field %1$s is required at least in %2$s.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$default_language->name
|
||||
@@ -2403,7 +2453,7 @@ class AdminControllerCore extends Controller
|
||||
if (isset($rules['size']) && is_array($rules['size']))
|
||||
foreach ($rules['size'] as $field => $max_length)
|
||||
if (Tools::getValue($field) !== false && Tools::strlen(Tools::getValue($field)) > $max_length)
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors[$field] = sprintf(
|
||||
Tools::displayError('The %1$s field is too long (%2$d chars max).'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name),
|
||||
$max_length
|
||||
@@ -2416,7 +2466,7 @@ class AdminControllerCore extends Controller
|
||||
{
|
||||
$field_lang_value = Tools::getValue($field_lang.'_'.$language['id_lang']);
|
||||
if ($field_lang_value !== false && Tools::strlen($field_lang_value) > $max_length)
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
|
||||
Tools::displayError('The field %1$s (%2$s) is too long (%3$d chars max, html chars including).'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$language['name'],
|
||||
@@ -2431,7 +2481,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($rules['validate'] as $field => $function)
|
||||
if (($value = Tools::getValue($field)) !== false && ($field != 'passwd'))
|
||||
if (!Validate::$function($value) && !empty($value))
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors[$field] = sprintf(
|
||||
Tools::displayError('The %s field is invalid.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field, $class_name)
|
||||
);
|
||||
@@ -2440,12 +2490,12 @@ class AdminControllerCore extends Controller
|
||||
if (($value = Tools::getValue('passwd')) != false)
|
||||
{
|
||||
if ($class_name == 'Employee' && !Validate::isPasswdAdmin($value))
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors['passwd'] = sprintf(
|
||||
Tools::displayError('The %s field is invalid.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
|
||||
);
|
||||
elseif ($class_name == 'Customer' && !Validate::isPasswd($value))
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors['passwd'] = sprintf(
|
||||
Tools::displayError('The %s field is invalid.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), 'passwd', $class_name)
|
||||
);
|
||||
@@ -2457,7 +2507,7 @@ class AdminControllerCore extends Controller
|
||||
foreach ($languages as $language)
|
||||
if (($value = Tools::getValue($field_lang.'_'.$language['id_lang'])) !== false && !empty($value))
|
||||
if (!Validate::$function($value))
|
||||
$this->errors[] = sprintf(
|
||||
$this->errors[$field_lang.'_'.$language['id_lang']] = sprintf(
|
||||
Tools::displayError('The %1$s field (%2$s) is invalid.'),
|
||||
call_user_func(array($class_name, 'displayFieldName'), $field_lang, $class_name),
|
||||
$language['name']
|
||||
|
||||
@@ -114,18 +114,15 @@ class FrontControllerCore extends Controller
|
||||
$css_files = $this->css_files;
|
||||
$js_files = $this->js_files;
|
||||
|
||||
if ($this->ssl && !Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED'))
|
||||
// If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
|
||||
if (Configuration::get('PS_SSL_ENABLED') && ($_SERVER['REQUEST_METHOD'] != 'POST') && $this->ssl != Tools::usingSecureMode())
|
||||
{
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Cache-Control: no-cache');
|
||||
header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
|
||||
exit();
|
||||
}
|
||||
elseif (Configuration::get('PS_SSL_ENABLED') && Tools::usingSecureMode() && !($this->ssl))
|
||||
{
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Cache-Control: no-cache');
|
||||
header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
|
||||
if ($this->ssl)
|
||||
header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
|
||||
else
|
||||
header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -808,7 +805,7 @@ class FrontControllerCore extends Controller
|
||||
// 'orderwaydefault' => Tools::getProductsOrder('way'),
|
||||
|
||||
$stock_management = Configuration::get('PS_STOCK_MANAGEMENT') ? true : false; // no display quantity order if stock management disabled
|
||||
$order_by_values = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
|
||||
$order_by_values = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity', 7 => 'reference');
|
||||
$order_way_values = array(0 => 'asc', 1 => 'desc');
|
||||
$this->orderBy = Tools::strtolower(Tools::getValue('orderby', $order_by_values[(int)Configuration::get('PS_PRODUCTS_ORDER_BY')]));
|
||||
$this->orderWay = Tools::strtolower(Tools::getValue('orderway', $order_way_values[(int)Configuration::get('PS_PRODUCTS_ORDER_WAY')]));
|
||||
@@ -1140,4 +1137,4 @@ class FrontControllerCore extends Controller
|
||||
'logo_url' => $logo
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,9 +51,10 @@ abstract class ModuleAdminControllerCore extends AdminController
|
||||
|
||||
public function createTemplate($tpl_name)
|
||||
{
|
||||
if (file_exists($this->getTemplatePath().$this->override_folder.$tpl_name) && $this->viewAccess())
|
||||
if (file_exists(_PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/admin/'.$tpl_name) && $this->viewAccess())
|
||||
return $this->context->smarty->createTemplate(_PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/admin/'.$tpl_name, $this->context->smarty);
|
||||
elseif (file_exists($this->getTemplatePath().$this->override_folder.$tpl_name) && $this->viewAccess())
|
||||
return $this->context->smarty->createTemplate($this->getTemplatePath().$this->override_folder.$tpl_name, $this->context->smarty);
|
||||
|
||||
return parent::createTemplate($tpl_name);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ class ModuleFrontControllerCore extends FrontController
|
||||
{
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/'.$this->module->name.'/'.$template))
|
||||
$this->template = _PS_THEME_DIR_.'modules/'.$this->module->name.'/'.$template;
|
||||
elseif (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/front/'.$template))
|
||||
$this->template = _PS_THEME_DIR_.'modules/'.$this->module->name.'/views/templates/front/'.$template;
|
||||
elseif (Tools::file_exists_cache($this->getTemplatePath().$template))
|
||||
$this->template = $this->getTemplatePath().$template;
|
||||
else
|
||||
|
||||
@@ -51,7 +51,7 @@ class PrestaShopExceptionCore extends Exception
|
||||
</style>';
|
||||
echo '<div id="psException">';
|
||||
echo '<h2>['.get_class($this).']</h2>';
|
||||
echo $this->getExentedMessage();
|
||||
echo $this->getExtendedMessage();
|
||||
|
||||
$this->displayFileDebug($this->getFile(), $this->getLine());
|
||||
|
||||
@@ -145,14 +145,23 @@ class PrestaShopExceptionCore extends Exception
|
||||
{
|
||||
$logger = new FileLogger();
|
||||
$logger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_exception.log');
|
||||
$logger->logError($this->getExentedMessage(false));
|
||||
$logger->logError($this->getExtendedMessage(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 1.5.5
|
||||
*/
|
||||
protected function getExentedMessage($html = true)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
return $this->getExtendedMessage($html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the content of the Exception
|
||||
* @return string content of the exception
|
||||
*/
|
||||
protected function getExentedMessage($html = true)
|
||||
protected function getExtendedMessage($html = true)
|
||||
{
|
||||
$format = '<p><b>%s</b><br /><i>at line </i><b>%d</b><i> in file </i><b>%s</b></p>';
|
||||
if (!$html)
|
||||
|
||||
@@ -486,18 +486,21 @@ class HelperListCore extends Helper
|
||||
*/
|
||||
public function displayListHeader()
|
||||
{
|
||||
if (!isset($this->list_id))
|
||||
$this->list_id = $this->table;
|
||||
|
||||
$id_cat = (int)Tools::getValue('id_'.($this->is_cms ? 'cms_' : '').'category');
|
||||
|
||||
if (!isset($token) || empty($token))
|
||||
$token = $this->token;
|
||||
|
||||
/* Determine total page number */
|
||||
if (isset($this->context->cookie->{$this->table.'_pagination'}) && $this->context->cookie->{$this->table.'_pagination'})
|
||||
$default_pagination = $this->context->cookie->{$this->table.'_pagination'};
|
||||
if (isset($this->context->cookie->{$this->list_id.'_pagination'}) && $this->context->cookie->{$this->list_id.'_pagination'})
|
||||
$default_pagination = $this->context->cookie->{$this->list_id.'_pagination'};
|
||||
else
|
||||
$default_pagination = $this->_pagination[0];
|
||||
|
||||
$total_pages = ceil($this->listTotal / Tools::getValue('pagination', ($default_pagination)));
|
||||
$total_pages = ceil($this->listTotal / Tools::getValue($this->list_id.'_pagination', ($default_pagination)));
|
||||
|
||||
if (!$total_pages)
|
||||
$total_pages = 1;
|
||||
@@ -510,14 +513,13 @@ class HelperListCore extends Helper
|
||||
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table;
|
||||
|
||||
/* Determine current page number */
|
||||
$page = (int)Tools::getValue('submitFilter'.$this->table);
|
||||
$page = (int)Tools::getValue('submitFilter'.$this->list_id);
|
||||
if (!$page)
|
||||
$page = 1;
|
||||
|
||||
/* Choose number of results per page */
|
||||
$selected_pagination = Tools::getValue(
|
||||
'pagination',
|
||||
isset($this->context->cookie->{$this->table.'_pagination'}) ? $this->context->cookie->{$this->table.'_pagination'} : null
|
||||
$selected_pagination = Tools::getValue($this->list_id.'_pagination',
|
||||
isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null
|
||||
);
|
||||
|
||||
// Cleaning links
|
||||
@@ -535,7 +537,7 @@ class HelperListCore extends Helper
|
||||
{
|
||||
if (!isset($params['type']))
|
||||
$params['type'] = 'text';
|
||||
$value = Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.(array_key_exists('filter_key', $params) && $key != 'active' ? $params['filter_key'] : $key)};
|
||||
$value = Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.(array_key_exists('filter_key', $params) && $key != 'active' ? $params['filter_key'] : $key)};
|
||||
switch ($params['type'])
|
||||
{
|
||||
case 'bool':
|
||||
@@ -547,7 +549,7 @@ class HelperListCore extends Helper
|
||||
$value = Tools::unSerialize($value);
|
||||
if (!Validate::isCleanHtml($value[0]) || !Validate::isCleanHtml($value[1]))
|
||||
$value = '';
|
||||
$name = $this->table.'Filter_'.(isset($params['filter_key']) ? $params['filter_key'] : $key);
|
||||
$name = $this->list_id.'Filter_'.(isset($params['filter_key']) ? $params['filter_key'] : $key);
|
||||
$name_id = str_replace('!', '__', $name);
|
||||
|
||||
$params['id_date'] = $name_id;
|
||||
@@ -559,9 +561,9 @@ class HelperListCore extends Helper
|
||||
case 'select':
|
||||
foreach ($params['list'] as $option_value => $option_display)
|
||||
{
|
||||
if (isset(Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.$params['filter_key']})
|
||||
&& Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.$params['filter_key']} == $option_value
|
||||
&& Context::getContext()->cookie->{$prefix.$this->table.'Filter_'.$params['filter_key']} != '')
|
||||
if (isset(Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']})
|
||||
&& Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']} == $option_value
|
||||
&& Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']} != '')
|
||||
$this->fields_list[$key]['select'][$option_value]['selected'] = 'selected';
|
||||
}
|
||||
break;
|
||||
@@ -620,7 +622,8 @@ class HelperListCore extends Helper
|
||||
'table_dnd' => isset($table_dnd) ? $table_dnd : null,
|
||||
'name' => isset($name) ? $name : null,
|
||||
'name_id' => isset($name_id) ? $name_id : null,
|
||||
'row_hover' => $this->row_hover
|
||||
'row_hover' => $this->row_hover,
|
||||
'list_id' => isset($this->list_id) ? $this->list_id : $this->table
|
||||
)));
|
||||
|
||||
return $this->header_tpl->fetch();
|
||||
|
||||
@@ -669,12 +669,14 @@ abstract class ModuleCore
|
||||
return false;
|
||||
|
||||
// Retrocompatibility
|
||||
$hook_name_bak = $hook_name;
|
||||
if ($alias = Hook::getRetroHookName($hook_name))
|
||||
$hook_name = $alias;
|
||||
|
||||
Hook::exec('actionModuleRegisterHookBefore', array('object' => $this, 'hook_name' => $hook_name));
|
||||
// Get hook id
|
||||
$id_hook = Hook::getIdByName($hook_name);
|
||||
$live_edit = Hook::getLiveEditById((int)Hook::getIdByName($hook_name_bak));
|
||||
|
||||
// If hook does not exist, we create it
|
||||
if (!$id_hook)
|
||||
@@ -682,6 +684,7 @@ abstract class ModuleCore
|
||||
$new_hook = new Hook();
|
||||
$new_hook->name = pSQL($hook_name);
|
||||
$new_hook->title = pSQL($hook_name);
|
||||
$new_hook->live_edit = pSQL($live_edit);
|
||||
$new_hook->add();
|
||||
$id_hook = $new_hook->id;
|
||||
if (!$id_hook)
|
||||
@@ -1538,7 +1541,7 @@ abstract class ModuleCore
|
||||
Cache::store($cache_id, $exceptionsCache);
|
||||
}
|
||||
else
|
||||
$exceptionsCache = !Cache::retrieve($cache_id);
|
||||
$exceptionsCache = Cache::retrieve($cache_id);
|
||||
|
||||
$key = $id_hook.'-'.$this->id;
|
||||
$array_return = array();
|
||||
@@ -1600,7 +1603,11 @@ abstract class ModuleCore
|
||||
protected static function _isTemplateOverloadedStatic($module_name, $template)
|
||||
{
|
||||
if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/'.$module_name.'/'.$template))
|
||||
return true;
|
||||
return _PS_THEME_DIR_.'modules/'.$module_name.'/'.$template;
|
||||
elseif (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/'.$module_name.'/views/templates/hook/'.$template))
|
||||
return _PS_THEME_DIR_.'modules/'.$module_name.'/views/templates/hook/'.$template;
|
||||
elseif (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/'.$module_name.'/views/templates/front/'.$template))
|
||||
return _PS_THEME_DIR_.'modules/'.$module_name.'/views/templates/front/'.$template;
|
||||
elseif (Tools::file_exists_cache(_PS_MODULE_DIR_.$module_name.'/views/templates/hook/'.$template))
|
||||
return false;
|
||||
elseif (Tools::file_exists_cache(_PS_MODULE_DIR_.$module_name.'/'.$template))
|
||||
@@ -1615,9 +1622,16 @@ abstract class ModuleCore
|
||||
|
||||
protected function getCacheId($name = null)
|
||||
{
|
||||
if ($name === null)
|
||||
$name = $this->name;
|
||||
return $name.'|'.(int)Tools::usingSecureMode().'|'.(int)$this->context->shop->id.'|'.(int)Group::getCurrent()->id.'|'.(int)$this->context->language->id.'|'.(int)$this->context->currency->id;
|
||||
$cache_array = array(
|
||||
$name !== null ? $name : $this->name,
|
||||
(int)Tools::usingSecureMode(),
|
||||
(int)$this->context->shop->id,
|
||||
(int)Group::getCurrent()->id,
|
||||
(int)$this->context->language->id,
|
||||
(int)$this->context->currency->id,
|
||||
(int)$this->context->country->id
|
||||
);
|
||||
return implode('|', $cache_array);
|
||||
}
|
||||
|
||||
public function display($file, $template, $cacheId = null, $compileId = null)
|
||||
@@ -1661,8 +1675,9 @@ abstract class ModuleCore
|
||||
$overloaded = $this->_isTemplateOverloaded($template);
|
||||
if ($overloaded === null)
|
||||
return null;
|
||||
|
||||
if ($overloaded)
|
||||
return _PS_THEME_DIR_.'modules/'.$this->name.'/'.$template;
|
||||
return $overloaded;
|
||||
else if (file_exists(_PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template))
|
||||
return _PS_MODULE_DIR_.$this->name.'/views/templates/hook/'.$template;
|
||||
else
|
||||
|
||||
@@ -254,7 +254,7 @@ class OrderCore extends ObjectModel
|
||||
public function __construct($id = null, $id_lang = null)
|
||||
{
|
||||
parent::__construct($id, $id_lang);
|
||||
|
||||
|
||||
$is_admin = (is_object(Context::getContext()->controller) && Context::getContext()->controller->controller_type == 'admin');
|
||||
if ($this->id_customer && !$is_admin)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,9 @@ class OrderHistoryCore extends ObjectModel
|
||||
'id_order_state' => array('required' => true, 'xlink_resource'=> 'order_states'),
|
||||
'id_order' => array('xlink_resource' => 'orders'),
|
||||
),
|
||||
'objectMethods' => array(
|
||||
'add' => 'addWs',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -376,7 +379,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
return false;
|
||||
|
||||
$result = Db::getInstance()->getRow('
|
||||
SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`
|
||||
SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON oh.`id_order` = o.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON o.`id_customer` = c.`id_customer`
|
||||
@@ -408,9 +411,23 @@ class OrderHistoryCore extends ObjectModel
|
||||
$data['{order_name}'] = $order->getUniqReference();
|
||||
|
||||
if (Validate::isLoadedObject($order))
|
||||
{
|
||||
// Join PDF invoice if order state is "payment accepted"
|
||||
if ((int)$result['id_order_state'] === 2 && (int)Configuration::get('PS_INVOICE') && $order->invoice_number)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $context->smarty);
|
||||
$file_attachement['content'] = $pdf->render(false);
|
||||
$file_attachement['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf';
|
||||
$file_attachement['mime'] = 'application/pdf';
|
||||
}
|
||||
else
|
||||
$file_attachement = null;
|
||||
|
||||
Mail::Send((int)$order->id_lang, $result['template'], $topic, $data, $result['email'], $result['firstname'].' '.$result['lastname'],
|
||||
null, null, null, null, _PS_MAIL_DIR_, false, (int)$order->id_shop);
|
||||
|
||||
null, null, $file_attachement, null, _PS_MAIL_DIR_, false, (int)$order->id_shop);
|
||||
}
|
||||
|
||||
ShopUrl::resetMainDomainCache();
|
||||
}
|
||||
|
||||
@@ -445,4 +462,27 @@ class OrderHistoryCore extends ObjectModel
|
||||
AND os.`logable` = 1');
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Add method for webservice create resource Order History
|
||||
* If sendemail=1 GET parameter is present sends email to customer otherwise does not
|
||||
* @return bool
|
||||
*/
|
||||
public function addWs()
|
||||
{
|
||||
$sendemail = (bool)Tools::getValue('sendemail', false);
|
||||
if ($sendemail)
|
||||
{
|
||||
//Mail::Send requires link object on context and is not set when getting here
|
||||
$context = Context::getContext();
|
||||
if ($context->link == null)
|
||||
{
|
||||
$protocol_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
$protocol_content = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
|
||||
$context->link = new Link($protocol_link, $protocol_content);
|
||||
}
|
||||
return $this->addWithemail();
|
||||
}
|
||||
else
|
||||
return $this->add();
|
||||
}
|
||||
}
|
||||
+10
-12
@@ -187,18 +187,16 @@ class ShopCore extends ObjectModel
|
||||
|
||||
public function setUrl()
|
||||
{
|
||||
$sql = 'SELECT su.physical_uri, su.virtual_uri,
|
||||
su.domain, su.domain_ssl, t.id_theme, t.name, t.directory
|
||||
FROM '._DB_PREFIX_.'shop s
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su ON (s.id_shop = su.id_shop)
|
||||
LEFT JOIN '._DB_PREFIX_.'theme t ON (t.id_theme = s.id_theme)
|
||||
WHERE s.id_shop = '.(int)$this->id.'
|
||||
AND s.active = 1
|
||||
AND s.deleted = 0
|
||||
AND su.main = 1';
|
||||
|
||||
if (!$row = Db::getInstance()->getRow($sql))
|
||||
return;
|
||||
$row = Db::getInstance()->getRow('
|
||||
SELECT su.physical_uri, su.virtual_uri, su.domain, su.domain_ssl, t.id_theme, t.name, t.directory
|
||||
FROM '._DB_PREFIX_.'shop s
|
||||
LEFT JOIN '._DB_PREFIX_.'shop_url su ON (s.id_shop = su.id_shop)
|
||||
LEFT JOIN '._DB_PREFIX_.'theme t ON (t.id_theme = s.id_theme)
|
||||
WHERE s.id_shop = '.(int)$this->id.'
|
||||
AND s.active = 1 AND s.deleted = 0 AND su.main = 1');
|
||||
|
||||
if (!$row)
|
||||
return false;
|
||||
|
||||
$this->theme_id = $row['id_theme'];
|
||||
$this->theme_name = $row['name'];
|
||||
|
||||
@@ -680,7 +680,7 @@ class StockAvailableCore extends ObjectModel
|
||||
|
||||
// if there is no $id_shop, gets the context one
|
||||
// get shop group too
|
||||
if ($shop === null)
|
||||
if ($shop === null || $shop === $context->shop->id)
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$shop_group = Shop::getContextShopGroup();
|
||||
|
||||
@@ -513,7 +513,6 @@ class WebserviceRequestCore
|
||||
$this->setError(501, sprintf('The specific management class is not implemented for the "%s" entity.', $this->urlSegment[0]), 124);
|
||||
else
|
||||
{
|
||||
$this->setFieldsToDisplay();
|
||||
$this->objectSpecificManagement = new $specificObjectName();
|
||||
$this->objectSpecificManagement->setObjectOutput($this->objOutput)
|
||||
->setWsObject($this);
|
||||
|
||||
@@ -94,17 +94,11 @@ try
|
||||
{
|
||||
$context->shop = Shop::initialize();
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch (PrestaShopException $e)
|
||||
{
|
||||
header('HTTP/1.1 503 temporarily overloaded');
|
||||
|
||||
define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_.'smarty/');
|
||||
require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
|
||||
$context->smarty = new Smarty();
|
||||
$context->smarty->display('error500.html');
|
||||
|
||||
exit;
|
||||
$e->displayMessage();
|
||||
}
|
||||
|
||||
define('_THEME_NAME_', $context->shop->getTheme());
|
||||
define('__PS_BASE_URI__', $context->shop->getBaseURI());
|
||||
|
||||
|
||||
@@ -44,7 +44,10 @@ $smarty->debugging = false;
|
||||
$smarty->debugging_ctrl = 'NONE';
|
||||
|
||||
if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_BY_URL_)
|
||||
{
|
||||
$smarty->debugging_ctrl = 'URL';
|
||||
$smarty->smarty_debug_id = Configuration::get('PS_SMARTY_CONSOLE_KEY');
|
||||
}
|
||||
else if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_)
|
||||
$smarty->debugging = true;
|
||||
|
||||
@@ -176,6 +179,7 @@ function smartyHook($params, &$smarty)
|
||||
{
|
||||
$id_module = null;
|
||||
$hook_params = $params;
|
||||
$hook_params['smarty'] = $smarty;
|
||||
if (!empty($params['mod']))
|
||||
{
|
||||
$module = Module::getInstanceByName($params['mod']);
|
||||
|
||||
@@ -52,6 +52,8 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
'count_values' => array(
|
||||
'title' => $this->l('Values count'),
|
||||
'align' => 'center',
|
||||
'orderby' => false,
|
||||
'search' => false
|
||||
),
|
||||
'position' => array(
|
||||
'title' => $this->l('Position'),
|
||||
@@ -322,6 +324,11 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
||||
'label' => $this->l('Current texture:'),
|
||||
'name' => 'current_texture'
|
||||
);
|
||||
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'closediv',
|
||||
'name' => ''
|
||||
);
|
||||
|
||||
$this->fields_form['submit'] = array(
|
||||
'title' => $this->l('Save '),
|
||||
|
||||
@@ -0,0 +1,933 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminCarrierWizardControllerCore extends AdminController
|
||||
{
|
||||
protected $wizard_access;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->display = 'view';
|
||||
$this->table = 'carrier';
|
||||
$this->identifier = 'id_carrier';
|
||||
$this->className = 'Carrier';
|
||||
$this->lang = false;
|
||||
$this->deleted = true;
|
||||
$this->step_number = 0;
|
||||
|
||||
$this->fieldImageSettings = array(
|
||||
'name' => 'logo',
|
||||
'dir' => 's'
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, Tab::getIdFromClassName('AdminCarriers'));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addJqueryPlugin('smartWizard');
|
||||
$this->addJqueryPlugin('typewatch');
|
||||
$this->addJs(_PS_JS_DIR_.'admin_carrier_wizard.js');
|
||||
}
|
||||
|
||||
public function initWizard()
|
||||
{
|
||||
$this->wizard_steps = array(
|
||||
'name' => 'carrier_wizard',
|
||||
'steps' => array(
|
||||
array(
|
||||
'title' => $this->l('General settings'),
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Shipping locations and costs'),
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Size, weight, and group access'),
|
||||
),
|
||||
array(
|
||||
'title' => $this->l('Summary'),
|
||||
),
|
||||
|
||||
));
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$multistore_step = array(
|
||||
array(
|
||||
'title' => $this->l('MultiStore'),
|
||||
'desc' => $this->l('MultiStore'),
|
||||
)
|
||||
);
|
||||
array_splice($this->wizard_steps['steps'], 1, 0, $multistore_step);
|
||||
}
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$this->initWizard();
|
||||
|
||||
if (Tools::getValue('id_carrier') && $this->tabAccess['edit'])
|
||||
$carrier = $this->loadObject();
|
||||
elseif ($this->tabAccess['add'])
|
||||
$carrier = new Carrier();
|
||||
|
||||
if ((!$this->tabAccess['edit'] && Tools::getValue('id_carrier')) || (!$this->tabAccess['add'] && !Tools::getValue('id_carrier')))
|
||||
{
|
||||
$this->errors[] = Tools::displayError('You do not have permission to use this wizard.');
|
||||
return ;
|
||||
}
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$this->tpl_view_vars = array(
|
||||
'currency_sign' => $currency->sign,
|
||||
'PS_WEIGHT_UNIT' => Configuration::get('PS_WEIGHT_UNIT'),
|
||||
'enableAllSteps' => Validate::isLoadedObject($carrier),
|
||||
'wizard_steps' => $this->wizard_steps,
|
||||
'validate_url' => $this->context->link->getAdminLink('AdminCarrierWizard'),
|
||||
'carrierlist_url' => $this->context->link->getAdminLink('AdminCarriers').'&conf='.((int)Validate::isLoadedObject($carrier) ? 4 : 3),
|
||||
'wizard_contents' => array(
|
||||
'contents' => array(
|
||||
0 => $this->renderStepOne($carrier),
|
||||
1 => $this->renderStepThree($carrier),
|
||||
2 => $this->renderStepFour($carrier),
|
||||
3 => $this->renderStepFive($carrier),
|
||||
)),
|
||||
'labels' => array('next' => $this->l('Next'), 'previous' => $this->l('Previous'), 'finish' => $this->l('Finish'))
|
||||
);
|
||||
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
array_splice($this->tpl_view_vars['wizard_contents']['contents'], 1, 0, array(0 => $this->renderStepTwo($carrier)));
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'carrier_logo' => (Validate::isLoadedObject($carrier) && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg') ? _THEME_SHIP_DIR_.$carrier->id.'.jpg' : false)
|
||||
));
|
||||
$this->content .= $this->createTemplate('logo.tpl')->fetch();
|
||||
$this->addjQueryPlugin(array('ajaxfileupload'));
|
||||
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
public function initToolbarTitle()
|
||||
{
|
||||
$bread_extended = array_unique($this->breadcrumbs);
|
||||
|
||||
if (Tools::getValue('id_carrier'))
|
||||
$bread_extended[1] = $this->l('Edit');
|
||||
else
|
||||
$bread_extended[1] = $this->l('Add new');
|
||||
|
||||
$this->toolbar_title = $bread_extended;
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
$this->toolbar_btn['back']['href'] = $this->context->link->getAdminLink('AdminCarriers');
|
||||
}
|
||||
|
||||
public function renderStepOne($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'form' => array(
|
||||
'id_form' => 'step_carrier_general',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Carrier name:'),
|
||||
'name' => 'name',
|
||||
'size' => 25,
|
||||
'required' => true,
|
||||
'hint' => sprintf($this->l('Allowed characters: letters, spaces and %s'), '().-'),
|
||||
'desc' => array(
|
||||
$this->l('Carrier name displayed during checkout'),
|
||||
$this->l('For in-store pickup, enter 0 to replace the carrier name with your shop name.')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Transit time:'),
|
||||
'name' => 'delay',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'size' => 41,
|
||||
'maxlength' => 128,
|
||||
'desc' => $this->l('Estimated delivery time will be displayed during checkout.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Speed grade:'),
|
||||
'name' => 'grade',
|
||||
'required' => false,
|
||||
'size' => 1,
|
||||
'desc' => $this->l('Enter "0" for a longest shipping delay, or "9" for the shortest shipping delay.')
|
||||
),
|
||||
array(
|
||||
'type' => 'logo',
|
||||
'label' => $this->l('Logo:'),
|
||||
'name' => 'logo',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Tracking URL:'),
|
||||
'name' => 'url',
|
||||
'size' => 40,
|
||||
'desc' => $this->l('Delivery tracking URL: Type \'@\' where the tracking number should appear. It will then be automatically replaced by the tracking number.')
|
||||
),
|
||||
)),
|
||||
);
|
||||
|
||||
$tpl_vars = array('max_image_size' => (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE') / 1024 / 1024);
|
||||
$fields_value = $this->getStepOneFieldsValues($carrier);
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
|
||||
}
|
||||
|
||||
public function renderStepTwo($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'form' => array(
|
||||
'id_form' => 'step_carrier_shops',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
),
|
||||
))
|
||||
);
|
||||
$fields_value = $this->getStepTwoFieldsValues($carrier);
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
|
||||
}
|
||||
|
||||
public function renderStepThree($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'form' => array(
|
||||
'id_form' => 'step_carrier_ranges',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Shipping and handling:'),
|
||||
'name' => 'shipping_handling',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'shipping_handling_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'shipping_handling_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
),
|
||||
'desc' => $this->l('Include the shipping and handling costs in the carrier price.')
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Apply shipping cost:'),
|
||||
'name' => 'is_free',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'is_free_off',
|
||||
'value' => 0,
|
||||
'label' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />'
|
||||
),
|
||||
array(
|
||||
'id' => 'is_free_on',
|
||||
'value' => 1,
|
||||
'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" />'
|
||||
)
|
||||
),
|
||||
'desc' => $this->l('Apply both regular shipping cost and product-specific shipping costs.')
|
||||
),
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Billing:'),
|
||||
'name' => 'shipping_method',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'br' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'billing_price',
|
||||
'value' => Carrier::SHIPPING_METHOD_PRICE,
|
||||
'label' => $this->l('According to total price')
|
||||
),
|
||||
array(
|
||||
'id' => 'billing_weight',
|
||||
'value' => Carrier::SHIPPING_METHOD_WEIGHT,
|
||||
'label' => $this->l('According to total weight')
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Tax:'),
|
||||
'name' => 'id_tax_rules_group',
|
||||
'options' => array(
|
||||
'query' => TaxRulesGroup::getTaxRulesGroups(true),
|
||||
'id' => 'id_tax_rules_group',
|
||||
'name' => 'name',
|
||||
'default' => array(
|
||||
'label' => $this->l('No Tax'),
|
||||
'value' => 0
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'zone',
|
||||
'name' => 'zones'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Out-of-range behavior:'),
|
||||
'name' => 'range_behavior',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 0,
|
||||
'name' => $this->l('Apply the cost of the highest defined range')
|
||||
),
|
||||
array(
|
||||
'id' => 1,
|
||||
'name' => $this->l('Disable carrier')
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Out-of-range behavior occurs when no defined range matches the customer\'s cart (e.g. when the weight of the cart is greater than the highest weight limit defined by the weight ranges)')
|
||||
)
|
||||
),
|
||||
|
||||
));
|
||||
|
||||
$tpl_vars = array();
|
||||
$tpl_vars['PS_WEIGHT_UNIT'] = Configuration::get('PS_WEIGHT_UNIT');
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$tpl_vars['currency_sign'] = $currency->sign;
|
||||
|
||||
$fields_value = $this->getStepThreeFieldsValues($carrier);
|
||||
|
||||
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value, $tpl_vars);
|
||||
}
|
||||
|
||||
public function renderStepFour($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'form' => array(
|
||||
'id_form' => 'step_carrier_conf',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package height ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
|
||||
'name' => 'max_height',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum height managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
|
||||
.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package width ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
|
||||
'name' => 'max_width',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum width managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
|
||||
.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package depth ('.Configuration::get('PS_DIMENSION_UNIT').'):'),
|
||||
'name' => 'max_depth',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum depth managed by this carrier. Set the value to "0", or leave this field blank to ignore.').' '.$this->l('The value must be an integer
|
||||
.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Maximum package weight ('.Configuration::get('PS_WEIGHT_UNIT').'):'),
|
||||
'name' => 'max_weight',
|
||||
'required' => false,
|
||||
'size' => 10,
|
||||
'desc' => $this->l('Maximum weight managed by this carrier. Set the value to "0", or leave this field blank to ignore.')
|
||||
),
|
||||
array(
|
||||
'type' => 'group',
|
||||
'label' => $this->l('Group access:'),
|
||||
'name' => 'groupBox',
|
||||
'values' => Group::getGroups(Context::getContext()->language->id),
|
||||
'desc' => $this->l('Mark the groups that are allowed access to this carrier.')
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
$fields_value = $this->getStepFourFieldsValues($carrier);
|
||||
|
||||
// Added values of object Group
|
||||
$carrier_groups = $carrier->getGroups();
|
||||
$carrier_groups_ids = array();
|
||||
if (is_array($carrier_groups))
|
||||
foreach ($carrier_groups as $carrier_group)
|
||||
$carrier_groups_ids[] = $carrier_group['id_group'];
|
||||
|
||||
$groups = Group::getGroups($this->context->language->id);
|
||||
|
||||
foreach ($groups as $group)
|
||||
$fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$carrier->id));
|
||||
|
||||
return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
|
||||
}
|
||||
|
||||
public function renderStepFive($carrier)
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'form' => array(
|
||||
'id_form' => 'step_carrier_summary',
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'radio',
|
||||
'label' => $this->l('Status:'),
|
||||
'name' => 'active',
|
||||
'required' => false,
|
||||
'class' => 't',
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
),
|
||||
'desc' => $this->l('Enable the carrier in the Front Office')
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
$template = $this->createTemplate('controllers/carrier_wizard/summary.tpl');
|
||||
|
||||
$fields_value = $this->getStepFiveFieldsValues($carrier);
|
||||
|
||||
$active_form = $this->renderGenericForm(array('form' => $this->fields_form), $fields_value);
|
||||
|
||||
$active_form = str_replace(array('<fieldset id="fieldset_form">', '</fieldset>'), '', $active_form);
|
||||
|
||||
$template->assign('active_form', $active_form);
|
||||
|
||||
return $template->fetch('controllers/carrier_wizard/summary.tpl');
|
||||
}
|
||||
|
||||
protected function getTplRangesVarsAndValues($carrier, &$tpl_vars, &$fields_value)
|
||||
{
|
||||
$tpl_vars['zones'] = Zone::getZones(false);
|
||||
$carrier_zones = $carrier->getZones();
|
||||
$carrier_zones_ids = array();
|
||||
if (is_array($carrier_zones))
|
||||
foreach ($carrier_zones as $carrier_zone)
|
||||
$carrier_zones_ids[] = $carrier_zone['id_zone'];
|
||||
|
||||
$range_table = $carrier->getRangeTable();
|
||||
$shipping_method = $carrier->getShippingMethod();
|
||||
|
||||
$zones = Zone::getZones(false);
|
||||
foreach ($zones as $zone)
|
||||
$fields_value['zones'][$zone['id_zone']] = Tools::getValue('zone_'.$zone['id_zone'], (in_array($zone['id_zone'], $carrier_zones_ids)));
|
||||
|
||||
if ($shipping_method == Carrier::SHIPPING_METHOD_FREE)
|
||||
{
|
||||
$range_obj = $carrier->getRangeObject($carrier->shipping_method);
|
||||
$price_by_range = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$range_obj = $carrier->getRangeObject();
|
||||
$price_by_range = Carrier::getDeliveryPriceByRanges($range_table, (int)$carrier->id);
|
||||
}
|
||||
|
||||
foreach ($price_by_range as $price)
|
||||
$tpl_vars['price_by_range'][$price['id_'.$range_table]][$price['id_zone']] = $price['price'];
|
||||
|
||||
$tmp_range = $range_obj->getRanges((int)$carrier->id);
|
||||
$tpl_vars['ranges'] = array();
|
||||
if ($shipping_method != Carrier::SHIPPING_METHOD_FREE)
|
||||
foreach ($tmp_range as $id => $range)
|
||||
{
|
||||
$tpl_vars['ranges'][$range['id_'.$range_table]] = $range;
|
||||
$tpl_vars['ranges'][$range['id_'.$range_table]]['id_range'] = $range['id_'.$range_table];
|
||||
}
|
||||
|
||||
// init blank range
|
||||
if (!count($tpl_vars['ranges']))
|
||||
$tpl_vars['ranges'][] = array('id_range' => 0, 'delimiter1' => 0, 'delimiter2' => 0);
|
||||
}
|
||||
|
||||
public function renderGenericForm($fields_form, $fields_value, $tpl_vars = array())
|
||||
{
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
$helper->id = (int)Tools::getValue('id_carrier');
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->tpl_vars = array_merge(array(
|
||||
'fields_value' => $fields_value,
|
||||
'languages' => $this->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
), $tpl_vars);
|
||||
$helper->override_folder = 'carrier_wizard/';
|
||||
|
||||
return $helper->generateForm($fields_form);
|
||||
}
|
||||
|
||||
public function getStepOneFieldsValues($carrier)
|
||||
{
|
||||
return array(
|
||||
'id_carrier' => $this->getFieldValue($carrier, 'id_carrier'),
|
||||
'name' => $this->getFieldValue($carrier, 'name'),
|
||||
'delay' => $this->getFieldValue($carrier, 'delay'),
|
||||
'grade' => $this->getFieldValue($carrier, 'grade'),
|
||||
'url' => $this->getFieldValue($carrier, 'url'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getStepTwoFieldsValues($carrier)
|
||||
{
|
||||
return array('shop' => $this->getFieldValue($carrier, 'shop'));
|
||||
|
||||
}
|
||||
|
||||
public function getStepThreeFieldsValues($carrier)
|
||||
{
|
||||
$id_tax_rules_group = (is_object($this->object) && !$this->object->id) ? Carrier::getIdTaxRulesGroupMostUsed() : $this->getFieldValue($carrier, 'id_tax_rules_group');
|
||||
|
||||
$shipping_handling = (is_object($this->object) && !$this->object->id) ? 0 : $this->getFieldValue($carrier, 'shipping_handling');
|
||||
|
||||
return array(
|
||||
'is_free' => $this->getFieldValue($carrier, 'is_free'),
|
||||
'id_tax_rules_group' => (int)$id_tax_rules_group,
|
||||
'shipping_handling' => $shipping_handling,
|
||||
'shipping_method' => $this->getFieldValue($carrier, 'shipping_method'),
|
||||
'range_behavior' => $this->getFieldValue($carrier, 'range_behavior'),
|
||||
'zones' => $this->getFieldValue($carrier, 'zones'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getStepFourFieldsValues($carrier)
|
||||
{
|
||||
return array(
|
||||
'range_behavior' => $this->getFieldValue($carrier, 'range_behavior'),
|
||||
'max_height' => $this->getFieldValue($carrier, 'max_height'),
|
||||
'max_width' => $this->getFieldValue($carrier, 'max_width'),
|
||||
'max_depth' => $this->getFieldValue($carrier, 'max_depth'),
|
||||
'max_weight' => $this->getFieldValue($carrier, 'max_weight'),
|
||||
'group' => $this->getFieldValue($carrier, 'group'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getStepFiveFieldsValues($carrier)
|
||||
{
|
||||
return array('active' => $this->getFieldValue($carrier, 'active'));
|
||||
}
|
||||
|
||||
public function ajaxProcessChangeRanges()
|
||||
{
|
||||
if ((Validate::isLoadedObject($this->object) && !$this->tabAccess['edit']) || !$this->tabAccess['add'])
|
||||
{
|
||||
$this->errors[] = Tools::displayError('You do not have permission to use this wizard.');
|
||||
return;
|
||||
}
|
||||
if ((!(int)$shipping_method = Tools::getValue('shipping_method')) || !in_array($shipping_method, array(Carrier::SHIPPING_METHOD_PRICE, Carrier::SHIPPING_METHOD_WEIGHT)))
|
||||
return ;
|
||||
|
||||
$carrier = $this->loadObject(true);
|
||||
$carrier->shipping_method = $shipping_method;
|
||||
|
||||
$tpl_vars = array();
|
||||
$fields_value = $this->getStepThreeFieldsValues($carrier);
|
||||
$this->getTplRangesVarsAndValues($carrier, $tpl_vars, $fields_value);
|
||||
$template = $this->createTemplate('controllers/carrier_wizard/helpers/form/form_ranges.tpl');
|
||||
$template->assign($tpl_vars);
|
||||
$template->assign('change_ranges', 1);
|
||||
|
||||
$template->assign('fields_value', $fields_value);
|
||||
$template->assign('input', array('type' => 'zone', 'name' => 'zones' ));
|
||||
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$template->assign('currency_sign', $currency->sign);
|
||||
$template->assign('PS_WEIGHT_UNIT', Configuration::get('PS_WEIGHT_UNIT'));
|
||||
|
||||
die($template->fetch());
|
||||
}
|
||||
|
||||
public function ajaxProcessValidateStep()
|
||||
{
|
||||
$step_number = (int)Tools::getValue('step_number');
|
||||
$return = array('has_error' => false);
|
||||
|
||||
if (!$this->tabAccess['edit'])
|
||||
$this->errors[] = Tools::displayError('You do not have permission to use this wizard.');
|
||||
else
|
||||
{
|
||||
if (Shop::isFeatureActive() && $step_number == 2)
|
||||
{
|
||||
if (!Tools::getValue('checkBoxShopAsso_carrier'))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('You must choose at least one shop or group shop.');
|
||||
}
|
||||
}
|
||||
else
|
||||
$this->validateRules('AdminCarrierWizardControllerCore');
|
||||
}
|
||||
|
||||
if (count($this->errors))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'] = $this->errors;
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
}
|
||||
|
||||
public function processRanges($id_carrier)
|
||||
{
|
||||
if (!$this->tabAccess['edit'] || !$this->tabAccess['add'])
|
||||
{
|
||||
$this->errors[] = Tools::displayError('You do not have permission to use this wizard.');
|
||||
return;
|
||||
}
|
||||
|
||||
$carrier = new Carrier((int)$id_carrier);
|
||||
if (!Validate::isLoadedObject($carrier))
|
||||
return false;
|
||||
|
||||
$range_inf = Tools::getValue('range_inf');
|
||||
$range_sup = Tools::getValue('range_sup');
|
||||
$range_type = Tools::getValue('shipping_method');
|
||||
|
||||
$fees = Tools::getValue('fees');
|
||||
|
||||
$carrier->deleteDeliveryPrice($carrier->getRangeTable());
|
||||
if ($range_type != Carrier::SHIPPING_METHOD_FREE)
|
||||
{
|
||||
foreach ($range_inf as $key => $delimiter1)
|
||||
{
|
||||
if (!isset($range_sup[$key]))
|
||||
continue;
|
||||
$add_range = true;
|
||||
if ($range_type == Carrier::SHIPPING_METHOD_WEIGHT)
|
||||
{
|
||||
if (!RangeWeight::rangeExist((int)$carrier->id, (float)$delimiter1, (float)$range_sup[$key]))
|
||||
$range = new RangeWeight();
|
||||
else
|
||||
{
|
||||
$range = new RangeWeight((int)$key);
|
||||
$add_range = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($range_type == Carrier::SHIPPING_METHOD_PRICE)
|
||||
{
|
||||
if (!RangePrice::rangeExist((int)$carrier->id, (float)$delimiter1, (float)$range_sup[$key]))
|
||||
$range = new RangePrice();
|
||||
else
|
||||
{
|
||||
$range = new RangePrice((int)$key);
|
||||
$add_range = false;
|
||||
}
|
||||
}
|
||||
if ($add_range)
|
||||
{
|
||||
$range->id_carrier = (int)$carrier->id;
|
||||
$range->delimiter1 = (float)$delimiter1;
|
||||
$range->delimiter2 = (float)$range_sup[$key];
|
||||
$range->save();
|
||||
}
|
||||
|
||||
if (!Validate::isLoadedObject($range))
|
||||
return false;
|
||||
$price_list = array();
|
||||
if (is_array($fees) && count($fees))
|
||||
{
|
||||
foreach ($fees as $id_zone => $fee)
|
||||
$price_list[] = array(
|
||||
'id_range_price' => ($range_type == Carrier::SHIPPING_METHOD_PRICE ? (int)$range->id : null),
|
||||
'id_range_weight' => ($range_type == Carrier::SHIPPING_METHOD_WEIGHT ? (int)$range->id : null),
|
||||
'id_carrier' => (int)$carrier->id,
|
||||
'id_zone' => (int)$id_zone,
|
||||
'price' => (float)$fee[$key]
|
||||
);
|
||||
}
|
||||
|
||||
if (count($price_list) && !$carrier->addDeliveryPrice($price_list, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function ajaxProcessUploadLogo()
|
||||
{
|
||||
if (!$this->tabAccess['edit'])
|
||||
die('<return result="error" message="'.Tools::displayError('You do not have permission to use this wizard.').'" />');
|
||||
|
||||
$allowedExtensions = array('jpeg', 'gif', 'png', 'jpg');
|
||||
|
||||
$logo = (isset($_FILES['carrier_logo_input']) ? $_FILES['carrier_logo_input'] : false);
|
||||
if ($logo && !empty($logo['tmp_name']) && $logo['tmp_name'] != 'none'
|
||||
&& (!isset($logo['error']) || !$logo['error'])
|
||||
&& preg_match('/\.(jpe?g|gif|png)$/', $logo['name'])
|
||||
&& is_uploaded_file($logo['tmp_name']))
|
||||
{
|
||||
$file = $logo['tmp_name'];
|
||||
do $tmp_name = uniqid().'.jpg';
|
||||
while (file_exists(_PS_TMP_IMG_DIR_.$tmp_name));
|
||||
if (!ImageManager::resize($file, _PS_TMP_IMG_DIR_.$tmp_name))
|
||||
die('<return result="error" message="Impossible to resize the image into '.Tools::safeOutput(_PS_TMP_IMG_DIR_).'" />');
|
||||
@unlink($file);
|
||||
die('<return result="success" message="'.Tools::safeOutput(_PS_TMP_IMG_.$tmp_name).'" />');
|
||||
}
|
||||
else
|
||||
die('<return result="error" message="Cannot upload file" />');
|
||||
}
|
||||
|
||||
public function ajaxProcessFinishStep()
|
||||
{
|
||||
$return = array('has_error' => false);
|
||||
|
||||
if (!$this->tabAccess['edit'])
|
||||
$return = array(
|
||||
'has_error' => true,
|
||||
$return['errors'][] = Tools::displayError('You do not have permission to use this wizard.')
|
||||
);
|
||||
else
|
||||
{
|
||||
if ($id_carrier = Tools::getValue('id_carrier'))
|
||||
{
|
||||
$current_carrier = new Carrier((int)$id_carrier);
|
||||
// if update we duplicate current Carrier
|
||||
$new_carrier = $current_carrier->duplicateObject();
|
||||
if (Validate::isLoadedObject($new_carrier))
|
||||
{
|
||||
// Set flag deteled to true for historization
|
||||
$current_carrier->deleted = true;
|
||||
$current_carrier->update();
|
||||
|
||||
// Fill the new carrier object
|
||||
$this->copyFromPost($new_carrier, $this->table);
|
||||
$new_carrier->position = $current_carrier->position;
|
||||
$new_carrier->update();
|
||||
|
||||
$this->updateAssoShop((int)$new_carrier->id);
|
||||
$this->duplicateLogo((int)$new_carrier->id, (int)$current_carrier->id);
|
||||
$this->changeGroups((int)$new_carrier->id);
|
||||
// Call of hooks
|
||||
Hook::exec('actionCarrierUpdate', array(
|
||||
'id_carrier' => (int)$current_carrier->id,
|
||||
'carrier' => $new_carrier
|
||||
));
|
||||
$this->postImage($new_carrier->id);
|
||||
$this->changeZones($new_carrier->id);
|
||||
$new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'));
|
||||
$carrier = $new_carrier;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$carrier = new Carrier();
|
||||
$this->copyFromPost($carrier, $this->table);
|
||||
if (!$carrier->add())
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving this carrier.');
|
||||
}
|
||||
}
|
||||
|
||||
if ($carrier->is_free)
|
||||
{
|
||||
//if carrier is free delete shipping cost
|
||||
$carrier->deleteDeliveryPrice('range_weight');
|
||||
$carrier->deleteDeliveryPrice('range_price');
|
||||
}
|
||||
|
||||
if (Validate::isLoadedObject($carrier))
|
||||
{
|
||||
if (!$this->changeGroups((int)$carrier->id))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving carrier groups.');
|
||||
}
|
||||
|
||||
if (!$this->changeZones((int)$carrier->id))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving carrier zones.');
|
||||
}
|
||||
|
||||
if (!$carrier->is_free)
|
||||
if (!$this->processRanges((int)$carrier->id))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving carrier ranges.');
|
||||
}
|
||||
|
||||
if (Shop::isFeatureActive() && !$this->updateAssoShop((int)$carrier->id))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving associations of shops.');
|
||||
}
|
||||
|
||||
if (!$carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group')))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving the tax rules group.');
|
||||
}
|
||||
|
||||
if (Tools::getValue('logo'))
|
||||
{
|
||||
if (Tools::getValue('logo') == 'null' && file_exists(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg'))
|
||||
unlink(_PS_SHIP_IMG_DIR_.$carrier->id.'.jpg');
|
||||
else
|
||||
{
|
||||
$logo = basename(Tools::getValue('logo'));
|
||||
if (!file_exists(_PS_TMP_IMG_DIR_.$logo) || !copy(_PS_TMP_IMG_DIR_.$logo, _PS_SHIP_IMG_DIR_.$carrier->id.'.jpg'))
|
||||
{
|
||||
$return['has_error'] = true;
|
||||
$return['errors'][] = $this->l('An error occurred while saving carrier logo.');
|
||||
}
|
||||
}
|
||||
}
|
||||
$return['id_carrier'] = $carrier->id;
|
||||
}
|
||||
}
|
||||
die(Tools::jsonEncode($return));
|
||||
}
|
||||
|
||||
protected function changeGroups($id_carrier, $delete = true)
|
||||
{
|
||||
$carrier = new Carrier((int)$id_carrier);
|
||||
if (!Validate::isLoadedObject($carrier))
|
||||
return false;
|
||||
|
||||
return $carrier->setGroups(Tools::getValue('groupBox'));
|
||||
}
|
||||
|
||||
public function changeZones($id)
|
||||
{
|
||||
$return = true;
|
||||
$carrier = new Carrier($id);
|
||||
if (!Validate::isLoadedObject($carrier))
|
||||
die (Tools::displayError('The object cannot be loaded.'));
|
||||
$zones = Zone::getZones(false);
|
||||
foreach ($zones as $zone)
|
||||
if (count($carrier->getZone($zone['id_zone'])))
|
||||
{
|
||||
if (!isset($_POST['zone_'.$zone['id_zone']]) || !$_POST['zone_'.$zone['id_zone']])
|
||||
$return &= $carrier->deleteZone((int)$zone['id_zone']);
|
||||
}
|
||||
else
|
||||
if (isset($_POST['zone_'.$zone['id_zone']]) && $_POST['zone_'.$zone['id_zone']])
|
||||
$return &= $carrier->addZone((int)$zone['id_zone']);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public static function getValidationRules()
|
||||
{
|
||||
$step_number = Tools::getValue('step_number');
|
||||
|
||||
if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive())
|
||||
return array();
|
||||
|
||||
$step_fields = array(
|
||||
1 => array('name', 'delay', 'grade', 'url'),
|
||||
2 => array('is_free', 'id_tax_rules_group', 'shipping_handling', 'shipping_method', 'range_behavior'),
|
||||
3 => array('range_behavior', 'max_height', 'max_width', 'max_depth', 'max_weight'),
|
||||
);
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
{
|
||||
$multistore_field = array(array('shop'));
|
||||
$tmp = $step_fields;
|
||||
$step_fields = array(1 => $tmp[1]) + $multistore_field;
|
||||
array_shift($tmp);
|
||||
foreach ($tmp as $row)
|
||||
$step_field[] = $row;
|
||||
}
|
||||
|
||||
$rules = Carrier::getValidationRules('Carrier');
|
||||
|
||||
foreach ($rules as $key_r => $rule)
|
||||
foreach ($rule as $key_f => $field)
|
||||
{
|
||||
if (in_array($key_r, array('required', 'requiredLang')))
|
||||
{
|
||||
if(!in_array($field, $step_fields[$step_number]))
|
||||
unset($rules[$key_r][$key_f]);
|
||||
}
|
||||
else if(!in_array($key_f, $step_fields[$step_number]))
|
||||
unset($rules[$key_r][$key_f]);
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public static function displayFieldName($field)
|
||||
{
|
||||
return $field;
|
||||
}
|
||||
|
||||
public function duplicateLogo($new_id, $old_id)
|
||||
{
|
||||
$old_logo = _PS_SHIP_IMG_DIR_.'/'.(int)$old_id.'.jpg';
|
||||
if (file_exists($old_logo))
|
||||
copy($old_logo, _PS_SHIP_IMG_DIR_.'/'.(int)$new_id.'.jpg');
|
||||
|
||||
$old_tmp_logo = _PS_TMP_IMG_DIR_.'/carrier_mini_'.(int)$old_id.'.jpg';
|
||||
if (file_exists($old_tmp_logo))
|
||||
{
|
||||
if (!isset($_FILES['logo']))
|
||||
copy($old_tmp_logo, _PS_TMP_IMG_DIR_.'/carrier_mini_'.$new_id.'.jpg');
|
||||
unlink($old_tmp_logo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,11 +83,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
'is_free' => array(
|
||||
'title' => $this->l('Free Shipping'),
|
||||
'align' => 'center',
|
||||
'icon' => array(
|
||||
0 => 'disabled.gif',
|
||||
1 => 'enabled.gif',
|
||||
'default' => 'disabled.gif'
|
||||
),
|
||||
'active' => 'isFree',
|
||||
'type' => 'bool',
|
||||
'orderby' => false,
|
||||
),
|
||||
@@ -150,33 +146,16 @@ class AdminCarriersControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
|
||||
if (isset($this->toolbar_btn['new']))
|
||||
$this->toolbar_btn['new']['href'] = $this->context->link->getAdminLink('AdminCarrierWizard');
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->displayInformation(
|
||||
' <b>'.$this->l('How do I create a new carrier?').'</b>
|
||||
<br />
|
||||
<ul>
|
||||
<li>'.$this->l('Click "Add New."').'<br /></li>
|
||||
<li>'.$this->l('Fill in the fields and click "Save."').'</li>
|
||||
<li>'.
|
||||
$this->l('You need to set a price range -- or weight range -- for which the new carrier will be available.').' '.
|
||||
$this->l('Under the "Shipping" menu, click either "Price ranges" or "Weight ranges.".').'
|
||||
</li>
|
||||
<li>'.$this->l('Click "Add New."').'</li>
|
||||
<li>'.
|
||||
$this->l('Select the name of the carrier before defining the price or weight range.').' '.
|
||||
$this->l('For example, the carrier can be made available for a weight range between 0 and 5lbs. Another carrier can have a range between 5 and 10lbs.').'
|
||||
</li>
|
||||
<li>'.$this->l('When you\'re done, click "Save."').'</li>
|
||||
<li>'.$this->l('Click on the "Shipping" menu.').'</li>
|
||||
<li>'.
|
||||
$this->l('You need to set the fees that will be applied for this carrier.').' '.
|
||||
$this->l('At the bottom on the page -- in the "Fees" section -- select the name of the carrier.').'
|
||||
</li>
|
||||
<li>'.$this->l('For each zone, enter a price and then click "Save."').'</li>
|
||||
<li>'.$this->l('You\'re all set! The new carrier will now be displayed to customers.').'</li>
|
||||
</ul>'
|
||||
);
|
||||
$this->_select = 'b.*';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'carrier_lang` b ON a.id_carrier = b.id_carrier'.Shop::addSqlRestrictionOnLang('b').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier_tax_rules_group_shop` ctrgs ON (a.`id_carrier` = ctrgs.`id_carrier`
|
||||
@@ -537,6 +516,10 @@ class AdminCarriersControllerCore extends AdminController
|
||||
else
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
}
|
||||
else if (isset($_GET['isFree'.$this->table]))
|
||||
{
|
||||
$this->processIsFree();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
|
||||
@@ -569,6 +552,17 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function processIsFree()
|
||||
{
|
||||
$carrier = new Carrier($this->id_object);
|
||||
if (!Validate::isLoadedObject($carrier))
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating carrier information.');
|
||||
$carrier->is_free = $carrier->is_free ? 0 : 1;
|
||||
if (!$carrier->update())
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating carrier information.');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the property $fields_value
|
||||
*
|
||||
@@ -682,6 +676,22 @@ class AdminCarriersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function displayEditLink($token = null, $id, $name = null)
|
||||
{
|
||||
if ($this->tabAccess['edit'] == 1)
|
||||
return '<a href="'.$this->context->link->getAdminLink('AdminCarrierWizard').'&id_carrier='.(int)$id.'"><img src="../img/admin/edit.gif"/></a>';
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
public function displayDeleteLink($token = null, $id, $name = null)
|
||||
{
|
||||
if ($this->tabAccess['delete'] == 1)
|
||||
return '<a href="'.$this->context->link->getAdminLink('AdminCarriers').'&id_carrier='.(int)$id.'&deletecarrier=1"><img src="../img/admin/delete.gif"/></a>';
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
/** @var boolean does the product have to be disable during the delete process */
|
||||
public $disable_products = false;
|
||||
|
||||
private $original_filter = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
@@ -130,7 +132,7 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
$id_parent = $this->context->shop->id_category;
|
||||
|
||||
$this->_select = 'sa.position position';
|
||||
$this->_filter .= ' AND `id_parent` = '.(int)$id_parent.' ';
|
||||
$this->original_filter = $this->_filter .= ' AND `id_parent` = '.(int)$id_parent.' ';
|
||||
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` sa ON (a.`id_category` = sa.`id_category` AND sa.id_shop = '.(int)$this->context->shop->id.') ';
|
||||
@@ -174,6 +176,9 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
if (isset($this->_filter) && trim($this->_filter) == '')
|
||||
$this->_filter = $this->original_filter;
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->addRowAction('add');
|
||||
@@ -388,25 +393,6 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'use_context' => true,
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Root Category:'),
|
||||
'name' => 'is_root_category',
|
||||
'required' => false,
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'is_root_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Yes')
|
||||
),
|
||||
array(
|
||||
'id' => 'is_root_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('No')
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description:'),
|
||||
@@ -471,12 +457,36 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
$this->tpl_form_vars['shared_category'] = Validate::isLoadedObject($obj) && $obj->hasMultishopEntries();
|
||||
$this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
|
||||
|
||||
// Display this field only if multistore option is enabled
|
||||
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'))
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Root Category:'),
|
||||
'name' => 'is_root_category',
|
||||
'required' => false,
|
||||
'is_bool' => true,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'is_root_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Yes')
|
||||
),
|
||||
array(
|
||||
'id' => 'is_root_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('No')
|
||||
)
|
||||
)
|
||||
);
|
||||
// Display this field only if multistore option is enabled AND there are several stores configured
|
||||
if (Shop::isFeatureActive())
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'shop',
|
||||
'label' => $this->l('Shop association:'),
|
||||
'name' => 'checkBoxShopAsso',
|
||||
);
|
||||
|
||||
// remove category tree and radio button "is_root_category" if this category has the root category as parent category to avoid any conflict
|
||||
if ($this->_category->id_parent == Category::getTopCategory()->id && Tools::isSubmit('updatecategory'))
|
||||
foreach ($this->fields_form['input'] as $k => $input)
|
||||
|
||||
@@ -140,7 +140,8 @@ class AdminCountriesControllerCore extends AdminController
|
||||
array('address2'),
|
||||
array('postcode', 'city'),
|
||||
array('Country:name'),
|
||||
array('phone'));
|
||||
array('phone'),
|
||||
array('phone_mobile'));
|
||||
|
||||
foreach ($default_layout_tab as $line)
|
||||
$default_layout .= implode(' ', $line)."\r\n";
|
||||
|
||||
@@ -459,7 +459,7 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
* AdminController::getList() override
|
||||
* @see AdminController::getList()
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = false, $id_lang_shop = false)
|
||||
{
|
||||
if ($this->table == 'feature_value')
|
||||
$this->_where .= ' AND a.custom = 0';
|
||||
|
||||
@@ -71,10 +71,15 @@ class AdminHomeControllerCore extends AdminController
|
||||
$indexRebuiltAfterUpdate = 2;
|
||||
|
||||
$smartyOptimized = 0;
|
||||
// Forcing compilation is not good, really slow
|
||||
if (in_array(Configuration::get('PS_SMARTY_FORCE_COMPILE'), array(_PS_SMARTY_CHECK_COMPILE_, _PS_SMARTY_NO_COMPILE_)))
|
||||
++$smartyOptimized;
|
||||
// Enabling cache is better
|
||||
if (Configuration::get('PS_SMARTY_CACHE'))
|
||||
++$smartyOptimized;
|
||||
// If the console is enabled, not good for production
|
||||
if (Configuration::get('PS_SMARTY_CONSOLE') != _PS_SMARTY_CONSOLE_CLOSE_)
|
||||
$smartyOptimized = 0;
|
||||
|
||||
$cccOptimized = Configuration::get('PS_CSS_THEME_CACHE');
|
||||
$cccOptimized += Configuration::get('PS_JS_THEME_CACHE');
|
||||
@@ -170,10 +175,16 @@ class AdminHomeControllerCore extends AdminController
|
||||
|
||||
$shop = Context::getContext()->shop;
|
||||
if ($_SERVER['HTTP_HOST'] != $shop->domain && $_SERVER['HTTP_HOST'] != $shop->domain_ssl && Tools::getValue('ajax') == false)
|
||||
$this->displayWarning($this->l('You are currently connected under the following domain name:').' <span style="color: #CC0000;">'.$_SERVER['HTTP_HOST'].'</span><br />'.
|
||||
$this->l('This is different from the main shop domain name set in the "Multistore" page under the "Advanced Parameters" menu:').' <span style="color: #CC0000;">'.$shop->domain.'</span><br />
|
||||
<a href="index.php?controller=AdminMeta&token='.Tools::getAdminTokenLite('AdminMeta').'#conf_id_domain">'.
|
||||
$this->l('Click here if you want to modify your main shop\'s domain name.').'</a>');
|
||||
{
|
||||
$warning = $this->l('You are currently connected under the following domain name:').' <span style="color: #CC0000;">'.$_SERVER['HTTP_HOST'].'</span><br />';
|
||||
if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE'))
|
||||
$warning .= sprintf($this->l('This is different from the shop domain name set in the Multistore settings: "%s".'), $shop->domain).'
|
||||
'.preg_replace('@{link}(.*){/link}@', '<a href="index.php?controller=AdminShopUrl&id_shop_url='.(int)$shop->id.'&updateshop_url&token='.Tools::getAdminTokenLite('AdminShopUrl').'">$1</a>', $this->l('If this is your main domain, please {link}change it now{/link}.'));
|
||||
else
|
||||
$warning .= $this->l('This is different from the domain name set in the "SEO & URLs" tab.').'
|
||||
'.preg_replace('@{link}(.*){/link}@', '<a href="index.php?controller=AdminMeta&token='.Tools::getAdminTokenLite('AdminMeta').'#conf_id_domain">$1</a>', $this->l('If this is your main domain, please {link}change it now{/link}.'));
|
||||
$this->displayWarning($warning);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getQuickLinks()
|
||||
@@ -475,7 +486,7 @@ class AdminHomeControllerCore extends AdminController
|
||||
$result = array();
|
||||
$content = '';
|
||||
|
||||
$protocol = Tools::usingSecureMode() ? 'https' : 'http';
|
||||
$protocol = Tools::getCurrentUrlProtocolPrefix();
|
||||
$isoUser = Context::getContext()->language->iso_code;
|
||||
$isoCountry = Context::getContext()->country->iso_code;
|
||||
$stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => 2)));
|
||||
@@ -483,16 +494,15 @@ class AdminHomeControllerCore extends AdminController
|
||||
// SCREENCAST
|
||||
$result['screencast'] = 'OK';
|
||||
|
||||
|
||||
// PREACTIVATION
|
||||
$result['partner_preactivation'] = $this->getBlockPartners();
|
||||
|
||||
// DISCOVER PRESTASHOP
|
||||
$result['discover_prestashop'] = '<div id="block_tips">'.$this->getBlockDiscover().'</div>';
|
||||
$result['discover_prestashop'] .= '<div class="row-news"><div id="block_discover"><iframe frameborder="no" style="margin: 0px; padding: 0px; width: 100%; height:300px; overflow:hidden;" src="'.$protocol.'://api.prestashop.com/rss2/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe></div>';
|
||||
$result['discover_prestashop'] .= '<div class="row-news"><div id="block_discover"><iframe frameborder="no" style="margin: 0px; padding: 0px; width: 100%; height:300px; overflow:hidden;" src="'.$protocol.'api.prestashop.com/rss2/news2.php?v='._PS_VERSION_.'&lang='.$isoUser.'"></iframe></div>';
|
||||
|
||||
// SHOW TIPS OF THE DAY
|
||||
$content = Tools::file_get_contents($protocol.'://api.prestashop.com/partner/tipsoftheday/?protocol='.$protocol.'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser), false, $stream_context);
|
||||
$content = Tools::file_get_contents($protocol.'api.prestashop.com/partner/tipsoftheday/?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser), false, $stream_context);
|
||||
$content = explode('|', $content);
|
||||
if ($content[0] == 'OK' && Validate::isCleanHtml($content[1]))
|
||||
$result['discover_prestashop'] .= '<div id="block_partner_tips">'.$content[1].'</div></div>';
|
||||
@@ -518,7 +528,7 @@ class AdminHomeControllerCore extends AdminController
|
||||
{
|
||||
// Init var
|
||||
$return = '';
|
||||
$protocol = Tools::getShopProtocol();
|
||||
$protocol = Tools::getCurrentUrlProtocolPrefix();
|
||||
$isoCountry = Context::getContext()->country->iso_code;
|
||||
$isoUser = Context::getContext()->language->iso_code;
|
||||
|
||||
@@ -526,7 +536,7 @@ class AdminHomeControllerCore extends AdminController
|
||||
if (is_writable('../config/xml/') && (!file_exists('../config/xml/preactivation.xml') || (time() - filemtime('../config/xml/preactivation.xml')) > 86400))
|
||||
{
|
||||
$stream_context = @stream_context_create(array('http' => array('method'=> 'GET', 'timeout' => AdminHomeController::TIPS_TIMEOUT)));
|
||||
$content = Tools::file_get_contents('http://api.prestashop.com/partner/premium/get_partners.php?protocol='.$protocol.'&iso_country='.Tools::strtoupper($isoCountry).'&iso_lang='.Tools::strtolower($isoUser).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&host='.urlencode($_SERVER['HTTP_HOST']).'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')), false, $stream_context);
|
||||
$content = Tools::file_get_contents($protocol.'api.prestashop.com/partner/premium/get_partners.php?iso_country='.Tools::strtoupper($isoCountry).'&iso_lang='.Tools::strtolower($isoUser).'&ps_version='._PS_VERSION_.'&ps_creation='._PS_CREATION_DATE_.'&host='.urlencode($_SERVER['HTTP_HOST']), false, $stream_context);
|
||||
@unlink('../config/xml/preactivation.xml');
|
||||
file_put_contents('../config/xml/preactivation.xml', $content);
|
||||
}
|
||||
@@ -658,15 +668,12 @@ class AdminHomeControllerCore extends AdminController
|
||||
$smarty->assign('protocol', $protocol);
|
||||
$isoUser = $this->context->language->iso_code;
|
||||
$smarty->assign('isoUser', $isoUser);
|
||||
$upgrade = null;
|
||||
$tpl_vars['refresh_check_version'] = 0;
|
||||
if (@ini_get('allow_url_fopen'))
|
||||
{
|
||||
$upgrade = new Upgrader(true);
|
||||
// if this information is outdated, the version will be checked after page loading
|
||||
if (Configuration::get('PS_LAST_VERSION_CHECK') < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS))
|
||||
$tpl_vars['refresh_check_version'] = 1;
|
||||
}
|
||||
$upgrade = new Upgrader(true);
|
||||
|
||||
// if this information is outdated, the version will be checked after page loading
|
||||
if (Configuration::get('PS_LAST_VERSION_CHECK') < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS))
|
||||
$tpl_vars['refresh_check_version'] = 1;
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400))
|
||||
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
|
||||
|
||||
@@ -529,18 +529,16 @@ class AdminImagesControllerCore extends AdminController
|
||||
protected function _regenerateNoPictureImages($dir, $type, $languages)
|
||||
{
|
||||
$errors = false;
|
||||
foreach ($type as $imageType)
|
||||
{
|
||||
foreach ($type as $image_type)
|
||||
foreach ($languages as $language)
|
||||
{
|
||||
$file = $dir.$language['iso_code'].'.jpg';
|
||||
if (!file_exists($file))
|
||||
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))).'.jpg';
|
||||
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg'))
|
||||
if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)$imageType['width'], (int)$imageType['height']))
|
||||
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')).'.jpg';
|
||||
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($image_type['name']).'.jpg'))
|
||||
if (!ImageManager::resize($file, $dir.$language['iso_code'].'-default-'.stripslashes($image_type['name']).'.jpg', (int)$image_type['width'], (int)$image_type['height']))
|
||||
$errors = true;
|
||||
}
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,43 +117,22 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
|
||||
$this->content .= parent::renderList();
|
||||
}
|
||||
|
||||
public function initListManufacturerAddresses()
|
||||
|
||||
protected function getAddressFieldsList()
|
||||
{
|
||||
$this->toolbar_title = $this->l('Addresses');
|
||||
// reset actions and query vars
|
||||
$this->actions = array();
|
||||
unset($this->fields_list, $this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
|
||||
|
||||
$this->table = 'address';
|
||||
$this->identifier = 'id_address';
|
||||
$this->deleted = true;
|
||||
$this->_orderBy = null;
|
||||
|
||||
$this->addRowAction('editaddresses');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
// test if a filter is applied for this list
|
||||
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
|
||||
$this->filter = true;
|
||||
|
||||
// test if a filter reset request is required for this list
|
||||
if (isset($_POST['submitReset'.$this->table]))
|
||||
$this->action = 'reset_filters';
|
||||
else
|
||||
$this->action = '';
|
||||
|
||||
// Sub tab addresses
|
||||
$countries = Country::getCountries($this->context->language->id);
|
||||
foreach ($countries as $country)
|
||||
$this->countries_array[$country['id_country']] = $country['name'];
|
||||
|
||||
$this->fields_list = array(
|
||||
return array(
|
||||
'id_address' => array(
|
||||
'title' => $this->l('ID')
|
||||
),
|
||||
'manufacturer_name' => array(
|
||||
'title' => $this->l('Manufacturer')
|
||||
'title' => $this->l('Manufacturer'),
|
||||
'width' => 'auto',
|
||||
'filter_key' => 'm!name'
|
||||
),
|
||||
'firstname' => array(
|
||||
'title' => $this->l('First name')
|
||||
@@ -176,6 +155,32 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
'filter_key' => 'cl!id_country'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function initListManufacturerAddresses()
|
||||
{
|
||||
$this->toolbar_title = $this->l('Addresses');
|
||||
// reset actions and query vars
|
||||
$this->actions = array();
|
||||
unset($this->fields_list, $this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
|
||||
|
||||
$this->table = 'address';
|
||||
$this->list_id = 'address';
|
||||
$this->identifier = 'id_address';
|
||||
$this->deleted = true;
|
||||
$this->_orderBy = null;
|
||||
|
||||
$this->addRowAction('editaddresses');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
// test if a filter is applied for this list
|
||||
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
|
||||
$this->filter = true;
|
||||
|
||||
// test if a filter reset request is required for this list
|
||||
$this->action = (isset($_POST['submitReset'.$this->table]) ? 'reset_filters' : '');
|
||||
|
||||
$this->fields_list = $this->getAddressFieldsList();
|
||||
|
||||
$this->_select = 'cl.`name` as country, m.`name` AS manufacturer_name';
|
||||
$this->_join = '
|
||||
@@ -671,12 +676,13 @@ class AdminManufacturersControllerCore extends AdminController
|
||||
|
||||
public function initProcess()
|
||||
{
|
||||
if (Tools::getValue('submitAddaddress') || Tools::isSubmit('deleteaddress') || Tools::isSubmit('submitBulkdeleteaddress'))
|
||||
if (Tools::getValue('submitAddaddress') || Tools::isSubmit('deleteaddress') || Tools::isSubmit('submitBulkdeleteaddress') || Tools::isSubmit('exportaddress'))
|
||||
{
|
||||
$this->table = 'address';
|
||||
$this->className = 'Address';
|
||||
$this->identifier = 'id_address';
|
||||
$this->deleted = true;
|
||||
$this->fields_list = $this->getAddressFieldsList();
|
||||
}
|
||||
parent::initProcess();
|
||||
}
|
||||
|
||||
@@ -479,11 +479,21 @@ class AdminMetaControllerCore extends AdminController
|
||||
public function updateOptionPsRewritingSettings()
|
||||
{
|
||||
Configuration::updateValue('PS_REWRITING_SETTINGS', (int)Tools::getValue('PS_REWRITING_SETTINGS'));
|
||||
Tools::generateHtaccess($this->ht_file, null, null, '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'), false, Tools::getValue('PS_HTACCESS_DISABLE_MODSEC'));
|
||||
|
||||
Tools::enableCache();
|
||||
Tools::clearCache($this->context->smarty);
|
||||
Tools::restoreCacheSettings();
|
||||
if (Tools::generateHtaccess($this->ht_file, null, null, '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'), false, Tools::getValue('PS_HTACCESS_DISABLE_MODSEC')))
|
||||
{
|
||||
Tools::enableCache();
|
||||
Tools::clearCache($this->context->smarty);
|
||||
Tools::restoreCacheSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('PS_REWRITING_SETTINGS', 0);
|
||||
// Message copied/pasted from the information tip
|
||||
$message = $this->l('Before being able to use this tool, you need to:');
|
||||
$message .= '<br />- '.$this->l('Create a blank .htaccess in your root directory.');
|
||||
$message .= '<br />- '.$this->l('Give it write permissions (CHMOD 666 on Unix system)');
|
||||
$this->errors[] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateOptionPsRouteProductRule()
|
||||
|
||||
@@ -768,6 +768,11 @@ class AdminModulesControllerCore extends AdminController
|
||||
Tools::redirectAdmin('index.php?controller=adminmodules&configure='.Tools::getValue('module_name').'&token='.Tools::getValue('token').'&module_name='.Tools::getValue('module_name').$params);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
|
||||
}
|
||||
|
||||
if(isset($_GET['update']))
|
||||
{
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
|
||||
}
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
@@ -1014,6 +1019,14 @@ class AdminModulesControllerCore extends AdminController
|
||||
// Browse modules list
|
||||
foreach ($modules as $km => $module)
|
||||
{
|
||||
//Add succes message for one module update
|
||||
if (Tools::getValue('updated') && Tools::getValue('module_name'))
|
||||
{
|
||||
if ($module->name === (string)Tools::getValue('module_name'))
|
||||
$module_success[] = array('name' => $module->displayName, 'message' => array(
|
||||
0 => $this->l('Current version:').$module->version));
|
||||
}
|
||||
|
||||
//if we are in favorites view we only display installed modules
|
||||
if (Tools::getValue('select') == 'favorites' && !$module->id)
|
||||
{
|
||||
|
||||
@@ -399,20 +399,31 @@ class AdminModulesPositionsControllerCore extends AdminController
|
||||
if (!is_array($file_list))
|
||||
$file_list = ($file_list) ? array($file_list) : array();
|
||||
|
||||
$content = '<p><input type="text" name="exceptions['.$shop_id.']" size="40" value="'.implode(', ', $file_list).'" id="em_text_'.$shop_id.'"/></p>';
|
||||
$content = '<p><input type="text" name="exceptions['.$shop_id.']" value="'.implode(', ', $file_list).'" id="em_text_'.$shop_id.'"/></p>';
|
||||
|
||||
if ($shop_id)
|
||||
{
|
||||
$shop = new Shop($shop_id);
|
||||
$content .= ' ('.$shop->name.')';
|
||||
}
|
||||
|
||||
$content .= '<p>
|
||||
<select id="em_list_'.$shop_id.'">';
|
||||
<select id="em_list_'.$shop_id.'" multiple="multiple">
|
||||
<option disabled="disabled">'.$this->l('___________ CUSTOM ___________').'</option>';
|
||||
|
||||
// @todo do something better with controllers
|
||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
||||
ksort($controllers);
|
||||
|
||||
foreach ($file_list as $k => $v)
|
||||
if ( ! array_key_exists ($v, $controllers))
|
||||
$content .= '<option value="'.$v.'">'.$v.'</option>';
|
||||
|
||||
$content .= '<option disabled="disabled">'.$this->l('____________ CORE ____________').'</option>';
|
||||
|
||||
foreach ($controllers as $k => $v)
|
||||
$content .= '<option value="'.$k.'">'.$k.'</option>';
|
||||
|
||||
$content .= '</select>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -298,7 +298,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'{shipping_number}' => $order->shipping_number,
|
||||
'{order_name}' => $order->getUniqReference()
|
||||
);
|
||||
if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars,
|
||||
if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit'), $templateVars,
|
||||
$customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null,
|
||||
_PS_MAIL_DIR_, true, (int)$order->id_shop))
|
||||
{
|
||||
|
||||
@@ -117,7 +117,8 @@ class AdminPPreferencesControllerCore extends AdminController
|
||||
array('id' => '3', 'name' => $this->l('Product modified date')),
|
||||
array('id' => '4', 'name' => $this->l('Position inside category')),
|
||||
array('id' => '5', 'name' => $this->l('Manufacturer')),
|
||||
array('id' => '6', 'name' => $this->l('Product quantity'))
|
||||
array('id' => '6', 'name' => $this->l('Product quantity')),
|
||||
array('id' => '7', 'name' => $this->l('Product reference'))
|
||||
),
|
||||
'identifier' => 'id'
|
||||
),
|
||||
|
||||
@@ -116,12 +116,20 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Debug console Key'),
|
||||
'name' => 'smarty_console_key',
|
||||
'size' => 30,
|
||||
'desc' => $this->l('SMARTY_DEBUG parameter in the URL.')
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$this->fields_value['smarty_force_compile'] = Configuration::get('PS_SMARTY_FORCE_COMPILE');
|
||||
$this->fields_value['smarty_cache'] = Configuration::get('PS_SMARTY_CACHE');
|
||||
$this->fields_value['smarty_console'] = Configuration::get('PS_SMARTY_CONSOLE');
|
||||
$this->fields_value['smarty_console_key'] = Configuration::get('PS_SMARTY_CONSOLE_KEY');
|
||||
}
|
||||
|
||||
public function initFieldsetFeaturesDetachables()
|
||||
@@ -456,24 +464,6 @@ 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'),
|
||||
'icon' => 'icon-cloud'
|
||||
),
|
||||
'desc' =>
|
||||
'<div class="alert alert-block">
|
||||
<p>'.$this->l('Performance matters! Improve speed and conversions the easy way.').'</p>'.
|
||||
'<p>'.$this->l('CloudCache supercharges your site in minutes through its state-of-the-art content delivery network.').'</p>'.
|
||||
'<p>'.$this->l('Subscribe now using the code "presta25" and get an exclusive 25% monthly discount on every available package.').'</p>
|
||||
<p><a 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></p>
|
||||
</div>'
|
||||
);
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
// Initialize fieldset for a form
|
||||
@@ -483,7 +473,6 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
$this->initFieldsetMediaServer();
|
||||
$this->initFieldsetCiphering();
|
||||
$this->initFieldsetCaching();
|
||||
$this->initFieldsetCloudCache();
|
||||
|
||||
// Activate multiple fieldset
|
||||
$this->multiple_fieldsets = true;
|
||||
@@ -590,7 +579,8 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
Configuration::updateValue('PS_SMARTY_FORCE_COMPILE', Tools::getValue('smarty_force_compile', _PS_SMARTY_NO_COMPILE_));
|
||||
Configuration::updateValue('PS_SMARTY_CACHE', Tools::getValue('smarty_cache', 0));
|
||||
Configuration::updateValue('PS_SMARTY_CONSOLE', Tools::getValue('smarty_console', 0));
|
||||
$redirectAdmin = true;
|
||||
Configuration::updateValue('PS_SMARTY_CONSOLE_KEY', Tools::getValue('smarty_console_key', 'SMARTY_DEBUG'));
|
||||
$redirecAdmin = true;
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
@@ -821,4 +811,4 @@ class AdminPerformanceControllerCore extends AdminController
|
||||
die;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -800,8 +800,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if ($this->tabAccess['edit'] === '1')
|
||||
{
|
||||
|
||||
if ($this->isProductFieldUpdated('available_date_attribute') && !Validate::isDateFormat(Tools::getValue('available_date_attribute')))
|
||||
if ($this->isProductFieldUpdated('available_date_attribute') && (Tools::getValue('available_date_attribute') != '' &&!Validate::isDateFormat(Tools::getValue('available_date_attribute'))))
|
||||
$this->errors[] = Tools::displayError('Invalid date format.');
|
||||
else
|
||||
{
|
||||
@@ -2408,18 +2407,23 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
if ($product = $this->loadObject(true))
|
||||
{
|
||||
if ($this->tabAccess['edit'])
|
||||
{
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'short' => 'Save',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save'),
|
||||
);
|
||||
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
}
|
||||
|
||||
if ((bool)$product->id)
|
||||
{
|
||||
// adding button for delete this product
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add')
|
||||
$this->toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
|
||||
'desc' => $this->l('Delete this product.'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
|
||||
);
|
||||
|
||||
// adding button for duplicate this product
|
||||
if ($this->tabAccess['add'] && $this->display != 'add')
|
||||
$this->toolbar_btn['duplicate'] = array(
|
||||
@@ -2453,22 +2457,17 @@ class AdminProductsControllerCore extends AdminController
|
||||
'desc' => $this->l('New combination'),
|
||||
'class' => 'toolbar-new'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->tabAccess['edit'])
|
||||
{
|
||||
$this->toolbar_btn['save'] = array(
|
||||
'short' => 'Save',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save'),
|
||||
);
|
||||
|
||||
$this->toolbar_btn['save-and-stay'] = array(
|
||||
'short' => 'SaveAndStay',
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
);
|
||||
}
|
||||
|
||||
// adding button for delete this product
|
||||
if ($this->tabAccess['delete'] && $this->display != 'add')
|
||||
$this->toolbar_btn['delete'] = array(
|
||||
'short' => 'Delete',
|
||||
'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.(int)$product->id.'&deleteproduct',
|
||||
'desc' => $this->l('Delete this product.'),
|
||||
'confirm' => 1,
|
||||
'js' => 'if (confirm(\''.$this->l('Delete product?').'\')){return true;}else{event.preventDefault();}'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -69,75 +69,11 @@ class AdminShippingControllerCore extends AdminController
|
||||
<li>'.$this->l('Coupons are not taken into account when calculating free shipping').'</li>
|
||||
</ul>',
|
||||
'submit' => array()
|
||||
),
|
||||
'billing' => array(
|
||||
'title' => $this->l('Billing'),
|
||||
'icon' => 'money',
|
||||
'fields' => array(
|
||||
'PS_SHIPPING_METHOD' => array(
|
||||
'title' => $this->l('Billing'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'radio',
|
||||
'choices' => array(
|
||||
0 => $this->l('According to total price'),
|
||||
1 => $this->l('According to total weight')
|
||||
),
|
||||
'validation' => 'isBool'
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$array_carrier = array();
|
||||
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
|
||||
foreach ($carriers as $key => $carrier)
|
||||
if ($carrier['is_free'])
|
||||
unset($carriers[$key]);
|
||||
else
|
||||
$array_carrier[] = $carrier['id_carrier'];
|
||||
|
||||
$id_carrier = (int)Tools::getValue('id_carrier');
|
||||
|
||||
if (count($carriers) && isset($array_carrier[0]))
|
||||
{
|
||||
if (!$id_carrier)
|
||||
$id_carrier = (int)$array_carrier[0];
|
||||
|
||||
$carrierSelected = new Carrier((int)$id_carrier);
|
||||
}
|
||||
else
|
||||
$carrierSelected = new Carrier((int)$id_carrier);
|
||||
|
||||
$currency = $this->context->currency;
|
||||
$rangeObj = $carrierSelected->getRangeObject();
|
||||
$rangeTable = $carrierSelected->getRangeTable();
|
||||
$suffix = $carrierSelected->getRangeSuffix();
|
||||
|
||||
$rangeIdentifier = 'id_'.$rangeTable;
|
||||
$ranges = $rangeObj->getRanges($id_carrier);
|
||||
$delivery = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
|
||||
$deliveryArray = array();
|
||||
foreach ($delivery as $deliv)
|
||||
$deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'zones' => $carrierSelected->getZones(),
|
||||
'carriers' => $carriers,
|
||||
'ranges' => $ranges,
|
||||
'currency' => $currency,
|
||||
'deliveryArray' => $deliveryArray,
|
||||
'carrierSelected' => $carrierSelected,
|
||||
'id_carrier' => $id_carrier,
|
||||
'suffix' => $suffix,
|
||||
'rangeIdentifier' => $rangeIdentifier,
|
||||
'action_fees' => self::$currentIndex.'&token='.$this->token
|
||||
));
|
||||
|
||||
parent::initContent();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
|
||||
@@ -225,14 +225,6 @@ class AdminStatusesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (Tools::isSubmit('updateorder_state') || Tools::isSubmit('addorder_state'))
|
||||
return $this->renderOrderStatusForm();
|
||||
else if (Tools::isSubmit('updateorder_return_state') || Tools::isSubmit('addorder_return_state'))
|
||||
return $this->renderOrderReturnsForm();
|
||||
}
|
||||
|
||||
protected function renderOrderStatusForm()
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
@@ -362,7 +354,17 @@ class AdminStatusesControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (Tools::isSubmit('updateorder_state') || Tools::isSubmit('addorder_state'))
|
||||
return $this->renderOrderStatusForm();
|
||||
else if (Tools::isSubmit('updateorder_return_state') || Tools::isSubmit('addorder_return_state'))
|
||||
return $this->renderOrderReturnsForm();
|
||||
else
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
protected function renderOrderStatusForm()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class AdminStockInstantStateControllerCore extends AdminController
|
||||
),
|
||||
'valuation' => array(
|
||||
'title' => $this->l('Valuation'),
|
||||
'orderby' => true,
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
'type' => 'price',
|
||||
'currency' => true,
|
||||
@@ -88,7 +88,7 @@ class AdminStockInstantStateControllerCore extends AdminController
|
||||
'real_quantity' => array(
|
||||
'title' => $this->l('Real quantity'),
|
||||
'width' => 80,
|
||||
'orderby' => true,
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
'hint' => $this->l('Physical quantity (usable) - Client orders + Supply Orders'),
|
||||
),
|
||||
|
||||
@@ -40,6 +40,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$this->bootstrap = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->table = 'supply_order';
|
||||
|
||||
$this->className = 'SupplyOrder';
|
||||
$this->identifier = 'id_supply_order';
|
||||
$this->lang = false;
|
||||
@@ -457,6 +458,8 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$this->_where .= ' AND st.enclosed != 1';
|
||||
self::$currentIndex .= '&filter_status=on';
|
||||
}
|
||||
|
||||
$this->list_id = 'orders';
|
||||
$first_list = parent::renderList();
|
||||
|
||||
if (Tools::isSubmit('csv_orders') || Tools::isSubmit('csv_orders_details') || Tools::isSubmit('csv_order_details'))
|
||||
@@ -509,6 +512,8 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&mod=template&token='.$this->token,
|
||||
'desc' => $this->l('Add new template')
|
||||
);
|
||||
|
||||
$this->list_id = 'templates';
|
||||
// inits list
|
||||
$second_list = parent::renderList();
|
||||
|
||||
@@ -1061,9 +1066,12 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError($this->l('The date you specified cannot be in the past.'));
|
||||
|
||||
// gets threshold
|
||||
$quantity_threshold = null;
|
||||
if (Tools::getValue('load_products') && Validate::isInt(Tools::getValue('load_products')))
|
||||
$quantity_threshold = (int)Tools::getValue('load_products');
|
||||
$quantity_threshold = Tools::getValue('load_products');
|
||||
|
||||
if (is_numeric($quantity_threshold))
|
||||
$quantity_threshold = (int)$quantity_threshold;
|
||||
else
|
||||
$quantity_threshold = null;
|
||||
|
||||
if (!count($this->errors))
|
||||
{
|
||||
@@ -1082,15 +1090,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
//specific discount check
|
||||
$_POST['discount_rate'] = (float)str_replace(array(' ', ','), array('', '.'), Tools::getValue('discount_rate', 0));
|
||||
|
||||
}
|
||||
|
||||
// manage each associated product
|
||||
$this->manageOrderProducts();
|
||||
|
||||
// if the threshold is defined and we are saving the order
|
||||
if (Tools::isSubmit('submitAddsupply_order') && $quantity_threshold != null)
|
||||
$this->loadProducts($quantity_threshold);
|
||||
if (Tools::isSubmit('submitAddsupply_order') && Validate::isInt($quantity_threshold))
|
||||
$this->loadProducts((int)$quantity_threshold);
|
||||
}
|
||||
|
||||
// Manage state change
|
||||
@@ -1349,7 +1356,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
// first, converts the price to the default currency
|
||||
$price_converted_to_default_currency = Tools::convertPrice($supply_order_detail->unit_price_te, $supply_order->id_currency, false);
|
||||
|
||||
// then, converts the newly calculated price from the default currency to the needed currency
|
||||
// then, converts the newly calculated pri-ce from the default currency to the needed currency
|
||||
$price = Tools::ps_round(Tools::convertPrice($price_converted_to_default_currency,
|
||||
$warehouse->id_currency,
|
||||
true),
|
||||
@@ -1365,14 +1372,27 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$price,
|
||||
true,
|
||||
$supply_order->id);
|
||||
if ($res) // if product has been added
|
||||
|
||||
if (!$res)
|
||||
$this->errors[] = Tools::displayError($this->l('Something went wrong when adding products to the warehouse.'));
|
||||
|
||||
$location = Warehouse::getProductLocation($supply_order_detail->id_product,
|
||||
$supply_order_detail->id_product_attribute,
|
||||
$warehouse->id);
|
||||
|
||||
$res = Warehouse::setProductlocation($supply_order_detail->id_product,
|
||||
$supply_order_detail->id_product_attribute,
|
||||
$warehouse->id,
|
||||
$location ? $location : '');
|
||||
|
||||
if ($res)
|
||||
{
|
||||
$supplier_receipt_history->add();
|
||||
$supply_order_detail->save();
|
||||
$supply_order->save();
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError($this->l('Something went wrong when adding products to the warehouse.'));
|
||||
$this->errors[] = Tools::displayError($this->l('Something went wrong when setting warehouse on product record'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1951,7 +1971,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
*/
|
||||
protected function afterAdd($object)
|
||||
{
|
||||
if (Tools::getValue('load_products') && Validate::isInt(Tools::getValue('load_products')))
|
||||
if (is_numeric(Tools::getValue('load_products')))
|
||||
$this->loadProducts((int)Tools::getValue('load_products'));
|
||||
|
||||
$this->object = $object;
|
||||
@@ -2024,7 +2044,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$diff = (int)$threshold - (int)$real_quantity;
|
||||
}
|
||||
|
||||
if ($diff > 0)
|
||||
if ($diff >= 0)
|
||||
{
|
||||
// sets supply_order_detail
|
||||
$supply_order_detail = new SupplyOrderDetail();
|
||||
@@ -2037,7 +2057,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
$supply_order_detail->name = Product::getProductName($item['id_product'], $item['id_product_attribute'], $supply_order->id_lang);
|
||||
$supply_order_detail->ean13 = $item['ean13'];
|
||||
$supply_order_detail->upc = $item['upc'];
|
||||
$supply_order_detail->quantity_expected = (int)$diff;
|
||||
$supply_order_detail->quantity_expected = ((int)$diff == 0) ? 1 : (int)$diff;
|
||||
$supply_order_detail->exchange_rate = $order_currency->conversion_rate;
|
||||
|
||||
$product_currency = new Currency($item['id_currency']);
|
||||
|
||||
@@ -78,6 +78,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
public function getCustomListCategoriesEmpty()
|
||||
{
|
||||
$this->table = 'category';
|
||||
$this->list_id = 'empty_categories';
|
||||
$this->lang = true;
|
||||
$this->className = 'Category';
|
||||
$this->identifier = 'id_category';
|
||||
@@ -118,6 +119,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
return;
|
||||
|
||||
$this->table = 'product';
|
||||
$this->list_id = 'no_stock_products_attributes';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
@@ -162,6 +164,7 @@ class AdminTrackingControllerCore extends AdminController
|
||||
return;
|
||||
|
||||
$this->table = 'product';
|
||||
$this->list_id = 'no_stock_products';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
@@ -202,13 +205,13 @@ class AdminTrackingControllerCore extends AdminController
|
||||
public function getCustomListProductsDisabled()
|
||||
{
|
||||
$this->table = 'product';
|
||||
$this->list_id = 'disabled_products';
|
||||
$this->className = 'Product';
|
||||
$this->lang = true;
|
||||
$this->identifier = 'id_product';
|
||||
$this->_orderBy = 'id_product';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_filter = 'AND product_shop.`active` = 0';
|
||||
$this->list_no_filter = true;
|
||||
$this->tpl_list_vars = array('sub_title' => $this->l('List of disabled products:'));
|
||||
$this->show_toolbar = false;
|
||||
$this->_list_index = 'index.php?controller=AdminProducts';
|
||||
@@ -265,8 +268,17 @@ class AdminTrackingControllerCore extends AdminController
|
||||
|
||||
protected function clearFilters()
|
||||
{
|
||||
if ((Tools::isSubmit('submitResetcategory') && $this->table == 'category' ) || (Tools::isSubmit('submitResetproduct') && $this->table == 'product' ))
|
||||
$this->processResetFilters();
|
||||
if (Tools::isSubmit('submitResetcategory'))
|
||||
$this->processResetFilters('empty_categories');
|
||||
|
||||
if (Tools::isSubmit('submitResetproduct'))
|
||||
$this->processResetFilters('no_stock_products_attributes');
|
||||
|
||||
if (Tools::isSubmit('submitResetno_stock_products'))
|
||||
$this->processResetFilters('no_stock_products');
|
||||
|
||||
if (Tools::isSubmit('submitResetdisabled_products'))
|
||||
$this->processResetFilters('disabled_products');
|
||||
}
|
||||
|
||||
public function clearListOptions()
|
||||
@@ -280,7 +292,6 @@ class AdminTrackingControllerCore extends AdminController
|
||||
$this->_filter = '';
|
||||
$this->_group = '';
|
||||
$this->_where = '';
|
||||
$this->list_no_filter = true;
|
||||
$this->list_title = $this->l('Product disabled');
|
||||
}
|
||||
|
||||
|
||||
@@ -723,9 +723,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */
|
||||
if (Validate::isLangIsoCode($arr_import_lang[0]))
|
||||
{
|
||||
if ($content = Tools::file_get_contents(
|
||||
'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.Tools::strtolower($arr_import_lang[0]).'.gzip', false,
|
||||
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
|
||||
$content = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.Tools::strtolower($arr_import_lang[0]).'.gzip');
|
||||
if ($content)
|
||||
{
|
||||
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
|
||||
if ((bool)@file_put_contents($file, $content))
|
||||
@@ -2355,7 +2354,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
foreach ($files_by_directiories['php'] as $dir => $files)
|
||||
foreach ($files as $file)
|
||||
if (Tools::file_exists_cache($dir.$file) && is_file($dir.$file) && !in_array($file, self::$ignore_folder) && preg_match('/\.php$/', $file))
|
||||
// If file exist and is not in ignore_folder, in the next step we check if a folder or mail
|
||||
if (Tools::file_exists_cache($dir.$file) && !in_array($file, self::$ignore_folder))
|
||||
$subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
|
||||
|
||||
// Get path of directory for find a good path of translation file
|
||||
@@ -2411,30 +2411,37 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
*/
|
||||
protected function getSubjectMail($dir, $file, $subject_mail)
|
||||
{
|
||||
$content = file_get_contents($dir.'/'.$file);
|
||||
$content = str_replace("\n", ' ', $content);
|
||||
// If is file and is not in ignore_folder
|
||||
if (is_file($dir.'/'.$file) && !in_array($file, self::$ignore_folder) && preg_match('/\.php$/', $file))
|
||||
{
|
||||
$content = file_get_contents($dir.'/'.$file);
|
||||
$content = str_replace("\n", ' ', $content);
|
||||
|
||||
// Subject must match with a template, therefor we first grep the Mail::Send() function then the Mail::l() inside.
|
||||
if (preg_match_all('/Mail::Send([^;]*);/si', $content, $tab))
|
||||
for ($i = 0; isset($tab[1][$i]); $i++)
|
||||
// Subject must match with a template, therefor we first grep the Mail::Send() function then the Mail::l() inside.
|
||||
if (preg_match_all('/Mail::Send([^;]*);/si', $content, $tab))
|
||||
{
|
||||
$tab2 = explode(',', $tab[1][$i]);
|
||||
if (is_array($tab2) && isset($tab2[1]))
|
||||
for ($i = 0; isset($tab[1][$i]); $i++)
|
||||
{
|
||||
$template = trim(str_replace('\'', '', $tab2[1]));
|
||||
foreach ($tab2 as $tab3)
|
||||
if (preg_match('/Mail::l\(\''._PS_TRANS_PATTERN_.'\'\)/Us', $tab3.')', $matches))
|
||||
{
|
||||
if (!isset($subject_mail[$template]))
|
||||
$subject_mail[$template] = array();
|
||||
if (!in_array($matches[1], $subject_mail[$template]))
|
||||
$subject_mail[$template][] = $matches[1];
|
||||
}
|
||||
$tab2 = explode(',', $tab[1][$i]);
|
||||
if (is_array($tab2) && isset($tab2[1]))
|
||||
{
|
||||
$template = trim(str_replace('\'', '', $tab2[1]));
|
||||
foreach ($tab2 as $tab3)
|
||||
if (preg_match('/Mail::l\(\''._PS_TRANS_PATTERN_.'\'\)/Us', $tab3.')', $matches))
|
||||
{
|
||||
if (!isset($subject_mail[$template]))
|
||||
$subject_mail[$template] = array();
|
||||
if (!in_array($matches[1], $subject_mail[$template]))
|
||||
$subject_mail[$template][] = $matches[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!in_array($file, self::$ignore_folder) && is_dir($dir.'/'.$file))
|
||||
$subject_mail = $this->getSubjectMail($dir, $file, $subject_mail);
|
||||
}
|
||||
// Of if is colder, we scan colder for check if find in folder and subfolder
|
||||
else if (!in_array($file, self::$ignore_folder) && is_dir($dir.'/'.$file))
|
||||
foreach( scandir($dir.'/'.$file ) as $temp )
|
||||
$subject_mail = $this->getSubjectMail($dir.'/'.$file, $temp, $subject_mail);
|
||||
|
||||
return $subject_mail;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,9 @@ class AddressControllerCore extends FrontController
|
||||
$selected_country = (int)$this->_address->id_country;
|
||||
else if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
{
|
||||
$array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
// get all countries as language (xy) or language-country (wz-XY)
|
||||
$array = array();
|
||||
preg_match("#(?<=-)\w\w|\w\w(?!-)#",$_SERVER['HTTP_ACCEPT_LANGUAGE'],$array);
|
||||
if (!Validate::isLanguageIsoCode($array[0]) || !($selected_country = Country::getByIso($array[0])))
|
||||
$selected_country = (int)Configuration::get('PS_COUNTRY_DEFAULT');
|
||||
}
|
||||
|
||||
@@ -103,7 +103,9 @@ class AuthControllerCore extends FrontController
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
|
||||
{
|
||||
$array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||
// get all countries as language (xy) or language-country (wz-XY)
|
||||
$array = array();
|
||||
preg_match("#(?<=-)\w\w|\w\w(?!-)#",$_SERVER['HTTP_ACCEPT_LANGUAGE'],$array);
|
||||
if (!Validate::isLanguageIsoCode($array[0]) || !($sl_country = Country::getByIso($array[0])))
|
||||
$sl_country = (int)Configuration::get('PS_COUNTRY_DEFAULT');
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ class CartControllerCore extends FrontController
|
||||
protected $customization_id;
|
||||
protected $qty;
|
||||
|
||||
public $ssl = true;
|
||||
|
||||
protected $ajax_refresh = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -205,5 +205,13 @@ class CategoryControllerCore extends FrontController
|
||||
|
||||
$this->context->smarty->assign('nb_products', $this->nbProducts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get instance of current category
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,14 +155,18 @@ class OrderControllerCore extends ParentOrderController
|
||||
Tools::redirect('index.php?controller=order&step=2');
|
||||
Context::getContext()->cookie->check_cgv = true;
|
||||
|
||||
// Check the delivery option is setted
|
||||
// Check the delivery option is set
|
||||
if (!$this->context->cart->isVirtualCart())
|
||||
{
|
||||
if (!Tools::getValue('delivery_option') && !Tools::getValue('id_carrier') && !$this->context->cart->delivery_option && !$this->context->cart->id_carrier)
|
||||
Tools::redirect('index.php?controller=order&step=2');
|
||||
elseif (!Tools::getValue('id_carrier') && !$this->context->cart->id_carrier)
|
||||
{
|
||||
foreach (Tools::getValue('delivery_option') as $delivery_option)
|
||||
$deliveries_options = Tools::getValue('delivery_option');
|
||||
if (!$deliveries_options) {
|
||||
$deliveries_options = $this->context->cart->delivery_option;
|
||||
}
|
||||
foreach ($deliveries_options as $delivery_option)
|
||||
if (empty($delivery_option))
|
||||
Tools::redirect('index.php?controller=order&step=2');
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
if (Tools::getValue('ajax') != 'true')
|
||||
Tools::redirect('index.php?controller=order-detail&id_order='.(int)$idOrder);
|
||||
|
||||
$this->context->smarty->assign('message_confirmation', true);
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('Order not found');
|
||||
|
||||
@@ -28,6 +28,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
{
|
||||
public $php_self = 'order-opc';
|
||||
public $isLogged;
|
||||
|
||||
protected $ajax_refresh = false;
|
||||
|
||||
/**
|
||||
* Initialize order opc controller
|
||||
@@ -199,8 +201,28 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
}
|
||||
|
||||
// Address has changed, so we check if the cart rules still apply
|
||||
$cart_rules = $this->context->cart->getCartRules();
|
||||
CartRule::autoRemoveFromCart($this->context);
|
||||
CartRule::autoAddToCart($this->context);
|
||||
if ((int)Tools::getValue('allow_refresh'))
|
||||
{
|
||||
// If the cart rules has changed, we need to refresh the whole cart
|
||||
$cart_rules2 = $this->context->cart->getCartRules();
|
||||
if (count($cart_rules2) != count($cart_rules))
|
||||
$this->ajax_refresh = true;
|
||||
else
|
||||
{
|
||||
$rule_list = array();
|
||||
foreach ($cart_rules2 as $rule)
|
||||
$rule_list[] = $rule['id_cart_rule'];
|
||||
foreach ($cart_rules as $rule)
|
||||
if (!in_array($rule['id_cart_rule'], $rule_list))
|
||||
{
|
||||
$this->ajax_refresh = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->context->cart->isMultiAddressDelivery())
|
||||
$this->context->cart->setNoMultishipping(); // As the cart is no multishipping, set each delivery address lines with the main delivery address
|
||||
@@ -215,7 +237,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods(),
|
||||
'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency)))),
|
||||
'carrier_data' => $this->_getCarrierList()),
|
||||
'carrier_data' => $this->_getCarrierList(),
|
||||
'refresh' => (bool)$this->ajax_refresh),
|
||||
$this->getFormatedSummaryDetail()
|
||||
);
|
||||
die(Tools::jsonEncode($result));
|
||||
|
||||
@@ -40,6 +40,20 @@ class PageNotFoundControllerCore extends FrontController
|
||||
|
||||
if (in_array(Tools::strtolower(substr($_SERVER['REQUEST_URI'], -3)), array('png', 'jpg', 'gif')))
|
||||
{
|
||||
if ((bool)Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
preg_match('#([0-9]+)(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/(.+)\.(png|jpg|gif)$#', $_SERVER['REQUEST_URI'], $matches);
|
||||
if ((!isset($matches[2]) || empty($matches[2])) && !(bool)Configuration::get('PS_REWRITING_SETTINGS'))
|
||||
preg_match('#/([0-9]+)(\-[_a-zA-Z]*)\.(png|jpg|gif)$#', $_SERVER['REQUEST_URI'], $matches);
|
||||
|
||||
if (is_array($matches) && !empty($matches[2]) && Tools::strtolower(substr($matches[2], -8)) != '_default' && is_numeric($matches[1]))
|
||||
{
|
||||
$matches[2] = substr($matches[2], 1, Tools::strlen($matches[2])).'_default';
|
||||
if (!isset($matches[4]))
|
||||
$matches[4] = '';
|
||||
header('Location: '.$this->context->link->getImageLink($matches[4], $matches[1], $matches[2]), true, 302);
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: image/gif');
|
||||
readfile(_PS_IMG_DIR_.'404.gif');
|
||||
exit;
|
||||
|
||||
@@ -399,6 +399,7 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
// Getting a list of formated address fields with associated values
|
||||
$formatedAddressFieldsValuesList = array();
|
||||
|
||||
foreach ($customerAddresses as $i => $address)
|
||||
{
|
||||
if (!Address::isCountryActiveById((int)($address['id_address'])))
|
||||
@@ -411,6 +412,10 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
unset($tmpAddress);
|
||||
}
|
||||
|
||||
if (key($customerAddresses) != 0)
|
||||
$customerAddresses = array_values($customerAddresses);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'addresses' => $customerAddresses,
|
||||
'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList));
|
||||
|
||||
@@ -40,6 +40,7 @@ class PasswordControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('Invalid email address.');
|
||||
else
|
||||
{
|
||||
|
||||
$customer = new Customer();
|
||||
$customer->getByemail($email);
|
||||
if (!Validate::isLoadedObject($customer))
|
||||
@@ -57,7 +58,7 @@ class PasswordControllerCore extends FrontController
|
||||
'{url}' => $this->context->link->getPageLink('password', true, null, 'token='.$customer->secure_key.'&id_customer='.(int)$customer->id)
|
||||
);
|
||||
if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname.' '.$customer->lastname))
|
||||
$this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
|
||||
$this->context->smarty->assign(array('confirmation' => 2, 'customer_email' => $customer->email));
|
||||
else
|
||||
$this->errors[] = Tools::displayError('An error occurred while sending the email.');
|
||||
}
|
||||
@@ -90,7 +91,7 @@ class PasswordControllerCore extends FrontController
|
||||
'{passwd}' => $password
|
||||
);
|
||||
if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname.' '.$customer->lastname))
|
||||
$this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
|
||||
$this->context->smarty->assign(array('confirmation' => 1, 'customer_email' => $customer->email));
|
||||
else
|
||||
$this->errors[] = Tools::displayError('An error occurred while sending the email.');
|
||||
}
|
||||
|
||||
@@ -158,8 +158,7 @@ class ProductControllerCore extends FrontController
|
||||
$this->category = new Category($regs[5], (int)$this->context->cookie->id_lang);
|
||||
}
|
||||
}
|
||||
if ( ! isset($this->category))
|
||||
// Set default product category
|
||||
if (!isset($this->category))
|
||||
$this->category = new Category($this->product->id_category_default, (int)$this->context->cookie->id_lang);
|
||||
}
|
||||
}
|
||||
@@ -659,4 +658,9 @@ class ProductControllerCore extends FrontController
|
||||
}
|
||||
return $specific_prices;
|
||||
}
|
||||
|
||||
public function getProduct()
|
||||
{
|
||||
return $this->product;
|
||||
}
|
||||
}
|
||||
+2666
-1
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
|
||||
id;Active (0/1);Name*;Categories (x,y,z,...);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Weight;Quantity;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Image URLs (x,y,z,...);Feature;Only available online
|
||||
1;1;iPod Nano;Home, iPods;49;1;;1;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;;;;0.5;800;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;;;;ipod-nano;In stock;;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;;
|
||||
2;1;iPod shuffle;Home, iPods;66.05;1;79;1;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;;;;0;500;iPod shuffle, the world’s most wearabl….;;ipod, shuffle;;;;ipod-shuffle;In stock;;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;;
|
||||
id;Active (0/1);Name*;Categories (x,y,z,...);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Weight;Quantity;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Available for order (0 = No, 1 = Yes);Product creation date;Show price (0 = No, 1 = Yes);Image URLs (x,y,z,...);Delete existing images (0 = No, 1 = Yes);Feature (Name:Value:Position);Available online only (0 = No, 1 = Yes);Condition (new,used,refurbished);ID / Name of shop
|
||||
1;1;iPod Nano;Home, iPods;49;1;;1;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;;;;0.5;800;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;;;;ipod-nano;In stock;Out stock;1;;1;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;1;;0;new;1
|
||||
2;1;iPod shuffle;Home, iPods;66.05;1;79;1;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;;;;0;500;iPod shuffle, the world’s most wearabl….;;ipod, shuffle;;;;ipod-shuffle;In stock;Out stock;1;;1;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;1;;0;new;1
|
||||
|
||||
|
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -81,12 +81,15 @@ class InstallXmlLoader
|
||||
$this->img_path = _PS_INSTALL_DATA_PATH_.'img/';
|
||||
}
|
||||
|
||||
public function setFixturesPath()
|
||||
public function setFixturesPath($path = null)
|
||||
{
|
||||
if ($path === null)
|
||||
$path = _PS_INSTALL_FIXTURES_PATH_.'apple/';
|
||||
|
||||
$this->path_type = 'fixture';
|
||||
$this->data_path = _PS_INSTALL_FIXTURES_PATH_.'apple/data/';
|
||||
$this->lang_path = _PS_INSTALL_FIXTURES_PATH_.'apple/langs/';
|
||||
$this->img_path = _PS_INSTALL_FIXTURES_PATH_.'apple/img/';
|
||||
$this->data_path = $path.'data/';
|
||||
$this->lang_path = $path.'langs/';
|
||||
$this->img_path = $path.'img/';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -693,16 +696,12 @@ class InstallXmlLoader
|
||||
|
||||
if (is_null($tables))
|
||||
{
|
||||
$sql = 'SHOW TABLES';
|
||||
$tables = array();
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
foreach (Db::getInstance()->executeS('SHOW TABLES') as $row)
|
||||
{
|
||||
$table = current($row);
|
||||
if (preg_match('#^'._DB_PREFIX_.'(.+?)(_lang)?$#i', $table, $m))
|
||||
if (preg_match('#^'._DB_PREFIX_.'(.+?)_shop$#i', $table, $m2) && !isset($tables[$m2[1]]))
|
||||
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
|
||||
else
|
||||
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
|
||||
$tables[$m[1]] = (isset($m[2]) && $m[2]) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user