diff --git a/adm/tabs/AdminProducts.php b/adm/tabs/AdminProducts.php index 2d6c9094..4cb5869a 100755 --- a/adm/tabs/AdminProducts.php +++ b/adm/tabs/AdminProducts.php @@ -297,6 +297,33 @@ class AdminProducts extends AdminTab Tools::redirectAdmin($currentIndex.(Tools::getValue('id_category') ? '&id_category='.Tools::getValue('id_category') : '').'&token='.($token ? $token : $this->token)); } + if (Tools::isSubmit('disableproduct') || Tools::isSubmit('reactiveproduct')) { + global $cookie, $currentIndex; + $products = array(); + $query = Db::getInstance()->ExecuteS(' + SELECT `id_product` + FROM `'._DB_PREFIX_.'category_product` + WHERE `id_category` = '.(int)$this->_category->id + ); + foreach($query as $p){ + $products[] = (int)$p['id_product']; + } + + if(Tools::isSubmit('disableproduct')){ + $active = 0; + } elseif(Tools::isSubmit('reactiveproduct')) { + $active = 1; + } + + if(isset($active)) { + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'product` + SET `active` = '.(int)$active.' + WHERE `id_product` IN ('.implode(',', $products).')' + ); + } + } + if (Tools::isSubmit('reorderproduct') || Tools::isSubmit('reordersubproduct')) { global $cookie, $currentIndex; @@ -2031,6 +2058,16 @@ class AdminProducts extends AdminTab echo '

'.$this->l('Re-Order by product position, clean all position of the category').'

'; } + if((int)$this->_category->id_parent >= 1){ + echo '
'; + echo '

Désactiver/Réactiver les produits

'; + echo '

+ + +

'; + echo '

'.$this->l('Désactive ou réactive les produits de manière globale (dans toute leur catégorie)').'

'; + } + echo ''; if (isset($this->_includeTab) AND sizeof($this->_includeTab)) echo '

';