X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   XC5 anomolies - invoice contents, duplicate messages etc. (https://forum.x-cart.com/showthread.php?t=70834)

tony_sologubov 01-08-2015 04:13 AM

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.


All times are GMT -8. The time now is 10:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.