View Single Post
  #1  
Old 11-02-2006, 04:59 AM
 
balinor balinor is offline
 

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

Default Printable Packing Slip - 4.0.x

Many of our clients want to offer a completely different version of the invoice as a packing slip, often with no prices shown. This mod will create another button on the admin order page, as well as a new invoice template which you can alter to your liking. This code is for 4.0.18, but should work on any of the 4.0.x versions. It probably WILL NOT work on 4.1.

First, we need to add a new mode to order.php. To do this, we need to edit include/history_order.php:

Find this:
Code:
if ($mode == "invoice" or $mode == "label")
replace with this:
Code:
if ($mode == "invoice" or $mode == "label" or $mode == "packing")

Find this:
Code:
if ($mode == "invoice") { if ($current_area == "A" || ($current_area == "P" && !empty($active_modules["Simple_Mode"]))) $smarty->assign("show_order_details", "Y"); func_display("main/order_invoice_print.tpl",$smarty); } elseif ($mode == "label") func_display("main/order_labels_print.tpl",$smarty); $smarty->debugging = $_tmp_smarty_debug; }
Replace with this:
Code:
if ($mode == "invoice") { if ($current_area == "A" || ($current_area == "P" && !empty($active_modules["Simple_Mode"]))) $smarty->assign("show_order_details", "Y"); func_display("main/order_invoice_print.tpl",$smarty); } elseif ($mode == "packing") func_display("main/order_packing_print.tpl",$smarty); elseif ($mode == "label") func_display("main/order_labels_print.tpl",$smarty); $smarty->debugging = $_tmp_smarty_debug; }

Next, we need to add a button to the order page of your admin area. Open skin1/main/history_order.tpl.

Find this:
Code:
{include file="buttons/button.tpl" button_title=$lng.lbl_print_invoice target="_blank" href="order.php?orderid=`$order.orderid`&mode=invoice"}

Just after it, add this:
Code:
<br>{if $usertype ne "C"} {include file="buttons/button.tpl" button_title="Print Packing Slip" target="_blank" href="order.php?orderid=`$order.orderid`&mode=packing"}{/if}

Now we need to create the new templates we just called. In the skin1/main directory, create a template called order_packing_print.tpl. Put this code in it:
Code:
<HTML> <BODY> {if $config.Appearance.print_orders_separated eq "Y"} {assign var="separator" value="<DIV style='page-break-after:always'></DIV>"} {else} {assign var="separator" value="<br /><HR size='1' noshade><br />"} {/if} {section name=oi loop=$orders_data} { include file="mail/html/order_invoice_packing.tpl" order=$orders_data[oi].order customer=$orders_data[oi].customer products=$orders_data[oi].products giftcerts=$orders_data[oi].giftcerts} {if not %oi.last%} {$separator} {/if} {/section} </BODY> </HTML>

Next, we need to create the unique invoice template and data template. Extract the two files in the attached zip, and upload them to the skin1/mail/html folder.

That should do it. Edit order_invoice_packing.tpl and order_data_packing.tpl to achieve the look/data display you are looking for. This order_data_packing.tpl does not include pricing information. If you would like to add that back in, simply copy the contents of order_data.tpl into order_data_packing.tpl. Let me know if you have any issues.
Attached Files
File Type: zip templates.zip (2.4 KB, 1070 views)
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development