protected function processBulkDelete()
 {
     if ($this->tabAccess['delete'] === '1') {
         $cats_ids = array();
         foreach (Tools::getValue($this->table . 'Box') as $id_category) {
             $category = new Category((int) $id_category);
             if (!$category->isRootCategoryForAShop()) {
                 $cats_ids[$category->id] = $category->id_parent;
             }
         }
         if (parent::processBulkDelete()) {
             $this->setDeleteMode();
             foreach ($cats_ids as $id => $id_parent) {
                 $this->processFatherlessProducts((int) $id_parent);
             }
             return true;
         } else {
             return false;
         }
     } else {
         $this->errors[] = Tools::displayError('You do not have permission to delete here.');
     }
 }
 protected function processBulkDelete()
 {
     if ($this->access('delete')) {
         $cats_ids = array();
         foreach (Tools::getValue($this->table . 'Box') as $id_category) {
             $category = new Category((int) $id_category);
             if (!$category->isRootCategoryForAShop()) {
                 $cats_ids[$category->id] = $category->id_parent;
             }
         }
         if (parent::processBulkDelete()) {
             $this->setDeleteMode();
             foreach ($cats_ids as $id => $id_parent) {
                 $this->processFatherlessProducts((int) $id_parent);
             }
             return true;
         } else {
             return false;
         }
     } else {
         $this->errors[] = $this->trans('You do not have permission to delete this.', array(), 'Admin.Notifications.Error');
     }
 }
Example #3
0
 /**
  * Delete several categories from database
  *
  * return boolean Deletion result
  */
 public function deleteSelection($categories)
 {
     $return = 1;
     foreach ($categories as $id_category) {
         $category = new Category($id_category);
         if ($category->isRootCategoryForAShop()) {
             return false;
         } else {
             $return &= $category->delete();
         }
     }
     return $return;
 }
 protected function processBulkDelete()
 {
     $cats_ids = array();
     foreach (Tools::getValue($this->table . 'Box') as $id_category) {
         $category = new Category((int) $id_category);
         if (!$category->isRootCategoryForAShop()) {
             $cats_ids[$category->id] = $category->id_parent;
         }
     }
     if (parent::processBulkDelete()) {
         $this->setDeleteMode();
         foreach ($cats_ids as $id => $id_parent) {
             $this->processFatherlessProducts((int) $id_parent);
         }
         return true;
     } else {
         return false;
     }
 }