在 Magento 中新建订单后执行 PHP [英] Execute PHP after new Order in Magento

查看:21
本文介绍了在 Magento 中新建订单后执行 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出可以在何处插入一些 PHP 代码以通知我们正在使用的 CRM (Solve360) 已下新订单,并且应该创建一个事件 (API) 来完成订单.

I'm trying to figure out where I could drop in some PHP code to notify a CRM we are using (Solve360) that a new order has been placed, and that an event should be created (API) to fulfill the order.

  1. 订购产品
  2. 结帐
  3. 完成结帐和结帐捕获 CC
  4. 侧通知 CRM
  5. 完成

不确定从哪里开始,但我不得不进行一些小调整以修复 Quantum Gateway 支付处理器的工作.在该模块中,订单的对象(电子邮件、amt、详细信息)似乎可用.然而,在那里插入更多的 PHP 代码似乎很脏".

Not sure where to start, but I have had to make some small tweaks to fix the Quantum Gateway payment processor to work. In that module it appears that the objects for the order (email, amt, details) were available. However it seems it would be quite 'dirty' to insert more PHP code in there.

想法?

PHP 5.2.x &Magento 1.4.x

PHP 5.2.x & Magento 1.4.x

推荐答案

您应该做的是挂钩为新下的订单触发的 Magento 事件,并使用您正在寻找的功能定义您自己的类.请参阅使用事件/观察者自定义 Magento 了解如何设置观察者(您需要为此创建您自己的模块).

What you should do is hook into the Magento event that is fired for a newly placed order and define your own class with the functionality you are looking for. See Customize Magento using Event/Observer for how to set up observers (you'll need to create your own module for this).

你要监听的事件是sales_order_place_after,当你为它声明一个观察者时,你的代码将在下任何订单后被调用.

The event you want to listen for is sales_order_place_after, and when you declare an observer for it, your code will be called after any order is placed.

希望有帮助!

谢谢,乔

这篇关于在 Magento 中新建订单后执行 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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