[-] BO : BugFix : #PSCFV-3537 : Product Indexing lost when editing a product

This commit is contained in:
vChabot
2012-08-06 14:09:44 +00:00
parent 3b90e52bc3
commit 160943868a
2 changed files with 26 additions and 0 deletions
@@ -114,6 +114,10 @@
{/block}
{block name="script"}
var ids_category = new Array();
{foreach $ids_category as $key => $id_category}
ids_category[{$key}] = {$id_category};
{/foreach}
$(document).ready(function() {
$('input[name=useImportData]').click(function() {
if ($(this).attr('id') == 'useImportData_on')
@@ -121,5 +125,21 @@
else
$('#shop_list, #data_list').slideUp('slow');
});
$('#id_category, #importFromShop').change(function(){
shop_id = $('#importFromShop').val();
category_id = $('#id_category').val();
if (ids_category[shop_id] != category_id)
disableProductsDuplication();
else
enableProductsDuplication();
});
});
function disableProductsDuplication()
{
$('input[name="importData[product_attribute]"], input[name="importData[image]"], input[name="importData[product]"], input[name="importData[stock_available]"], input[name="importData[discount]"]').removeAttr('checked').attr('disabled', 'disabled');
}
function enableProductsDuplication()
{
$('input[name="importData[product_attribute]"], input[name="importData[image]"], input[name="importData[product]"], input[name="importData[stock_available]"], input[name="importData[discount]"]').removeAttr('disabled').attr('checked', 'checked');
}
{/block}
@@ -521,10 +521,16 @@ class AdminShopControllerCore extends AdminController
'id_theme_checked' => (isset($obj->id_theme) ? $obj->id_theme : $id_theme)
);
$ids_category = array();
$shops = Shop::getShops(false);
foreach ($shops as $shop)
$ids_category[$shop['id_shop']] = $shop['id_category'];
$this->tpl_form_vars = array(
'disabled' => $disabled,
'checked' => (Tools::getValue('addshop') !== false) ? true : false,
'defaultShop' => (int)Configuration::get('PS_SHOP_DEFAULT'),
'ids_category' => $ids_category,
);
if (isset($this->fields_import_form))
$this->tpl_form_vars = array_merge($this->tpl_form_vars, array('form_import' => $this->fields_import_form));