Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Include Total Number of Items Purchased in Packing Slip

Include Total Number of Items Purchased in Packing Slip

Views: 3,311

Results 1 to 11 of 11
17 Jun 2009, 4:58 PM
#1
maineiac13 avatar

maineiac13

New Zenner

Join Date:
Sep 2008
Posts:
98
Plugin Contributions:
0

Include Total Number of Items Purchased in Packing Slip

I would like to include the total number of items purchased as part of the packing slip. This information is included in the shopping cart:

$totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . $item_separator . TEXT_TOTAL_WEIGHT . $_SESSION['cart']->show_weight() . TEXT_PRODUCT_WEIGHT_UNIT . $item_separator . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total()); 

However that information is dropped for the invoice and packing slip. Can anyone tell me how to get (just the quantity part) to appear in the packing slip?

Thanks

17 Jun 2009, 7:06 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Include Total Number of Items Purchased in Packing Slip

If you just want the number of line-items (regardless of quantity selected on each line), simply echo out the value of:```
sizeof($order->products)

17 Jun 2009, 8:38 PM
#3
maineiac13 avatar

maineiac13

New Zenner

Join Date:
Sep 2008
Posts:
98
Plugin Contributions:
0

Re: Include Total Number of Items Purchased in Packing Slip

Yes..many thanks....that works for those situations where a customer has ordered one of each item and is a big help for most circumstances....Is there also a way to have it reflect the total number of items purchased where the customer may have ordered more than one of certain items?

Also just to be clear for others who are looking at this thread, here is what I did:

In admin/includes/languages/english/packingslip.php I added a line:

define('ITEMS_PURCHASED', 'Number of Items Ordered:');

In admin/packingslip.php I added the following after similar language showing the payment method so that the number of items would show just below that information in the packing slip:

<tr>
        <td class="main"><strong><?php echo ITEMS_PURCHASED; ?></strong></td>
        <td class="main"><?php echo sizeof($order->products); ?></td>
      </tr>
17 Jun 2009, 8:40 PM
#4
maineiac13 avatar

maineiac13

New Zenner

Join Date:
Sep 2008
Posts:
98
Plugin Contributions:
0

Re: Include Total Number of Items Purchased in Packing Slip

By the way...is there a way to edit the title of this thread so that I can correct the typo where it reads: "Inclued" instead of "Include"?

17 Jun 2009, 10:06 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Include Total Number of Items Purchased in Packing Slip

You could try using this PHP code to prepare a different variable to display:```
$qtyDisplay = 0;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
$qtyDisplay += ($order->products[$i]['qty']);
}
echo $qtyDisplay;

17 Jun 2009, 11:12 PM
#6
maineiac13 avatar

maineiac13

New Zenner

Join Date:
Sep 2008
Posts:
98
Plugin Contributions:
0

Re: Include Total Number of Items Purchased in Packing Slip

Yes...that did the trick...Thanks again...and also thanks for correcting my typo in the Title.

21 Oct 2009, 5:05 PM
#7
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Re: Include Total Number of Items Purchased in Packing Slip

I've been trying to use this code on the checkout_success page, but had no luck so far.

Would someone be able to point me in the right direction as to where the code needs to be placed please?

Many thanks,

Alex

21 Oct 2009, 7:17 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Include Total Number of Items Purchased in Packing Slip

This thread is discussing alterations to the Packing Slip.

What exactly are you wanting to do to the checkout-success page and why?

22 Oct 2009, 9:22 AM
#9
alex_clarke avatar

alex_clarke

Totally Zenned

Join Date:
Mar 2006
Posts:
909
Plugin Contributions:
1

Re: Include Total Number of Items Purchased in Packing Slip

I needed to get the total number of items purchased to display on the checkout_success page. This is required for some JavaScript conversion code that I'm using.

A simple SQL query helped and I've included my code below to assist others.

$ac_total_items = $db->Execute('SELECT SUM(products_quantity) FROM ' . TABLE_ORDERS_PRODUCTS . ' WHERE orders_id = ' . $zv_orders_id);
$ac_total_items = $ac_total_items->fields['SUM(products_quantity)'];

The $ac_total_items variable can now be used to display the total number of products ordered (it also takes into account multiple quantities).

24 Oct 2009, 8:27 AM
#10
stitchnkitty avatar

stitchnkitty

Totally Zenned

Join Date:
Jun 2009
Location:
Des Moines, Iowa USA
Posts:
618
Plugin Contributions:
0

Re: Include Total Number of Items Purchased in Packing Slip

Can you include exactly where the coding in posting #9 and #5 should be included for those uf us who are newbies?

what fiels and where within these files?

1 Feb 2011, 4:15 PM
#11
republic avatar

republic

New Zenner

Join Date:
Dec 2005
Posts:
1
Plugin Contributions:
0

Re: Include Total Number of Items Purchased in Packing Slip

Has someone made this work? If so - where have you placed the code as listed in post #9?

Thanks!