View Single Post
  #11  
Old 01-08-2015, 04:13 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: XC5 anomolies - invoice contents, duplicate messages etc.

Quote:
Originally Posted by gkarlsson
Is there a hook, that I can use, to enable sending email notifications on credit card capture? I really don't want to have to browse through more code than I need to.

Yes, sure. You need to decorate the doPayment() method in \XLite\Controller\Customer\Checkout class and call the \XLite\Core\Mailer::getInstance()->sendOrderCreated($cart); method, before this code:

PHP Code:
if ($cart->isPayed()) {
                
$paymentStatus $paymentStatusCode ?: \XLite\Model\Order\Status\Payment::STATUS_PAID;

            } elseif (
$transaction && $transaction->isFailed()) {
                
$paymentStatus = \XLite\Model\Order\Status\Payment::STATUS_DECLINED;

            } else {
                
$paymentStatus = \XLite\Model\Order\Status\Payment::STATUS_QUEUED;
                \
XLite\Core\Mailer::getInstance()->sendOrderCreated($cart);
            } 

Of course, you should remove this routine from this piece of code:
PHP Code:
} else {
                
$paymentStatus = \XLite\Model\Order\Status\Payment::STATUS_QUEUED;
                \
XLite\Core\Mailer::getInstance()->sendOrderCreated($cart);
            } 

In order to avoid double notifications for offline payment methods.

Please, let me know if it makes sense to you.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote