X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Show total quantity on order_data.tpl or the invoice (https://forum.x-cart.com/showthread.php?t=63047)

tqualizerman 03-21-2012 03:17 PM

Show total quantity on order_data.tpl or the invoice
 
Hi,

I'm needing to display the total number of items in an order on the invoice (or on order_data.tpl.) I've searched the forum but could only find a very old, very complicated way to do this and I was hoping there was going to be a better way. Does anyone know of one?

cflsystems 03-21-2012 03:26 PM

Re: Show total quantity on order_data.tpl or the invoice
 
{$products|@count} will give you total unique items, if you need total including quantity for each item you have to do some math in the foreach loop in order_data.tpl with $product.amount

tqualizerman 03-21-2012 04:08 PM

Re: Show total quantity on order_data.tpl or the invoice
 
Thanks for the quick reply! So far I've got it to manually add up the number of items in the order...but I can't get my head around factoring in the quantities of each:

{foreach from=$products item=product name=num}
{$smarty.num.index}
{math equation="value+1" value=$smarty.foreach.num.index}

It outputs a list of

1 2 3 4 5 6 7 8 9 etc.

cherie 03-22-2012 01:41 PM

Re: Show total quantity on order_data.tpl or the invoice
 
Untested suggestion:
Code:

{assign var=numProducts value=0}
{foreach from=$products item=p}
{assign var=numProducts value=$numProducts+$p.amount}
{/foreach}
My number is: {$numProducts}


tqualizerman 03-22-2012 03:28 PM

Re: Show total quantity on order_data.tpl or the invoice
 
BRILL-LIANT. Worked absolutely perfectly. Thank you so much.


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.