I want to bring to the store a new payment method - lets call it payment2, but the new system after paying customer (redirect to third party site) and returned to the store not generated automatically email order. I think about to do that - every order with payment2 will automatically sends your email (no matter whether the payment will be OK or not), i find line in file that normaly send email in:


                 * a flag to set that there will be redirect to third party after confirmation
                 * eg: paypal standard ipn
                $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
                 * we only want to send to customer about new order when there is no redirect to third party
                if (!$redirectUrl && $order->getCanSendNewEmailFlag()) {
                    try {
                    } catch (Exception $e) {

Of course i copy that to app\code\local... now i wanna change line

 if (!$redirectUrl && $order->getCanSendNewEmailFlag()) { 


  if ((!$redirectUrl && $order->getCanSendNewEmailFlag()) || ($order->getPayment()->getMethod() != 'name of payment2')) {

but it doesn't work ;/

PS I cannot write only if ($order->getCanSendNewEmailFlag()) { bcs I have another payment method that send email if payemnt is OK, but dont send it otherwise


Please use

$order->getPayment()->getMethodInstance()->getCode() instead of $order->getPayment()->getMethod().it is give you payment method code.

Just like Cash on delivery payment method code is cashondelivery

| improve this answer | |
  • Your code works ;) I also change != to == – Holian Jan 30 '15 at 12:41

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.