0

I have a website in magento(1.9.3) with multiple vendor and paytm as an payment solution. The problem that i am facing is when i am placing the order a order confirmation mail is being sent to the vendor even before the payment is being made and if the order is success from paytm, this time the admin and the user receive a invoice mail but not the vendor.

So if i stop the mail at the time of order placement from admin, the vendor won't receive any mail of order and so he won't be notified.

So is there a way to send invoice mail to all the vendor, user and admin after the successful payment from paytm.

Thank you.

  • You can create a module to capture the payment success full and send the email there in the observer. – Mujahidh Mar 23 '17 at 5:02
  • Please share paytm model folder codes – Amit Bera Mar 23 '17 at 18:51
  • than how you get information related to pepoles who faced problems in paytm payment page ? – Baby in Magento Apr 5 '17 at 6:08
1

You can create a new custom module. In the event observer capture the even checkout_onepage_controller_success_action and create a method in the observer and complete your logic in the method.

1 ) here is custom config.xml for call observer file

<?xml version="1.0"?>
<config>
<modules>
<Namespace_Modulename>
    <version>0.1.0</version>
</Namespace_Modulename>
</modules>
<frontend>
<events>            
    <checkout_onepage_controller_success_action>
        <observers>
            <Namespace_Modulename_Customevent>
                <type>singleton</type>
                <class>Namespace_Modulename_Model_Observer</class>
                <method>customFunction</method>
            </Namespace_Modulename_Customevent>
        </observers>
    </checkout_onepage_controller_success_action>
</events>
</frontend>

2 ) create observer.php file inside your module/Model directory and paste this code

<?php
class Namespace_Modulename_Model_Observer{
public function customFunction(Varien_Event_Observer $observer){
$order = $observer->getEvent()->getOrder();
 //here you can add your custom code
}
}

for further reading use this link

1

You can checkout_onepage_controller_success_action event as Mujahidh says.

checkout_onepage_controller_success_action event give only array of order ids order_ids.

Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));

public function [YourFunction]($observer)
{
    $order_ids=$observer->getEvent()->getOrderIds();
    if(!is_array($order_ids)):
        return;
    endif;

        foreach ($order_ids as $eachOrderId) {

            $order=Mage::getModel('sales/order')->load($eachOrderId);   
            if($order->getPayment()->getMethodInstance()->getCode()== [PAYTM)_PAYMENT_METHOD_CODE] )
            {
              // SEND ORDER EMAIL
              $order->sendNewOrderEmail();
            }
        }
}

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.