Here is what I did to display both the total individual sku's ordered and the total quantity of items ordered:
1) Add the following 2 labels to your system language table
xcart_language:
Code:
insert into xcart_languages (code,descr,name,value,topic) VALUES ('US','Total items ordered','lbl_total_items_ordered','Total items ordered','Labels')
insert into xcart_languages (code,descr,name,value,topic) VALUES ('US','Total quantity ordered','lbl_total_quantity_ordered','Total quantity ordered','Labels')
2) Add the following items to the table
xcart_config:
Code:
insert into xcart_config (name,`comment`,value,category,orderby,`type`,defvalue) VALUES ('show_total_items_invoice','Show total item count on invoice','Y','Custom','10','checkbox','Y')
insert into xcart_config (name,`comment`,value,category,orderby,`type`,defvalue) VALUES ('show_total_quantity_invoice','Show total quantity count on invoice','Y','Custom','11','checkbox','Y')
These 2 options are added so you can control the display of the option we are adding below under a
Custom option in the
General settings option in the admin area.
3) Then change the following 3 files:
Code:
- skin1/main/order_info.tpl
- skin1/mail/order_data.tpl
- skin1/mail/html/order_data.tpl
In file
skin1/main/order_info.tpl, change the following code, around line 19:
Code:
{section name=prod_num loop=$products}
{if $products[prod_num].deleted eq "" and ($active_modules.Product_Configurator eq "" or $products[prod_num].extra_data.pconf.parent eq "")}
to
Code:
{assign var = "total_quantity" value = 0}
{assign var = "total_items" value = 0}
{section name=prod_num loop=$products}
{if $products[prod_num].deleted eq "" and ($active_modules.Product_Configurator eq "" or $products[prod_num].extra_data.pconf.parent eq "")}
{math assign="total_quantity" equation="x+y" x=$total_quantity y=$products[prod_num].amount}
{math assign="total_items" equation="x+1" x=$total_items}
then change the following code, around line 102:
from:
Code:
{section name=giftcert loop=$giftcerts}
{if $giftcerts[giftcert].deleted eq ""}
to:
Code:
{section name=giftcert loop=$giftcerts}
{if $giftcerts[giftcert].deleted eq ""}
{math assign="total_quantity" equation="x+1" x=$total_quantity}
{math assign="total_items" equation="x+1" x=$total_items}
then change the following code, around line 155:
from:
Code:
<TR>
<TD valign="top" class="ProductDetails" height="14"></TD>
<TD valign="top" class="ProductDetails" height="14"></TD>
</TR>
{/if}
{/section}
to:
Code:
<TR>
<TD valign="top" class="ProductDetails" height="14"></TD>
<TD valign="top" class="ProductDetails" height="14"></TD>
</TR>
{/if}
{/section}
{if $config.Custom.show_total_quantity_invoice == "Y" or $config.Custom.show_total_items_invoice == "Y"}
{if $config.Custom.show_total_quantity_invoice == "Y"}
<TR>
<TD valign="top">{$lng.lbl_total_items_ordered}:</TD>
<TD valign="top">{$total_items}</TD>
</TR>
{/if}
{if $config.Custom.show_total_items_invoice == "Y"}
<TR>
<TD valign="top">{$lng.lbl_total_quantity_ordered}:</TD>
<TD valign="top">{$total_quantity}</TD>
</TR>
{/if}
<TR>
<TD valign="top"></TD>
<TD valign="top"></TD>
</TR>
{/if}
>>>>>>>>>>>>>>>>>>>>>>>>
In file
skin1/mail/order_data.tpl, change the following code, around line 2:
from:
Code:
{$lng.lbl_products_ordered}:
-----------------
{section name=prod_num loop=$products}
to:
Code:
{assign var = "total_items" value = 0}
{assign var = "total_quantity" value = 0}
{$lng.lbl_products_ordered}:
-----------------
{section name=prod_num loop=$products}
{math assign="total_quantity" equation="x+y" x=$total_quantity y=$products[prod_num].amount}
{math assign="total_items" equation="x+1" x=$total_items}
then change the following code, around line 23:
from:
Code:
{/section}
{section name=giftcert loop=$giftcerts}
to:
Code:
{/section}
{section name=giftcert loop=$giftcerts}
{math assign="total_quantity" equation="x+1" x=$total_quantity}
{math assign="total_items" equation="x+1" x=$total_items}
then change the following code, around line 39:
from:
Code:
{/section}
{$lng.lbl_total}:
-------
to:
Code:
{/section}
{if $config.Custom.show_total_items_invoice == "Y"}
{$lng.lbl_total_items_ordered}: {$total_items}
{/if}
{if $config.Custom.show_total_quantity_invoice == "Y"}
{$lng.lbl_total_quantity_ordered}: {$total_quantity}
{/if}
{$lng.lbl_total}:
-------
>>>>>>>>>>>>>>>>>>>>>>>>
In file
skin1/mail/html/order_data.tpl, change the following code, around line 23:
from:
Code:
{foreach from=$products item=product}
to:
Code:
{assign var = "total_quantity" value = 0}
{assign var = "total_items" value = 0}
{foreach from=$products item=product}
{math assign="total_quantity" equation="x+y" x=$total_quantity y=$product.amount}
{math assign="total_items" equation="x+1" x=$total_items}
then change the following code, around line 55:
from:
Code:
{foreach from=$giftcerts item=gc}
to:
Code:
{foreach from=$giftcerts item=gc}
{math assign="total_quantity" equation="x+1" x=$total_quantity}
{math assign="total_items" equation="x+1" x=$total_items}
then change the following code, around line 54:
from:
Code:
{if $giftcerts ne ''}
{foreach from=$giftcerts item=gc}
<TR>
<TD></TD>
<TD><NOBR>{$lng.lbl_gift_certificate}:</NOBR> {$gc.gcid}</TD>
{if $order.extra.tax_info.display_cart_products_tax_rates eq "Y"}
<TD align="center">-</TD>
{/if}
<TD align="right" nowrap>{include file="currency.tpl" value=$gc.amount}</TD>
<TD align="center">1</TD>
<TD align="right" nowrap>{include file="currency.tpl" value=$gc.amount}</TD>
</TR>
{/foreach}
{/if}
</TABLE>
to:
Code:
{if $giftcerts ne ''}
{foreach from=$giftcerts item=gc}
{math assign="total_quantity" equation="x+1" x=$total_quantity}
{math assign="total_items" equation="x+1" x=$total_items}
<TR>
<TD></TD>
<TD><NOBR>{$lng.lbl_gift_certificate}:</NOBR> {$gc.gcid}</TD>
{if $order.extra.tax_info.display_cart_products_tax_rates eq "Y"}
<TD align="center">-</TD>
{/if}
<TD align="right" nowrap>{include file="currency.tpl" value=$gc.amount}</TD>
<TD align="center">1</TD>
<TD align="right" nowrap>{include file="currency.tpl" value=$gc.amount}</TD>
</TR>
{/foreach}
{/if}
{if $config.Custom.show_total_quantity_invoice == "Y" or $config.Custom.show_total_items_invoice == "Y"}
<TR>
<TD align="center" height="25">{$lng.lbl_total}:</TD>
{if $config.Custom.show_total_items_invoice == "Y"}
<TD align="center" bgColor="#cccccc" height="25">{$total_items}</TD>
{else}
<TD></TD>
{/if}
{if $order.extra.tax_info.display_cart_products_tax_rates eq "Y"}
<TD></TD>
{/if}
<TD></TD>
{if $config.Custom.show_total_quantity_invoice == "Y"}
<TD align="center" bgColor="#cccccc" height="25">{$total_quantity}</TD>
{else}
<TD></TD>
{/if}
<TD></TD>
</TR>
{/if}
</TABLE>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hope this helps.....