在付款捕获后调用 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 事件观察器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

相关文档推荐

In PHP how can you clear a WSDL cache?(在 PHP 中如何清除 WSDL 缓存?)
failed to open stream: HTTP wrapper does not support writeable connections(无法打开流:HTTP 包装器不支持可写连接)
Stop caching for PHP 5.5.3 in MAMP(在 MAMP 中停止缓存 PHP 5.5.3)
Caching HTTP responses when they are dynamically created by PHP(缓存由 PHP 动态创建的 HTTP 响应)
Memcached vs APC which one should I choose?(Memcached 与 APC 我应该选择哪一个?)
What is causing quot;Unable to allocate memory for poolquot; in PHP?(是什么导致“无法为池分配内存?在 PHP 中?)