保存发票前先从发票中获取订单行详细信息

时间:2019-10-03 13:08:10

标签: magento-1.9

我正在尝试部分捕获捆绑产品,为此,我正在尝试使用事件来检索它 $observer->getEvent()->getInvoice(); 我无法拿到儿童用品 foreach($invoice->getAllItems() as $item){} 请帮助我使用sales_order_payment_capture事件

检索子项

config.xml

                <observers>
                    <ValitorOmni_hooksystem_invoice_about_to_be_captured>
                        <type>singleton</type>
                        <class>ValitorOmnipayment/observer</class>
                        <method>salesOrderPaymentCapture</method>
                    </ValitorOmni_hooksystem_invoice_about_to_be_captured>
                </observers>
            </sales_order_payment_capture>```

observer.php

```   public function salesOrderPaymentCapture($event)
    {
        self::$invoiceBeingPayedFor = $event->getInvoice();
    }```
abstract.php
```foreach($invoice->getAllItems() as $item) /* @var $item Mage_Sales_Model_Order_Invoice_Item */
        {
            $data = $item->__toArray();

                $orderLines[] = array(
                    'description'=>$data['name'],
                    'itemId'=>$data['sku'],
                    'quantity'=>$data['qty']
                );
            }```

0 个答案:

没有答案