Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new rooms programmatically. #97

Open
piyushvostro opened this issue Mar 20, 2020 · 5 comments
Open

Add new rooms programmatically. #97

piyushvostro opened this issue Mar 20, 2020 · 5 comments

Comments

@piyushvostro
Copy link

How to add new rooms programmatically from custom modules?

@sumitwebkul
Copy link
Contributor

sumitwebkul commented Mar 24, 2020

@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
Copy link
Author

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

@sumitwebkul
Copy link
Contributor

@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
Copy link
Author

piyushvostro commented Mar 25, 2020

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->id_category);
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 ps_product 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-product_lang.

Thanks in Anticipation.

@sumitwebkul
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants