Can you add a hook to the _commerce_invoice_receipt_get_invoice_info() function that would allow modules to add extended data to the $info variable?

For example, I have added a comments field to the order and need to add this data to the $info variable so that it can be output in the invoice.

Comments

rbrownell’s picture

+1 on that...

I would almost suggest creating an area on the invoice receipt where other modules can fill in whatever they need to fill in, say after the order total and before the remarks/terms and conditions text area at the bottom.

At Commerce Moneris we are discussing about how we would grant access to transaction data to display mandatory response codes by the Moneris payment processor. It was suggested that a hook with your module might do the trick. #1941334: Retrieving and saving data from Moneris response

Scott Robertson’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new636 bytes

A patch is attached that will add a drupal_alter call right before the invoice info is returned, allowing other modules to add other data to it.

spheresh’s picture

Version: 7.x-1.0 » 7.x-1.1
StatusFileSize
new626 bytes

Patch was updated for 7.x-1.1 version of module

3cwebdev’s picture

Awesome. Can we get this committed to the module?

spheresh’s picture

A small fix. Order was added to the alter function. It is more useful because, there was hard to add something in template without an information about the order

spheresh’s picture

It is same patch for version 1.1 of module (sorry but I need it for my project)

JulienF’s picture

Quite Helpful,

Thanks!

karlshea’s picture

Also added the $build parameter from the original function. This contains the rendered fields from the Invoice/Receipt display settings on the Order so you can add fields to the $info array the same as _commerce_invoice_receipt_get_invoice_info() does.

Status: Needs review » Needs work
aramboyajyan’s picture

Version: 7.x-1.1 » 7.x-2.x-dev
Status: Needs work » Fixed

I'm a bit late to the party, and I should have checked this issue before #2665680: Implements hook system for _commerce_invoice_receipt_get_invoice_info, but I'm here to fix things :D

Thanks everyone! This has been committed to v2 over the patch provided in the newer issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.