On the hook_entity_insert and hook_entity_update I generate an invoice of the order status is changed to success.
To generate part of that invoice I use:
$view = entity_view('commerce_order', array($commerce_order->order_id => $commerce_order), $view_mode='full', NULL, TRUE);
Where $commerce_order is the commerce_order entity.
The line items give when an No line items found when a payment is completed, BUT the strange thing, this code works fine when drupal is in maintenance mode. However when i put the drupal site online entity_view start returning No line items found instead of the products.
I checked the $commerce_order entity to make sure the products are in the in object. They are there, however entity_view in maintenance mode give the expected result, but when online it always gives No line items found.
This doesn't happen when the order is created manually or when the order gets updated, the scripts and entity_view works as it should.
I tried to:
- flush cache before calling the view
- Use commerce_order_ui_order_view to call the order.
- Use different view modes, like full, administrator, invoice.
I've run out of idea's I can't figure out why this doesn't work in the online version of drupal.
Comments
Comment #1
redsd commentedUsed a quickfix to get around this bug, by building my own product list.
$producten_tabel gives the product list that is in the order.
Some of the code is dutch, sorry for not translating ;)