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)
-   -   Need Total Qty on Invoice page (https://forum.x-cart.com/showthread.php?t=12691)

crazytees 03-09-2005 06:13 AM

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

crazytees 03-12-2005 09:22 AM

Anyone? Bueller?

balinor 03-12-2005 09:53 AM

Please don't double post, I have removed your other post and moved this topic to the template editing forum. Thank you.

shan 03-14-2005 02:04 AM

if you search func.php for the fumction that gets the total weight you can use similar code to work out the total items

dsparks 03-14-2005 08:31 PM

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.....

crazytees 03-15-2005 09:23 AM

Thank you VERY much! That worked perfect!


All times are GMT -8. The time now is 10:02 PM.

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