Merge branch 'ticket-13532-ProductDisable' into develop
This commit is contained in:
commit
d1e71015d5
@ -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 '<p>'.$this->l('Re-Order by product position, clean all position of the category').'</p>';
|
||||
}
|
||||
|
||||
if((int)$this->_category->id_parent >= 1){
|
||||
echo '<hr>';
|
||||
echo '<h2>Désactiver/Réactiver les produits</h2>';
|
||||
echo '<p>
|
||||
<input type="submit" class="button" name="disable'.$this->table.'" value="'.$this->l('Désactiver les produits de la catégorie').'" />
|
||||
<input type="submit" class="button" name="reactive'.$this->table.'" value="'.$this->l('Activer les produits de la catégorie').'" />
|
||||
</p>';
|
||||
echo '<p>'.$this->l('Désactive ou réactive les produits de manière globale (dans toute leur catégorie)').'</p>';
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
if (isset($this->_includeTab) AND sizeof($this->_includeTab))
|
||||
echo '<br /><br />';
|
||||
|
Loading…
Reference in New Issue
Block a user