AMAZINGDIO Posted July 31, 2015 Share Posted July 31, 2015 (edited) Can someone help me ? How can i add a total of sold items at my invoice ? Edited August 1, 2015 by razaro (see edit history) Link to comment Share on other sites More sharing options...
gabdara Posted August 1, 2015 Share Posted August 1, 2015 (edited) To show the total of sold items of a order invoice you could do something like this: 1. Edit / override the file /classes/pdf/HTMLTemplateInvoice.php and in function getContent() look for the comment: /** * Need the $round_mode for the tests. */ And add above the comment this code: /* order products sold */ $footer['products_sold'] = count($order_details); Then edit file /pdf/invoice.total-tab.tpl and inside table tag add: <tr> <td class="grey" width="70%"> {l s='Products sold' pdf='true'} </td> <td class="white" width="30%"> {$footer.products_sold} </td> </tr> Edited August 3, 2015 by gabdara (see edit history) 1 Link to comment Share on other sites More sharing options...
tuk66 Posted August 12, 2015 Share Posted August 12, 2015 count($order_details) is for number of products. You have to add product quantity of every order item in the loop to get the total quantity. Link to comment Share on other sites More sharing options...
Fancy Things Posted September 12, 2015 Share Posted September 12, 2015 (edited) Find the foreach loop in the invoice.tpl Make this code: <!-- PRODUCTS --> {foreach $order_details as $order_detail} {cycle values='#FFF,#DDD' assign=bgcolor} <tr style="line-height:6px;background-color:{$bgcolor};"> Into this: <!-- PRODUCTS --> {assign var="total_quantity" value="`0`"} {foreach $order_details as $order_detail} {assign var="total_quantity" value="`$order_detail.product_quantity + $total_quantity`"} {cycle values='#FFF,#DDD' assign=bgcolor} <tr style="line-height:6px;background-color:{$bgcolor};"> Now you should be able to insert the code {$total_quantity} where ever you want to show the total quantity. Edited September 12, 2015 by Fancy Things (see edit history) 2 1 Link to comment Share on other sites More sharing options...
Recommended Posts