Magento 产品属性 +自定义属性?
我正在尝试使用 Magento 建立一个酒店预订系统,但我对以下问题感到有点困惑:
每个房间都有管理员设置的 MaxOccupancy、MaxAdults、MaxChildren 和 MaxBabies 属性值,详细说明了有多少人可以入住某些房间(例如,在某些情况下,即使没有超过MaxOccupancy,酒店也对每个房间可以入住多少儿童有规定)。
我还需要允许客户指定他/她要为多少人预订。我认为应该使用自定义选项(例如,成人/儿童/婴儿的下拉菜单)来完成,但看起来连接所有这些(包括需要仅使用当前房间的有效范围填充下拉菜单)将会很大。
我的问题是:有没有更简单的方法,或者我的想法是解决这个问题的唯一方法?无论如何,如果有人经历过同样的事情,我会很感激一些提示......
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个有趣的用例;我以前没听说过使用 Magento 进行房间预订。如果您想避免创建选项并手动填充它们,您可以创建自己的模型类来检索房间占用情况和块以将其显示在页面上。
您如何处理占用房间时间的情况?如果您可以完全跳过将其添加到产品选项的过程,那么您将在实施过程中享有自由的优势。
希望有帮助!
谢谢,
乔
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() 或直接从当前上下文获取产品对象
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
我想我找到了一个更好的解决方案......它一直盯着我,但不知何故我看不到它。
我只需要为每个房间添加一个 ComboBox/RadioButton 样式的 CustomOption,以及所有可能的组合。像这样的东西:(
选项不是真实的)
没有额外的编码,只是一个填充数据库的脚本!无论如何,我会等待,以防有人有更酷的解决方案。 ;)
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:
(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. ;)