简体   繁体   中英

Magento product attribute + custom properties?

I'm trying to set up a hotel reservation system using Magento, and I'm a bit lost with the following issue:

Each room has the attribute values for MaxOccupancy, MaxAdults, MaxChildren and MaxBabies set up by the administrator, detailing how many people can stay in some room (For instance, in some cases, even if MaxOccupancy is not exceeded, the hotel has rules for how many children can stay in any room).

I also need to allow the customer to specify how many people s/he's trying to reserve for. I think it should be done using custom options (eg, dropdowns for Adults/Children/Babies), but it looks like connecting all that (including that the dropdowns need to be populated using only valid ranges for the current room) will be huge.

My question is: is there an easier way, or my idea is the only way of solving this? In any case, if somebody's has gone through the same, I'd appreciate some hints...

Thanks!

This is an interesting use case; I haven't heard of using Magento for room reservations before. If you want to avoid creating the options and populating them manually, you could create your own Model class for retrieving room occupancy and a Block to display it on the page.

How are you handling blocking out the room times? If you can skip adding it to product options entirely, you'd be at an advantage for freedom in your implementation.

Hope that helps!

Thanks, Joe

实际上,这根本不算什么,所以继续进行操作并填充属性(可以通过模块上的安装脚本来完成此操作),然后重写并扩展在前端生成下拉菜单的块类,并在其中添加条件。打赌,您甚至可以从parentBlock()或直接从当前上下文获取产品对象

I think I found a much better solution... It was staring at me the whole time, and somehow I couldn't see it.

I just need to add a ComboBox/RadioButton-style CustomOption for each room, with all possible combinations. Something like:

( ) 1 adult (-20%)
(o) 2 adults (0%)
( ) 2 adults + 2 babies (+10%)
( ) 2 adults + 2 children (+30%)

(The options are not real)

No extra coding, just a script to populate the DB! I'll wait anyway, in case somebody has an even cooler solution. ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM