Tutorial :Drupal: modifying a template without hacking the module



Question:

I need to edit an invoice template in Drupal (both php template and css).

I've copied pasted the file in my theme folder, as I usually do to override for blocks and pages templates, but it didn't work.

This is the template customer.itpl.php inside Ubercart/uc_orders/templates folder.

How can I override it without hacking the ubercart module ?

thanks


Solution:1

This template is not the normal Drupal template. In order to change it, you should create a copy of the template in the same folder (Ubercart/uc_orders/templates) and make your changes. It will show up as an option in the settings page (/admin/store/settings/orders/edit) where you specify which template to use for showing the invoice.


Solution:2

devel_themer is good at providing template suggestions for you. Sometimes modules uses a special naming convention.

If that doesn't help you can add your own template suggestion in a preprocess function for the template. See this post on d.o for more info.


Solution:3

According to the ubercart docs you should be able to specify which template files you want to use.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »