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

Show total quantity on order_data.tpl or the invoice

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-21-2012, 03:17 PM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default 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?
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #2  
Old 03-21-2012, 03:26 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 03-21-2012, 04:08 PM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default 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.
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #4  
Old 03-22-2012, 01:41 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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}
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following user thanks cherie for this useful post:
tqualizerman (03-22-2012)
  #5  
Old 03-22-2012, 03:28 PM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default Re: Show total quantity on order_data.tpl or the invoice

BRILL-LIANT. Worked absolutely perfectly. Thank you so much.
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 11:42 AM.

   

 
X-Cart forums © 2001-2020