付款捕获后调用Magento事件观察员 [英] Calling a Magento event Observer AFTER payment capture

查看:69
本文介绍了付款捕获后调用Magento事件观察员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建订单并捕获付款后,我试图致电观察员. 到目前为止,我已经尝试过了; 在checkout_submit_all_after之后, sales_order_payment_place_end, sales_order_place_after, sales_order_payment_pay, sales_order_payment_capture, sales_order_payment_transaction_save_after

Im trying to call an Observer after the order has been created, and AFTER payment has been captured. So far I've tried; checkout_submit_all_after, sales_order_payment_place_end, sales_order_place_after, sales_order_payment_pay, sales_order_payment_capture, sales_order_payment_transaction_save_after

仅列出主要名称. 我还记录了dispatchEvent()内的所有事件调度,但没有发现任何突出的问题,仅在需要时才触发. 我遇到的问题是,订单的状态始终为以太币"Payment Pending"或在此之前存在的东西;表示我不知道订单会失败还是成功.

Just to name the main ones. I've also logged all Event Dispaches inside dispatchEvent() but found nothing that stands out and is only fired when i need it. the issue i'm having is that the status of the order is always ether 'Payment Pending' or something that predated this; meaning that i don't know whether the order will fail or succeed.

我的目标是仅在成功下达命令后才触发功能. 谢谢.

My aim, is to fire a function only on successful orders. thanks.

推荐答案

经过更多测试后,我发现以下观察员可以解决问题;

after much more testing i found the following Observer to do the trick;

checkout_onepage_controller_success_action

这仅返回订单ID,因此;

This returns just the order id, so;

$order_id = $observer->getData('order_ids');
$order = Mage::getModel('sales/order')->load($order_id);

,您会看到订单状态为处理中",并且付款已经批准(或未批准).

and you see that the order status is 'processing' and the payment is aproved (or not).

这篇关于付款捕获后调用Magento事件观察员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆