3

I want to get an email notification after a new product review is created.

How can I do this with a simple event observer?

I created the following files and directories:

app/etc/modules/MyModule_ReviewNotify.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <MyModule_ReviewNotify>
            <active>true</active>
            <codePool>local</codePool>
        </MyModule_ReviewNotify>
    </modules>
</config>

app/code/local/MyModule/ReviewNotify/etc/config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <MyModule_ReviewNotify>
            <version>0.0.1</version>
        </MyModule_ReviewNotify>
    </modules>
    <global>
        <models>
            <reviewnotify>
                <class>MyModule_ReviewNotify_Model</class>
            </reviewnotify>
        </models>
    </global>
    <frontend>
        <events>
            <review_save_after>
                <observers>
                    <reviewnotify>
                        <type>model</type>
                        <class>reviewnotify/observer</class>
                        <method>reviewSaveAfter</method>
                    </reviewnotify>
                </observers>
            </review_save_after>
        </events>
    </frontend>
</config>

app/code/local/MyModule/ReviewNotify/Model/Observer.php:

<?php
class MyModule_ReviewNotify_Model_Observer
{
    public function reviewSaveAfter(Varien_Event_Observer $o) {

        //$reviewData = $o->getReview()->getData();

        $contactEmail = Mage::getStoreConfig('contacts/email/recipient_email');

        mail( $contactEmail, 'New Review', 'New Review' );
  }
}

Is this correct so far?

3
  • Have you looked on connect for a suitable extension? Nov 25, 2014 at 11:25
  • 1
    Jepp I installed "ET Review Notify" because it sounds great, but I get no email after configuration so far :(
    – Fox
    Nov 25, 2014 at 12:13
  • Do you have any idea?
    – Fox
    Nov 27, 2014 at 13:29

1 Answer 1

0

Here's an free alternative: https://magegiant.com/magento-new-review-email-notification-extension/ It's solved my problem (no connection)

2
  • OP asked "How can I do this with a simple event observer?". How does this answer that question?
    – jscar
    Mar 23, 2018 at 10:45
  • Looks like that plugin is gone now anyway.
    – Mike
    Apr 18, 2018 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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