0

Hi I am new to Magento

How to add custom functionality to Product review ??

I need to send a mail with discount coupons to user's email id once user has reviewed product.

How can I do this functionality please help me

4
  • 1
    Check into the review_safe_after event, or possibly extend the product controller class app/code/core/Mage/Review/controllers/ProductController.php May 21, 2015 at 5:12
  • when you want to send mail to customer .....please explain properly
    – Amit Bera
    May 21, 2015 at 7:22
  • @TimHallman. You should write your comment as an answer. Include a link to a page explaining how to create an observer and it's the perfect answer.
    – Marius
    May 26, 2015 at 9:30
  • @Marius, thanks, I added an answer below. May 26, 2015 at 12:05

1 Answer 1

1

You can add an observer to the review_save_after event in your config.xml file like this:

<events>
    <review_save_after>
        <observers>
            <namespace_module>
                <class>Namespace_Module_Model_Review_Observer</class>
                <method>send_mail_after_review</method>
            </namespace_module>
         </observers>
    <review_save_after>
</events>

Note: you will need to customize the above code and create your observer class to meet your needs. For more information on Magento observers see this link.

Alternatively, you may be able to extend the product controller class in

app/code/core/Mage/Review/controllers/ProductController.php

Then add your mail function after the line that looks like:

$session->addSuccess($this->__('Your review has been accepted for moderation.'));

There is some useful information here pertaining to overriding Magento observers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.