Hello,
I’m trying to get the line items that are related to an invoice.
Logic hook for AOS_Invoices:
$hook_array['after_save'][] = Array(1, 'DecrementProductStock', 'custom/modules/AOS_Invoices/Decrement.php', 'product', 'decrement_stocks');
And then in the class product:
function decrement_stocks ( &$bean, $event, $arguments)
{
// Tried them all, only with empty arrays as return values
// $oInvoice->load_relationship('aos_products_quotes');
$bean->load_relationship('aos_line_item_groups');
// $aProductQuotes = $oInvoice->aos_products_quotes->getBeans();
$aProductQuotes = $bean->aos_line_item_groups->get();
$aLineItemGroups = $bean->get_linked_beans('aos_line_item_groups', 'AOS_Line_Item_Groups');
Everytime I get an empty array.
So if I create and save an invoice, in the after_save logic hook, the invoice including the relationships, should have already been saved, right?
How can I access the line items?