Qloapps / QloApps

QloApps is a Free and Open-source hotel management and reservation system to take a hotel business online. QloApps offers a Property Management System (PMS), a Booking Engine, and an attractive Hotel Website. Elevate hotel operations with QloApps to streamline processes and provide an enhanced experience for both hoteliers and guests.
https://qloapps.com
Open Software License 3.0
4.55k stars 503 forks source link

Add new rooms programmatically. #97

Open piyushvostro opened 4 years ago

piyushvostro commented 4 years ago

How to add new rooms programmatically from custom modules?

sumitwebkul commented 4 years ago

@piyushvostro

To save the room information of a room type you have to make an entry in the htl_room_information table. Its related class is "HotelRoomInformation".

To save the disable dates information of a room, you have to make entries in the table htl_room_disable_dates. Its related class is "HotelRoomDisableDates".

Find all the above classes and tables in the module "hotelreservationsystem".

piyushvostro commented 4 years ago

Hello sir, can I have your email for an easy communication?

sumitwebkul commented 4 years ago

@piyushvostro You can post here your issues. Here you will get your replies easily. There was a delay in the previous reply because of the situation due to coronavirus.

Thanks

piyushvostro commented 4 years ago

I have to create rooms(product) programmatically from a custom module. for this I am using this method -

_$default_lang = Configuration::get('PS_LANG_DEFAULT'); $product = new Product(); $product->price = 2600; $product->id_supplier = 1; $product->quantity = 1; $product->save(); $product->id_category = 1; $product->id_category_default = 1; if($product->add()) { $product->updateCategories($product->idcategory); StockAvailable::setQuantity((int)$product->id,0,$product->quantity, Context::getContext()->shop->id); }

This code is successfully creating a new product as can be seen in 'manage room types' tab under catalog tab in admin panel and also a new entry is created in _psproduct table.

But how should I save additional information of this product (name, short_desc, desc, etc). As these details are saved in another table i.e _ps-productlang.

Thanks in Anticipation.

sumitwebkul commented 4 years ago

@piyushvostro

We have built this software on the Prestashop eCommerce platform. We have used the product entity in Prestashop as the room type in QloApps. So we recommend you to follow the dev docs of Prestashop for the development help.

The room was additionally added and we have told ou the process to add rooms in the previous reply.