In the file:
/app/code/core/Mage/Paypal/Model/ipn.php
Magento by default checks that an invoice exists and that an email has not already been sent. By removing $invoice && from line 493 and the if statement from line 457 Got emails to send for Paypal orders.
Now, I was aware of when magento sent the order confirmation emails for Paypal orders, I proceeded to amend a section of the registerCaptureNotification function in my payment.php to the following:
public function registerCaptureNotification($amount, $skipFraudDetection = false)
{
$this->_generateTransactionId(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE,
$this->getAuthorizationTransaction()
);
$order = $this->getOrder();
$amount = (float)$amount;
$invoice = null;
// register new capture
if (!$invoice) {
$isSameCurrency = $this->_isSameCurrency();
if (!$isSameCurrency && !$this->_isCaptureFinal($amount)) {
if (!$skipFraudDetection || !$isSameCurrency) {
$this->setIsFraudDetected(true);
}
$this->_updateTotals(array('base_amount_paid_online' => $amount));
}
}
$status = true;
$letsEmail = false;
if ($this->getIsTransactionPending()) {
$message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amount));
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
$letsEmail = true;
if ($this->getIsFraudDetected()) {
$message = Mage::helper('sales')->__('Order is suspended as its capture amount %s is suspected to be fraudulent.', $this->_formatPrice($amount, $this->getCurrencyCode()));
$status = Mage_Sales_Model_Order::STATUS_FRAUD;
$letsEmail = false;
}
} else {
$message = Mage::helper('sales')->__('Registered notification about captured amount of %s.', $this->_formatPrice($amount));
$state = Mage_Sales_Model_Order::STATE_NEW;
$letsEmail = true;
if ($this->getIsFraudDetected()) {
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
$message = Mage::helper('sales')->__('Order is suspended as its capture amount %s is suspected to be fraudulent.', $this->_formatPrice($amount, $this->getCurrencyCode()));
$status = Mage_Sales_Model_Order::STATUS_FRAUD;
$letsEmail = false;
}
}
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true);
$message = $this->_prependMessage($message);
$message = $this->_appendTransactionToMessage($transaction, $message);
$order->setState($state, $status, $message);
if ($letsEmail === true && !$order->getEmailSent()){
$order->queueNewOrderEmail()->addStatusHistoryComment(
Mage::helper('paypal')->__('Notified Customer')
)
->setIsCustomerNotified(true)
->save();
}
return $this;
}
Setting a letsEmail flag to true when a positive capture occurs and false for negative/fraudulent capture. Then along with the following:
!$order->getEmailSent()
To check that an email has not already been sent, I did an if statement so when the flag is true and no email had been sent for the order, create a new order status history comment, with 'notified customer' as the text and send a new order confirmation email to the customer.
Best Answer
Each payment method model supports a member called
$_canUseInternal
. This decides if the payment method can be used in the backend.So you need to add this in the payment method model
But chances are you will need more than that, depending on the payment method. You may need to create a block and/or a template for admin use.
Some of the payment method might not be designed to work on the backend.
If you need a method just to appear on the invoice and no actions behind it then you can create your own. Here is a
nice tutorialfor creating one.Just make sure you set to it
so you can use it only for frontend.