/** * @param Product $obj * @throws Exception * @throws PrestaShopException * @throws SmartyException */ public function initFormConfiguration($obj) { $data = $this->createTemplate($this->tpl_form); if ($obj->id) { if ($this->product_exists_in_shop) { $obj_htl_info = new HotelBranchInformation(); $htl_info = $obj_htl_info->hotelsNameAndId(); if ($htl_info) { $obj_room_status = new HotelRoomStatus(); $rm_status = $obj_room_status->getAllRoomStatus(); $obj_room_type = new HotelRoomType(); $htl_room_type = $obj_room_type->getRoomTypeInfoByIdProduct($obj->id); if ($htl_room_type) { $data->assign('htl_room_type', $htl_room_type); $htl_full_info = $obj_htl_info->hotelBranchInfoById($htl_room_type['id_hotel']); $data->assign('htl_full_info', $htl_full_info); $obj_room_info = new HotelRoomInformation(); $htl_room_info = $obj_room_info->getHotelRoomInfo($obj->id, $htl_room_type['id_hotel']); if ($htl_room_info) { $data->assign('htl_room_info', $htl_room_info); } } $data->assign(array('product' => $obj, 'htl_info' => $htl_info, 'rm_status' => $rm_status)); } else { $this->displayWarning($this->l('Add Hotel Before configurate this product.')); } } else { $this->displayWarning($this->l('You must save the product in this shop before managing hotel configuration.')); } } else { $this->displayWarning($this->l('You must save this product before managing hotel configuration.')); } $this->tpl_form_vars['custom_form'] = $data->fetch(); }
public function insertHotelRoomsStatus() { $room_status_arr = array('Available', 'Unavailable', 'Hold For Maintenance'); foreach ($room_status_arr as $key => $value) { $obj_room_status = new HotelRoomStatus(); $obj_room_status->status = $value; $obj_room_status->save(); } return true; }