Magento 1.9 – Review Approve Event

event-observermagento-1.9review

I need to send an offer email to customers, if their review is approved.

I can't find one. How can I list all the events available in Magento?

What hook/event can I use?

In Magento 1.9 version:

<?>
    <observers>
        <your_module>
            <type>singleton</type>
            <class>your_module/observer</class>
            <method>yourMethod</method>
        </your_module>
    </observers>
</?>

Best Answer

As stated by Rakesh, the review_save_after is the event you need.

However, this will be triggered whenever you save a review even if you don't approve it.

Thus in your observer you need to check if the review is being approved:

$review = $observer->getDataObject();

// Check if there are changes
if ($review->hasDataChanges()) {
    // Get the old status
    $oldStatus = $review->getOrigData('status_id');
    // Get the new status
    $newStatus = $review->getData('status_id');
    // Check if they are different and if the new one is approved
    if ($newStatus != $oldStatus && $newStatus == Mage_Review_Model_Review::STATUS_APPROVED) {
        // Send email to customer
    }
}
Related Topic