评论和评分部分有一些默认属性,它们是产品、发布者、摘要评分、详细评分、状态、昵称、评论摘要和评论。现在我想再添加一个名为“选定尺寸”的属性,我该如何完成呢?
2 回答
Reviews are not EAV entities. So extending this is somewhat easier.
1) You can add a new field in the review_detail
table and extend the module to also save this new field. You will not need to do too much work at the module level (mostly the effort is to display this new field in new review form and related views).
2) You can create a new table (don't alter Magento's core db Tables) with a reference to Review (review_id) and your custom field. This also means to extend Review model's and use afterSave, afterLoad functions to save/retrieve your data...
3) Duplicate entire module logic with custom tables (I've seem some more than a few commercial extensions that have this approach to do stuff with reviews, inventory and so on). Not recommended.
您应该使用 sql 升级脚本创建一个模块。它包含在 alan Storm 的教程和 magento 提供的视频系列的数据库部分中,可在他们网站的帐户部分中找到。这两个资源都涵盖了根据 magento 编程实践完成工作所需的其余技能。