diff --git a/admin-dev/themes/template/modules/js.tpl b/admin-dev/themes/template/modules/js.tpl
index ad8613a0b..0aa9401d5 100644
--- a/admin-dev/themes/template/modules/js.tpl
+++ b/admin-dev/themes/template/modules/js.tpl
@@ -77,6 +77,50 @@
});
});
+
+
+
+ // Method to reload filter in ajax
+ $(document).ready(function(){
+ $('.categoryModuleFilterLink').click(function()
+ {
+ $('.categoryModuleFilterLink').css('background-color', 'white');
+ $(this).css('background-color', '#EBEDF4');
+ var ajaxReloadCurrentIndex = $(this).find('a').attr('href').replace('index.php', 'ajax-tab.php');
+ try
+ {
+ resAjax = $.ajax({
+ type:"POST",
+ url : ajaxReloadCurrentIndex,
+ async: true,
+ data : {
+ ajax : "1",
+ token : token,
+ controller : "AdminModules",
+ action : "reloadModulesList",
+ },
+ beforeSend: function(xhr)
+ {
+ $('#moduleContainer').html('
');
+ },
+ success : function(data)
+ {
+ $('#moduleContainer').html(data);
+ },
+ error: function(res,textStatus,jqXHR)
+ {
+ //alert("TECHNICAL ERROR"+res);
+ }
+ });
+ }
+ catch(e){}
+ return false;
+ });
+ });
+
+
+
+
// Method to get modules_list.xml from prestashop.com and default_country_modules_list.xml from addons.prestashop.com
$(document).ready(function(){
try
diff --git a/admin-dev/themes/template/modules/page.tpl b/admin-dev/themes/template/modules/page.tpl
index 50a9cb26f..dedadc297 100644
--- a/admin-dev/themes/template/modules/page.tpl
+++ b/admin-dev/themes/template/modules/page.tpl
@@ -55,7 +55,7 @@
{$nb_modules}
{foreach from=$list_modules_categories item=module_category key=module_category_key}
- -
+
-
{$module_category.nb}
diff --git a/classes/Module.php b/classes/Module.php
index 941cc7b5a..3b3c2e87a 100644
--- a/classes/Module.php
+++ b/classes/Module.php
@@ -785,8 +785,8 @@ abstract class ModuleCore
}
}
- //echo '
'.print_r($moduleList, 1).'
';
- echo round($current_memory / 1024 / 1024, 2).'Mo
';
+
+ //echo round($current_memory / 1024 / 1024, 2).'Mo
';
if ($errors)
{
diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php
index bfef5be68..96cf63973 100644
--- a/controllers/admin/AdminModulesController.php
+++ b/controllers/admin/AdminModulesController.php
@@ -218,6 +218,21 @@ class AdminModulesControllerCore extends AdminController
die('OK');
}
+ public function ajaxProcessReloadModulesList()
+ {
+ if (Tools::getValue('filterCategory'))
+ Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, Tools::getValue('filterCategory'));
+ if (Tools::getValue('unfilterCategory'))
+ Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, '');
+
+ $this->initContent();
+ $this->context->smarty->display('modules/list.tpl');
+ exit;
+ }
+
+
+
+
/*
** Get current URL
@@ -333,45 +348,15 @@ class AdminModulesControllerCore extends AdminController
public function postProcessFilterCategory()
{
- // Retrieve filter categories configuration and the new filter category
- $filterCategory = Tools::getValue('filterCategory');
- $filterCategories = explode('|', Configuration::get('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee));
-
- // Check if category filter not already exists
- foreach ($filterCategories as $fc)
- if ($fc == $filterCategories)
- $filterCategories = '';
-
- // If not, add the new filter
- if ($filterCategories != '')
- $filterCategories[] = $filterCategory;
- $filterCategories = implode('|', $filterCategories);
-
- // For the moment, we will filter only one category a time
- $filterCategories = $filterCategory;
-
// Save configuration and redirect employee
- Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, $filterCategories);
+ Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, Tools::getValue('filterCategory'));
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}
public function postProcessUnfilterCategory()
{
- // Retrieve filter categories configuration and the filter category to remove
- $unfilterCategory = Tools::getValue('unfilterCategory');
- $filterCategories = explode('|', Configuration::get('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee));
-
- // Remove the filter category
- foreach ($filterCategories as $k => $fc)
- if ($fc == $unfilterCategory)
- unset($filterCategories[$k]);
-
- // For the moment, we will filter only one category a time
- $filterCategories = '';
-
// Save configuration and redirect employee
- $filterCategories = implode('|', $filterCategories);
- Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, $filterCategories);
+ Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, '');
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}