开发者

Magento product attribute + custom properties?

开发者 https://www.devze.com 2023-01-30 04:55 出处:网络
I\'m trying to set up a hotel reservation system using Magento, and I\'m a bit lost with the following issue:

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 lik开发者_如何转开发e 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


Actually this is not that huge at all so go ahead and populate your attributes (you can do that via setup script on your module) and later rewrite and extend the block class that generates the drop-downs on frontend and add your conditions there and i bet you can even get the product object form parentBlock() or directly from current context


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. ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消