Magento 1.9 – New Review Email Notification Setup

emailmagento-1.9review

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?

Best Answer

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

Related Topic