LemonStand Documentation

Customizing Invoices and Packing Slips

Invoices and packing slips in LemonStand are customizable. You can implement literally any invoice or packing slip template, making printable documents consistent with your company identity.

Invoice and packing slip templates are situated in the modules/shop/invoice_templates and modules/shop/packingslip_templates directories. Each subdirectory in these directories represents a single invoice or packing slip template. LemonStand includes standard invoices and packing slip templates (directories which begin with the ls_standard prefix). Please do not edit the standard templates, because they will be overwritten on next software update.

Creating a new invoice template

To create a new invoice template, create a copy of the ls_standard directory in the modules/shop/invoice_templates directory. Assign some meaningful name to a new directory. Inside the directory, edit the info.php file. This file contains information about the template. You can change the template name and description, and specify CSS files which you need to be linked on the Invoice page. The LemonStand Standard invoice template contains the standard.css file, which is already specified in the info.php file.

<?
  $template_info = array(
    'name'=>'LemonStand Standard invoice',
    'description'=>'Standard LemonStand invoice',
    'css'=>array(
      
      /*
       * A list of CSS files and media types to link to the invoice page.
       *
       * Use only file names if you need to link a CSS file from the 
       * template resources/css directory:
       * 'standard.css'=>'all'
       *
       * Use absolute paths if you need to link external CSS files:
       * 'http://www.url.com/resources/css/print.css'=>'print',
       * 'http://www.url.com/resources/css/screen.css'=>'all'
       */

      'standard.css'=>'all'
    )
  );
?>

Save the updated info.php file and open the invoice.htm file in a text editor. This file contains the invoice page content. You can edit the file, and create, or update CSS classes in your template CSS file(s). Feel free to completely empty the template CSS file and begin from scratch. LemonStand provides a number of PHP variables which you can use in the invoice template:

  • $order - represents an order, corresponding a current invoice. An object of the Shop_Order class
  • $company_info - PHP object, containing information about your company. You can edit the company information on the System/Settings/Company Information and Settings page.
  • $invoice_template_info - information
  • $invoice_date - Phpr_DateTime object, containing the invoice date. The invoice date depends on invoice configuration. In some cases the invoice date is not known (the variable contains NULL value). Always check the variable before displaying its value.
  • $display_due_date - a Boolean-type variable, which determines whether a Due Date should be displayed. You can manage the Due Date visibility on the Invoices tab of the System/Settings/Company Information and Settings page.
  • $due_date - Phpr_DateTime object, containing an invoice due date. In some cases the due date is not known (the variable contains NULL value). Always check the variable before displaying its value.
  • $display_tax_included - a Boolean-type variable. Determines whether product prices should include tax.

You can use the standard template implementation as a reference, and update it according to your needs (but please make a copy of the standard template before you begin and work with it, because changing the standard templates is not allowed). There are no "required" code in the standard template, so you can empty the invoice.htm file and develop your own invoice implementation from scratch.

After creating a new invoice template, you should select it on the Invoices tab of the Company Information and Settings page.

Creating a new packing slip template

The process of implementing a packing slip template is similar to customizing invoice templates. But this time you need to work in the modules/shop/packingslip_templates directory. Also, there are fewer PHP variables available in a packing slip template:

  • $order - represents an order, corresponding a current invoice. An object of the Shop_Order class
  • $company_info - PHP object, containing information about your company. You can edit the company information on the System/Settings/Company Information and Settings page.


Previous: Troubleshooting during the development and learning process
Return to Developer's Guide

Comments

No comments posted so far.

Add your comment

Loading form...