Customizing invoice in mails

Hello, after reading and searching a lot, I can’t bring it to work…



I want to change the content of the invoice which is included in the mails sent to the customers.



I found out that the file is : ```php
/design/themes/basic/mail/templates/orders/invoice.tpl

<br />
Changes made directly in this file are effective. But I want to use a hook. The part I want to change in [i]invoice.tpl[/i] is between : ```php
{hook name="orders:invoice_company_info"}  ... {/hook}
```<br />
<br />
I've created this file with my modifications ```php
/design/themes/basic/mail/templates/addons/my_changes/hooks/orders/invoice_company_info.override.tpl
```<br />
<br />
But my hook isn't used. What I'm doing wrong ?

Resolved ! I found out why it wasn't working : the Rebuild Cache Automatically was set to On in the Template Editor section ! Set it now to Off and my hook is working !

The solution was simply to clear compiled templates. It can be done with :


?dispatch=template_editor.manage&ctpl



So the Rebuild Cache Automatically can be set to On or Off and my hooks are working.

I'm surprised that the hook will be found in the mail directory given that most hooks are from within the 'templates' directory, even for 'mail'. But since this is all new, maybe they've changed the location for mail hooks to be in the 'mail' tree.



Would be nice to have cs-cart confirm/deny versus having to go through all the templater code too determine if 'mail' is handled separately from 'templates'.

[quote name='tbirnseth' timestamp='1380244119' post='168798']

I'm surprised that the hook will be found in the mail directory given that most hooks are from within the 'templates' directory, even for 'mail'. But since this is all new, maybe they've changed the location for mail hooks to be in the 'mail' tree.



Would be nice to have cs-cart confirm/deny versus having to go through all the templater code too determine if 'mail' is handled separately from 'templates'.

[/quote]



I agree with you. First I tried to put my hook in the templates tree, I found another post in this forum about the mail tree, but for older version. In the official documentation I found nothing about CSC4 and the mail tree. I spent a lot of time trying and searching and think a the official documentation could be better. I think modifying the mail templates is something current.

Why I suggested cs-cart comment (but we could wait for that for a really long time).



A quick look at app/functions/smarty_plugins/block.hook.php indicates that hooks are resolved “relative” to the “template_area”. So I would assume that “mail” hooks are now relative to the mail directory and “temlate” hooks are now relative to the “template” directory. I wonder if that means that any admin mail hooks wold be relative to the backend/mail/addons directory rather than just backend/addons?





Kinda makes sense but I would doubt there is much overload of template hooks depending on whether it's a 'mail' template or not.

Notice that there is a backend and front-end invoice.tpl