// fix in product page edition after deleting pack and save, some javascript function were not loaded
This commit is contained in:
@@ -79,21 +79,23 @@
|
||||
<script type="text/javascript">
|
||||
var token = '{$token}';
|
||||
var id_product = {if isset($product->id)}{$product->id}{else}0{/if};
|
||||
var defaultLanguage = {$defaultLanguage};
|
||||
|
||||
var product_type_pack = {Product::PTYPE_PACK};
|
||||
var product_type_virtual = {Product::PTYPE_VIRTUAL};
|
||||
var product_type_simple = {Product::PTYPE_SIMPLE};
|
||||
|
||||
var toload = new Array();
|
||||
var empty_pack_msg = '{l s='Pack is empty. You need to add at least one product to the pack before you can save it.'}';
|
||||
var empty_name_msg = '{l s='Product name is empty. You need to enter a name at least for the default language before you can save it.'}';
|
||||
var empty_link_rewrite_msg = '{l s='Friendly URL is empty. You need to enter a friendly url at least for the default language before you can save it.'}';
|
||||
var empty_pack_msg = '{l s='Pack is empty. You need to add at least one product to the pack before you can save it.' slashes=1}';
|
||||
var empty_name_msg = '{l s='Product name is empty. You need to enter a name at least for the default language before you can save it.' slashes=1}';
|
||||
var empty_link_rewrite_msg = '{l s='Friendly URL is empty. You need to enter a friendly url at least for the default language before you can save it.' slashes=1}';
|
||||
$('#product-tab-content-wait').show();
|
||||
var post_data = {$post_data};
|
||||
|
||||
var product_type;
|
||||
$(document).ready(function()
|
||||
{
|
||||
product_type = $("input[name=type_product]:checked").val();
|
||||
$('#product-tab-content-wait').show();
|
||||
{if $is_pack}
|
||||
$('#pack_product').attr('checked', 'checked');
|
||||
|
||||
@@ -2101,6 +2101,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->getLanguages();
|
||||
$languages = $this->_languages;
|
||||
$default_language = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$this->tpl_form_vars['defaultLanguage'] = Language::getLanguage($default_language);
|
||||
|
||||
$this->tpl_form_vars['currentIndex'] = self::$currentIndex;
|
||||
$this->fields_form = array('');
|
||||
|
||||
@@ -316,6 +316,7 @@ function enableSave()
|
||||
|
||||
function handleSaveButtons(e)
|
||||
{
|
||||
product_type = $("input[name=type_product]:checked").val();
|
||||
msg = [];
|
||||
var i = 0;
|
||||
// relative to type of product
|
||||
@@ -333,8 +334,8 @@ function handleSaveButtons(e)
|
||||
{
|
||||
msg[i++] = empty_name_msg;
|
||||
}
|
||||
// friendly_url_[defaultlangid]
|
||||
if ($("#link_rewrite_"+defaultLanguage.id_lang).val() == "")
|
||||
// check friendly_url_[defaultlangid] only if name is ok
|
||||
else if ($("#link_rewrite_"+defaultLanguage.id_lang).val() == "")
|
||||
msg[i++] = empty_link_rewrite_msg;
|
||||
|
||||
if (msg.length == 0)
|
||||
|
||||
Reference in New Issue
Block a user