/** * @return bool */ protected function processBulkDelete() { if (is_array($this->boxes) && !empty($this->boxes)) { foreach ($this->boxes as $iIdNowBlockCustomerReferences) { $oNowBlockCustomerReferences = new NowBlockCustomerReferences((int) $iIdNowBlockCustomerReferences); if (!$oNowBlockCustomerReferences->deleteImage()) { $this->errors[] = Tools::displayError('An error occurred while deleting image of the object (NowBlockCustomerReferences).') . ' <b>' . $this->table . '</b> '; return false; } } } return parent::processBulkDelete(); }
protected function processBulkDelete() { if (is_array($this->boxes) && !empty($this->boxes)) { foreach ($this->boxes as $key => $value) { $obj_branch_features = new HotelBranchFeatures(); $obj_htl_cart_data = new HotelCartBookingData(); $obj_htl_img = new HotelImage(); $obj_htl_rm_info = new HotelRoomInformation(); $obj_htl_rm_type = new HotelRoomType(); $ids_product = $obj_htl_rm_type->getIdProductByHotelId($value); if (isset($ids_product) && $ids_product) { foreach ($ids_product as $key_prod => $value_prod) { $delete_cart_data = $obj_htl_cart_data->deleteBookingCartDataNotOrderedByProductId($value_prod['id_product']); $delete_room_info = $obj_htl_rm_info->deleteByProductId($value_prod['id_product']); $delete_room_type = $obj_htl_rm_type->deleteByProductId($value_prod['id_product']); $obj_product = new Product($value_prod['id_product']); $delete_product = $obj_product->delete(); } } $delete_branch_features = $obj_branch_features->deleteBranchFeaturesByHotelId($object->id); $htl_all_images = $obj_htl_img->getAllImagesByHotelId($object->id); foreach ($htl_all_images as $key_img => $value_img) { $path_img = _PS_MODULE_DIR_ . 'hotelreservationsystem/views/img/hotel_img/' . $value_img['hotel_image_id'] . '.jpg'; @unlink($path_img); } $delete_htl_img = $obj_htl_img->deleteByHotelId($object->id); } parent::processBulkDelete(); } else { $this->errors[] = Tools::displayError('You must select at least one element to delete.'); } }