Microsoft Office Tutorials and References
In Depth Information
Adding the New Design to Drupal
<p class="addressp textl"><strong>Billing Address:</strong>
Michael Peacock, PCA House, Newcastle, Tyne and Wear,
NE1 PCA, UK</p>
<p class="addressp">contact email:
michael.peacock@peacockcarter.co.uk</p>
</div>
</body>
</html>
Adding the New Design to Drupal
We have made a new design for the invoice; now we need to take the design and add
it to Drupal's code so the design applies to invoices it generated.
To make changes to the design of the printable invoice we need to take some code
from the store's module file, and place a copy in the theme's template file. The
module file is called store.module and is located in sites/default/modules/
ecommerce/store/ ; we should use a PHP or text editor to edit the file. A PHP editor
is best as they generally have better support for things like line numbers and syntax
highlighting, which we may find useful.
Within this file we are looking for a function called theme_store_invoice, which
is located on line 440. We need to copy this function, place it in the store's template
file, and then make quite a number of changes to this function in order to change
the style of the invoice as desired. The entire HTML of the invoice is stored and
generated in this function, which is good, because it means we only have to look
in one place.
Once we have copied the function, we need to open the template.php
file that is located in the folder for the theme we are using, which is in the
themes folder. Within this file, we should paste the function and rename it
phptemplate_store_invoice .
You may be wondering why we copied the code instead of just changing
it directly. The reason is if the module is upgraded, we would then have
to look into the code and reapply our changes.
The first part of the function does not need any alterations, as this is just building
up data, and performing some minor style changes (such as making some elements
bold), we need to start making changes from the line containing if ($print_mode) { .
This line and the eight following lines define the head of the HTML document, which
contains a link to the style sheet. The conditional if statement wrapping the code just
differentiates between viewing the invoice within Drupal or viewing it in a separate
page to print off.
 
Search JabSto ::




Custom Search