Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS Priority Mail labels


Guest

Recommended Posts

Posted

For those of you in the US who use Priority Mail to ship... Not a big deal. Just thought I would share my hack for printing a priorty label. It prints perfectly in place on a regular printer. There are some parts of the code that you don't absolutely need as I just hacked up packingslip.php.

 

Create your file called priority_label.php in admin

Create a button for admin

Create a small logo for the label (optional)

Add the proper definitions in filenames.php and admin/includes/languages/english/orders.php

 

Paste this code in the new file: (replace "whitespace.gif" with a spacer of your own)

<?php

 

  require('includes/application_top.php');

 

  require(DIR_WS_CLASSES . 'currencies.php');

  $currencies = new currencies();

 

  $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

  $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

 

  include(DIR_WS_CLASSES . 'order.php');

  $order = new order($oID);

  $date = date('Y-M-d');

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- body_text //-->

<table border="0" width="100%" cellspacing="0" cellpadding="2">

  <tr>

    <td><table border="0" width="300" cellspacing="0" cellpadding="0">

<tr><img src="/images/whitespace.gif"><br><img src="/images/whitespace.gif"><br><img src="/images/whitespace.gif"></tr>

      <tr><td width="35"></td>

<td><?php echo tep_image(DIR_WS_IMAGES . 'your_logo.jpg', 'your store name'); ?></td>

        <td>your store name<br>your address<br>town,state,zip</td>

      </tr>

    </table></td>

  </tr>

        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr><img src="/images/whitespace.gif"><br></tr>

          <tr>

<td width="110"></td>

            <td><font size="5"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>

          </tr>

        </table></td>

      </tr>

    </table></td>

  </tr>

<!-- body_text_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Go to admin/orders.php and find:

        $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>');

 

and change to:

        $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . tep_href_link(FILENAME_PRIORITY_LABEL, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . tep_image_button('button_priority_label.gif', IMAGE_ORDERS_PRIORITY_LABEL) . '</a>');

 

Let me know if I missed anything. Enjoy!

  • 2 weeks later...
Posted

Hey, you should make this a contribution! When I get some time, I'm going to make this. Right now, I've justed hacked up the Packing Slip to do the same job.

Posted
Hey, you should make this a contribution! When I get some time, I'm going to make this. Right now, I've justed hacked up the Packing Slip to do the same job.

 

Hey Dan,

That's exactly what I did (hacked up a copy of packingslip.php).

 

Whereabouts in Philly are you from? That's where I grew up! Only moved to CT 3 years ago.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...