Note: this is the same issue as #2459051: Scanning the whole theme directory for the invoice template just for the 7.x-2.x branch
This is a similar issue to #2353325: Skip shipping information if the order does not have one (for 1.x branch).
The module right now checks only two places to see if the front end theme overrides the default template (/invoice and /templates).
It will not recognize the template if it is placed somewhere else (e.g. templates/commerce_invoice_receipt).
This is counter intuitive, because all other theme implementations can be overridden by placing the template file anywhere in the theme folder.
Note: the check must still be performed manually, because Drupal will not recognize the override in front end theme, when admin theme is in use.
This will be committed shortly. This issue is here for future reference.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | commerce_invoice_receipt-fix_template_search-2459055-9.patch | 591 bytes | andyrigby |
Comments
Comment #2
aramboyajyan commentedComment #3
echoz commentedIn the previous dev version, I was accessing the invoice from the admin theme, while commerce-order-invoice-view.tpl was located in the site theme's templates folder, and with this 3/27 dev version, it's looking for the template in the root of the site theme, where it will work if moved there. I get a white screen and the warning message shows it's looking for the file in themes/sitetheme/commerce-order-invoice-view.tpl.php. Isn't the tpl supposed to continue working from the theme's templates folder?
Comment #4
aramboyajyan commentedYes, you can now put the template file anywhere in the frontend theme.
I did not understand first part of the post though; have you tried clearing caches?
Can you explain once again how was it before and what changes you made now?
Thanks.
Comment #5
echoz commentedIn the previous dev version, I accessed the tpl from
themes/sitetheme/templates/commerce-order-invoice-view.tpl.php
and with the new dev from 3/27, it only works if I move the tpl to
themes/sitetheme/commerce-order-invoice-view.tpl.php
I am accessing the tpl while viewing the admin theme (Seven).
Yes I clear the site caches after moving the tpl in and out of the templates folder. I have it working by hacking the module with the previous code before this issue's commit.
Comment #6
aramboyajyan commentedThanks for the details; will get back to this shortly.
Comment #7
andyrigby commentedI've hit the same problem. I believe the problem is caused by the file_scan_directory() call not being recursive. Attached patch seems to fix it for me.
Comment #8
andyrigby commentedIgnore #7 - reverted the patch and it still works. recurse defaults to true anyway. Must be something else.
Comment #9
andyrigby commentedHi,
It appears to be a problem in the hook_theme() implementation. If the template is located in a subdirectory of the theme, the 'path' returned is still the root of the theme. If this is changed to be the subdirectory that the template is found in, then the template is found when rendering. I've added a proposed patch to address this.
As it's hook_theme() the theme cache must be cleared for this to take effect.
I'm not 100% certain, but this looks only to be an issue when viewing the invoice via the admin theme.
Comment #10
jkopel commented@andyrigby #9 works great, thanks.
As usual I wrote a similar patch before bothering to search d.o, but yours looks just fine. :)
Comment #13
aramboyajyan commentedSorry for late reply; the patch is committed and should be available in the dev branch shortly.
Thanks everyone!