3

There is a setting in Magento

Admin > System > Configuration > Checkout (from sales section) > Payment Failed Emails

where you can add custom email id to receive it. But I want our customers to receive Payment Transaction Failed Emails too.

Any help reg this would be highly appreciated. Thanks in advance !!

0

There is no configuration in Magento for that, therefore you will need to overwrite the function sendPaymentFailedEmail in the Checkout helper and add the functionality there.

If you are familiar with customization that shouldn't be a problem. The following changes need to be done.

Add the following in the config.xml of your custom module into the global or frontend <helpers> section:

<checkout>
    <rewrite>
        <data>Vendor_Module_Helper_Checkout</data>
    </rewrite>
</checkout>

Create a file in app/code/local/Vendor/Module/Helper/Checkout.php, copy the original function sendPaymentFailedEmail and change the code as follows:

class Vendor_Module_Helper_Checkout extends Mage_Checkout_Helper_Data
{
    public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage')
    {
    [...]
    $sendTo = array(
            array(
                'email' => Mage::getStoreConfig('trans_email/ident_'.$_reciever.'/email', $checkout->getStoreId()),
                'name'  => Mage::getStoreConfig('trans_email/ident_'.$_reciever.'/name', $checkout->getStoreId())
            )
        );
    //your added code starts here...
    //send copy to customer
    $sendTo[] = array(
                    'email' => $checkout->getCustomerEmail(),
                    'name'  => $checkout->getFirstname() . " ". $checkout->getLastname()
                );
    //end of your code
    [...]
    }
}

With that changes every payment failed notification would be send also to the customer.

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.