View Single Post
  #2  
Old 08-17-2009, 06:52 AM
 
sm@19dozen.com sm@19dozen.com is offline
 

Newbie
  
Join Date: Aug 2009
Location: Gloucestershire, UK
Posts: 3
 

Default Re: Adding information to the invoice

I found what I was after. Here's my solution:

In order_data.tpl I found the following code

Code:
<th nowrap="nowrap" width="100" bgcolor="#cccccc" align="center">{$lng.lbl_item_price}</th> <th width="30" bgcolor="#cccccc">{$lng.lbl_quantity}</th>

and added a line below it:

Code:
<th width="40" bgcolor="#cccccc">{$lng.lbl_items}</th>

That gave me the heading for the table but (of course) not the data. Now, the client in this case is a wholesaler and so wanted the quantity field to be the amount of 'packs' and the Item field to be the total number of items. As well as that, some of the items could be sold separately, so they just needed to show the quantity.

I searched for ages for this (just took that long to get my head around Smarty as it's the first time I've used it)

Code:
<td align="center">{$product.amount}</td>

and I added this underneath:

Code:
<td align="center"> {if $product.extra_fields.0.value > 0} {math equation="amount*qty" amount=$product.amount qty=$product.extra_fields.0.value} {else} {$product.amount} {/if} </td>

So any product where the first extra field exists, the amount is multiplied by the amount of products in the cart. Anything else and it just shows the normal quantity.
__________________
Various: 4.2.2, 4.1.9 [Linux]
Reply With Quote