sales_order_invoice_pay-event中Mage_Sales_Model_Order_Invoice的发票ID

时间:2016-06-27 13:00:37

标签: magento magento-1.9

我在sales_order_invoice_pay事件中收到的数据存在问题。我希望发票付款'事件可以访问引用的发票吗?但是,$observer->getEvent()->getInvoice();会返回显然不包含所有数据的Mage_Sales_Model_Order_Invoice。例如。我无法使用->getId()

getData()返回:

array (
  'order_id' => '196',
  'store_id' => '2',
  'customer_id' => '24',
  'billing_address_id' => '196',
  'shipping_address_id' => NULL,
  'global_currency_code' => 'EUR',
  'base_currency_code' => 'EUR',
  'store_currency_code' => 'EUR',
  'order_currency_code' => 'EUR',
  'store_to_base_rate' => '1.0000',
  'store_to_order_rate' => '1.0000',
  'base_to_global_rate' => '1.0000',
  'base_to_order_rate' => '1.0000',
  'discount_description' => NULL,
  'total_qty' => 5,
  'subtotal' => 5,
  'base_subtotal' => 5,
  'subtotal_incl_tax' => 5,
  'base_subtotal_incl_tax' => 5,
  'grand_total' => 5,
  'base_grand_total' => 5,
  'discount_amount' => 0,
  'base_discount_amount' => 0,
  'base_cost' => 0,
  'shipping_amount' => '0.0000',
  'base_shipping_amount' => '0.0000',
  'shipping_incl_tax' => '0.0000',
  'base_shipping_incl_tax' => '0.0000',
  'shipping_tax_amount' => '0.0000',
  'base_shipping_tax_amount' => '0.0000',
  'shipping_hidden_tax_amount' => '0.0000',
  'base_shipping_hidden_tax_amount' => '0.0000',
  'tax_amount' => 0,
  'base_tax_amount' => 0,
  'hidden_tax_amount' => 0,
  'base_hidden_tax_amount' => 0,
  'can_void_flag' => false,
  'state' => 2,
)

如何从此处获取数字发票ID(或增量ID)?我希望避免通过order_id,因为那里有1:n连接。

我试过了:

$invoice->getId();
$invoice->getID();
$invoice->getData('id');
$invoice->getData('entity_id');
$invoice->getIncrementId();
$invoice->getData('increment_id')

我使用的是Magento 1.9.2 CE,其上下文属于paypal IPN请求。我深入研究代码越深入,我认为在调用钩子时没有持久保存/创建发票?

0 个答案:

没有答案