public function processSave() { if (Tools::getValue('addfeatures')) { } else { $edit_id = Tools::getValue('edit_hotel_id'); if ($edit_id) { $delete_existing_vals = Db::getInstance()->delete('htl_branch_features', 'id_hotel=' . $edit_id); } $id_hotel = Tools::getValue('id_hotel'); if ($id_hotel) { $hotel_features = Tools::getValue('hotel_fac'); $obj_hotel_features = new HotelBranchFeatures(); $assigned = $obj_hotel_features->assignFeaturesToHotel($id_hotel, $hotel_features); if (!$assigned) { $this->errors[] = Tools::displayError('Some problem occure while assigning Features to the hotel.'); } if (empty($this->errors)) { if (Tools::isSubmit('submitAdd' . $this->table . 'AndStay')) { Tools::redirectAdmin(self::$currentIndex . '&id=' . (int) $id_hotel . '&update' . $this->table . '&conf=3&token=' . $this->token); } else { if ($edit_id) { Tools::redirectAdmin(self::$currentIndex . '&conf=4&token=' . $this->token); } else { Tools::redirectAdmin(self::$currentIndex . '&conf=3&token=' . $this->token); } } } else { if ($hotel_id) { $this->display = 'edit'; } else { $this->display = 'add'; } } } else { $this->errors[] = Tools::displayError('Please select a hotel first.'); $this->display = 'add'; } } }