Currently orders support a "Customer" and "Administrator" view mode. However, we don't really have support for e-mailing "invoices" or receipts to customers beyond a simple textarea with order tokens. What I propose is adding a new "Invoice" view mode (though it might better be called "E-mail"?) that would be used for sending these types of e-mails. The view mode will let you make certain fields visible or not visible when e-mailing an order page. It will also allow modules to hook into it specifically using hook_commerce_order_view().
I'm not sure if we can have view mode specific templates, but we'll also need to figure out a way to ensure that the e-mailed invoice is passed through a theme function so it can generate e-mail safe HTML. Perhaps this can be handled through an API function that prepares an order for e-mail and then we can call that API function instead of just commerce_order_build_content() from the Rules action for e-mailing an invoice. Perhaps commerce_order_build_email_content()?
Comments
Comment #1
xibun commented+1
Comment #2
xlyz commented+1
btw invoices here (italy) can not be plain email, but shall be a pdf.
so my vote goes for calling it "E-mail" as well.
Comment #3
damien tournoud commentedLet's settle on 'email'. Those things are not technically invoices anyway, it's just an order summary sent by mail.
Comment #4
essbee commentedFor those interested I have actually created an Invoice / printable order view just using Views and the Print module (http://drupal.org/project/print).
This gives a very customisable invoice/print display with header footer etc and also outputs nicely to PDF, thus also satisfying the PDF requirement. All themeable via CSS.
Potentially DC does not need this functionality inbuilt as core, but rather can leverage existing capabilities. This would align nicely to the ethos of stripping out functionality not actually core to commerce.
Cheers,
Sam
Comment #5
essbee commentedOh, and by making the path of my order View /user/%/orders/% you override the existing User order view so all the existing links take you to your View outputted display, which provides the various print/pdf/email options.
Comment #6
arbel commentedis there anyway to send the "print" page to the user after an order is completed?
Comment #7
Scott J commentedHey essbee,
I like your idea of using Views and Print module. Any chance of exporting your View so I can try it out?
Comment #8
WilliamV commentedCount me in on the example to test.
Comment #9
essbee commentedSure thing. Here is the view. Note it is going to cause a few issues importing as I have added a bunch of fields to the order.
The customer field is a taxonomy reference - I have created a taxonomy of customers so I can leverage the taxonomy reference capabilities to attach a customer to an order. I also moved the customer profile reference from the order into the taxonomy ter.m As such all the customer information comes in via that reference.
I use globals to create header and footer with the company information, payment terms etc.
I also use the Print module to create PDF and Printable views of the page.
Hopefully it gives a general idea.
Comment #10
zkrebs commentedsubscribe
Comment #11
fall_0ut commentedsubscribe
Comment #12
rfaysubscribe
Comment #13
Scott J commentedThere is a new module called Views PDF which should be perfect for this. It is being used by Ubercart PDF Invoice module.
Comment #14
hunziker commentedScott this is a good idea. At the moment the Views PDF does not have stable support for Drupal 7. I will push it forward, but this take some time. The creation of the view itself is not very complicated. So if we can build a HTML view of an invoice, it is a small effort to transform it to using with Views PDF.
Comment #15
felipepodesta commented+1
Subs
Comment #16
hunziker commentedI add a new project for this purpose. See Commerce PDF Invoice.
At the moment there are some issues with the positioning of the included view. Additionally we need a way to display the order totals in a appropriated way. Possibly we need this module here for the order totals: Order Totals
Comment #17
artusamakClosing this one, as discussed with rfay, the module Commerce PDF Invoice refeered in #16 seems to do the job.
We added the reference on http://www.drupalcommerce.org/contrib page.
Comment #18
rfayOr maybe "fixed" :-) Yay Hunziker.
Comment #20
j0rd commented+1 for invoice functionality ala Ubercart. This means HTML & Emailable invoices. PDFs are nice too, but less important and more work.
It doesn't need to be a view. A simple themable page is good enough & more flexible (just not in the UI). Some people require fairly flexible invoices & they want to style them with their own branding.
Invoices are important for B2B records. Currently if Drupal Commerce doesn't support printable invoices / receipts, it's no good for businesses & tax purposes.
Comment #21
Yuri commentedI agree, html invoices are very imporant. Subscribing.
Comment #22
gagoo commentedThe same.
subscribe
Comment #23
Fidelix commentedI believe HTML, emailable invoices are even more important than PDF.
Comment #24
zambrey commentedLet's move to separate issue for HTML invoices: #1214592: Support for HTML invoices
Thanks.