在付款捕获后调用 Magento 事件观察器

Calling a Magento event Observer AFTER payment capture(在付款捕获后调用 Magento 事件观察器)
本文介绍了在付款捕获后调用 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() 中记录了所有事件调度,但没有发现任何突出的东西,只有在我需要它时才会被触发.我遇到的问题是订单的状态始终是付款待处理"或在此之前的状态;这意味着我不知道订单会失败还是成功.

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.

推荐答案

经过多次测试,我发现以下 Observer 可以解决问题;

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 事件观察器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)