我试图编写一个Magento(CE 1.4)扩展程序来导出订单数据,一旦支付了订单。我建立了一个观察器,它挂接到sales_order_invoice_save_after事件,并且这个工作正常 - 当生成发票时,我的函数被执行。但我遇到了麻烦订单的相关信息,如送货地址,账单地址,项目有序,订单总额等Magento - 从订单或发票获取数据
这是我的尝试:
class Lightbulb_Blastramp_Model_Observer {
public function sendOrderToBlastramp(Varien_Event_Observer $observer) {
$invoice = $observer->getEvent()->getInvoice();
$order = $invoice->getOrder();
$shipping_address = $order->getShippingAddress();
$billing_address = $order->getBillingAddress();
$items = $invoice->getAllItems();
$total = $invoice->getGrandTotal();
return $this;
}
}
我试图做一个的print_r所有这些变量,并最终获得大量的数据。有人能指出我获得订单送货地址的正确方向吗?
谢谢!
非常感谢,这正是我所需要的。 – gregdev