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

Need Total Qty on Invoice page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-09-2005, 06:13 AM
  crazytees's Avatar 
crazytees crazytees is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: Oklahoma
Posts: 31
 

Default Need Total Qty on Invoice page

I use x-cart for my t-shirt site but I don't use x-affiliate. I want to pay my affiliates $10 per shirt they sell for me. The affiliate software I use needs a total quantity on the invoice page to compute the commission. I need to multiply the TotalQty * 10 so that I can get a sum that I give my affiliates 100% of resulting in them getting $10 per item sold in the stats.

Does anyone know how to get a total qty on the invoice page (mail/html/order_data.tpl) ?

I see {$product.amount} is displayed for each line to display the qty for each product ordered, but is there a way to total all the quantities together at the bottom along with the subtotal?

Any help would be greatly appreciated!

This is the desired effect I am trying to achieve.
http://www.crazytees.com/zebra/qty.gif
__________________
Version 4.4.1
Reply With Quote
  #2  
Old 03-12-2005, 09:22 AM
  crazytees's Avatar 
crazytees crazytees is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: Oklahoma
Posts: 31
 

Default

Anyone? Bueller?
__________________
Version 4.4.1
Reply With Quote
  #3  
Old 03-12-2005, 09:53 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Please don't double post, I have removed your other post and moved this topic to the template editing forum. Thank you.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #4  
Old 03-14-2005, 02:04 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

if you search func.php for the fumction that gets the total weight you can use similar code to work out the total items
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #5  
Old 03-14-2005, 08:31 PM
 
dsparks dsparks is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 34
 

Default

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.....
__________________
X-Cart Gold: v4.0.17
Reply With Quote
  #6  
Old 03-15-2005, 09:23 AM
  crazytees's Avatar 
crazytees crazytees is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: Oklahoma
Posts: 31
 

Default

Thank you VERY much! That worked perfect!
__________________
Version 4.4.1
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 08:47 AM.

   

 
X-Cart forums © 2001-2020