I am looking forward to create a custom module which adds an input field to collect 'Email Id' in Review form but only for Guest Customers.
I know this probably needs rewriting some of the core modules like '/code/core/Mage/Review/Model/Mysql4/Review/Product/Collection.php' and '/code/core/Mage/Review/Model/Mysql4/Review.php' and editing block files and .phtml files to include the 'email' text field.
Also the new field needs to be added to the database table as well. And this field should compulsorily be there for the Guest Customers. Registered Customers need not enter their email id while posting a Review.
So I don't know how to go about doing the following things: 1)Which core files needs to be rewritten exactly ? 2)How should I go about adding this new field in the existing database table for 'review' such that future upgrades don't over write it ? 3)How should I make sure that this field is mandatorily filled by Guest Customers? (Its ok if registered customers don't fill it)
Please, any help is massively appreciated. Thanks.
This is what I have done so far
CM
Review
Block
Review
Edit
Form.php
etc
config.xml
Helper
Data.php
Model
Resource
Review.php
Review
Product
Collection.php
This are the contents of my config.xml
<?xml version="1.0"?>
<config>
<modules>
<CM_Review>
<version>0.0.1</version>
</CM_Review>
</modules>
<frontend>
<routers>
<review>
<use>standard</use>
<args>
<module>CM_Review</module>
<frontName>Review</frontName>
</args>
</review>
</routers>
</frontend>
<global>
<blocks>
<adminhtml>
<rewrite>
<review_edit_form>CM_Review_Block_Review_Edit_Form</review_edit_form>
</rewrite>
</adminhtml>
</blocks>
<helpers>
<review>
<rewrite>
<class>CM_Review_Helper</class>
</rewrite>
</review>
</helpers>
<models>
<review>
<rewrite>
<resource_review>CM_Review_Model_Resource_Review</resource_review>
<resource_review_product_collection>
CM_Review_Model_Resource_Review_Product_Collection
</resource_review_product_collection>
</rewrite>
</review>
</models>
</global>
And each of the core files that I have rewritten, are extended them from the original Review Model files and Adminhtml/Block/Review Edit files.I have copy pasted the same code just with the extra 'email' field in my code.
I have manually added the field in the database now and have added the input field in base/defaut/review/form.phtml but still it doesn't save the data in the table.
However if I try to add this field by editing the core files then it saves the email id of guest customers and works perfectly fine.
Can't figure out what I'm doing wrong?