Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Adding information to the invoice

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-17-2009, 04:14 AM
 
sm@19dozen.com sm@19dozen.com is offline
 

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

Default Adding information to the invoice

Hi,

I have an extra field (called Qty Per Pack) which I would like to add to the invoice as a separate column. How would I go about doing that?

Actually, that is only the first part of what I need to do. The next bit would be to multiply the content of the 'Qty Per Pack' field with the quantity to get the total amount of products ordered. Any help with this would be greatly appreciated.

All the best,

Steve

-- EDIT --

This is for version 4.1.12 by the way.
__________________
Various: 4.2.2, 4.1.9 [Linux]
Reply With Quote
  #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
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:01 PM.

   

 
X-Cart forums © 2001-2020