Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS Labels not working


aldaffodil

Recommended Posts

Has anyone gotten this to work properly? The contribution is so scattered, is there not a final fixed version yet? This would be a HUGE timesaver if I could get it to work right. Any help would be GREATLY appreciated.

 

 

Yes. Here's the file that works with US as default and sends email confirmation as well.

 

[/code]

<?php

/*

$Id: diffrentshipping.php,v 2.0 2006/02/04 04:21:26 chris moralesExp $

 

DEVLOPED BY CHRIS MORALES www.goldencrown.biz

 

EDITED BY Tom Wojcik www.xpertcomp.com

 

EDITED BY BILLY BRENNER, www.ecommercedesigns.biz

 

EDITED BY Tony Mazz www.TestProducts.com

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

/*

CONFIGURATION NOTE

if your address contains a quotation mark like ' then before it include a "\"

so "O'Sullivan St" Would be entered as O\'Sullivan St)

 

Also, Do not include Periods on abbreviations. Type "St" not "St."

They are not needed, and the USPS website probably doesnt accept them.

 

END CONFIGURATION NOTE

*/

 

//**********************************************************************

//CONFIGURATION AREA

define('STREET', ''); //Your Street Address

define('STREET2', ''); //Your Apartment Number (if Aplicable)

define('CITY', ''); //Your City

define('URBANIZATION', ''); //Puerto Rico Only!

define('STATE', ''); //Your State (Abreviation)

define('ZIP', ''); //Your Zip Code

//END CONFIGURATION

//**********************************************************************

 

 

require('includes/application_top.php');

 

//commented following 2 lines out since I don't think they are needed - BAC

// require(DIR_WS_CLASSES . 'currencies.php');

// $currencies = new currencies();

 

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

// not needed? $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . tep_db_input($oID) . "'");

 

include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);

 

$zone_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_name = '" . $order->delivery['state'] . "'");

$return_zone = tep_db_fetch_array($zone_query);

?>

 

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML lang="en">

 

<HEAD>

 

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

 

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

 

<TITLE>USPS - Label Information</TITLE>

<META name="title" content="USPS - Label Information">

<META name='author' content=''>

<META name='description' content='Create A Shipping Label'>

<META name='expiration date' content='01/01/2011'>

<META name='keywords' content='Click-N-Ship, Shipping Labels, Print Shipping Labels, Online Labels, PC Postage, Express Mail, Priority Mail, The United States Postal Service'>

<META name='robots' content='index,follow'>

 

<script SRC="<?php echo DIR_WS_ADMIN ?>images/jscript/logonSessionMaintenance.js"></script>

<script SRC="<?php echo DIR_WS_ADMIN ?>images/jscript/testDropDown.js"></script>

<script SRC="<?php echo DIR_WS_ADMIN ?>images/jscript/testField.js"></script>

<script SRC="<?php echo DIR_WS_ADMIN ?>images/jscript/testRadioButton.js"></script>

<script language="JavaScript">

var formAlreadySubmitted = false;

</script>

 

<script language="JavaScript">

function setCursor (field) {

field.focus();

}

function clearAddress (addrType)

{

theForm = document.forms[0];

if (addrType == "return")

{

theForm.returnFullName.value = "";

theForm.returnCompanyName.value = "";

theForm.returnAddressOne.value = "";

theForm.returnAddressTwo.value = "";

theForm.returnCity.value = "";

theForm.returnState.value = "";

theForm.returnState.selectedIndex = 0;

theForm.returnZipcode.value = "";

}

else if (addrType == "return_here")

{

theForm.returnFullName.value = "<?php echo nl2br(STORE_NAME); ?>";

theForm.returnCompanyName.value = "";

theForm.returnAddressOne.value = "<?php echo STREET; ?>";

theForm.returnAddressTwo.value = "<?php echo STREET2; ?>";

theForm.returnCity.value = "<?php echo CITY; ?>";

theForm.returnState.value = "<?php echo STATE; ?>";

theForm.returnZipcode.value = "<?php echo ZIP; ?>";

}

else if (addrType == "return_cust_return")

{

theForm.returnFullName.value = "<?php echo $order->delivery['name'];?>";

theForm.returnCompanyName.value = "<?php echo $order->delivery['company'];?>";

theForm.returnAddressOne.value = "<?php echo $order->delivery['street_address'];?>";

theForm.returnAddressTwo.value = "<?php echo $order->delivery['suburb'];?>";

theForm.returnCity.value = "<?php echo $order->delivery['city'];?>";

theForm.returnState.value = "<?php echo $return_zone['zone_code'] ;?>";

theForm.returnZipcode.value = "<?php echo $order->delivery['postcode'];?>";

}

else if (addrType == "delivery")

{

theForm.deliveryFullName.value = "";

theForm.deliveryCompanyName.value = "";

theForm.deliveryAddressOne.value = "";

theForm.deliveryAddressTwo.value = "";

theForm.deliveryCity.value = "";

theForm.deliveryState.value = "";

theForm.deliveryZipcode.value = "";

theForm.deliveryEmail.value = "";

 

}

else if (addrType == "delivery_here")

{

theForm.deliveryFullName.value = "<?php echo nl2br(STORE_NAME); ?>";

theForm.deliveryCompanyName.value = "";

theForm.deliveryAddressOne.value = "<?php echo STREET; ?>";

theForm.deliveryAddressTwo.value = "<?php echo STREET2; ?>";

theForm.deliveryCity.value = "<?php echo CITY; ?>";

theForm.deliveryState.value = "<?php echo STATE; ?>";

theForm.deliveryZipcode.value = "<?php echo ZIP; ?>";

}

else if (addrType == "delivery_cust_return")

{

theForm.deliveryFullName.value = "<?php echo $order->delivery['name'];?>";

theForm.deliveryCompanyName.value = "<?php echo $order->delivery['company'];?>";

theForm.deliveryAddressOne.value = "<?php echo $order->delivery['street_address'];?>";

theForm.deliveryAddressTwo.value = "<?php echo $order->delivery['suburb'];?>";

theForm.deliveryCity.value = "<?php echo $order->delivery['city'];?>";

theForm.deliveryState.value = "<?php echo $return_zone['zone_code'] ;?>";

theForm.deliveryZipcode.value = "<?php echo $order->delivery['postcode'];?>";

}

}

 

function checkAPOFPOAddress (theField)

{

found = false;

if (theField.name.indexOf("zipcode") != -1)

{

pattern1 = /09([0-8])/;

pattern2 = /96([2-6])/;

zip = theField.value.trim().substring(0, 3);

if (zip.match(pattern1) || zip.match(pattern2) || zip == "340")

found = true;

}

else if (theField.name.indexOf("city") != -1)

{

city = theField.value.trim().toUpperCase();

if (city == "APO" || city == "FPO")

found = true;

}

if (found)

{

alert("Sorry, online shipping labels cannot be used for APO/FPO addresses. We apologize for any inconvenience.");

theField.focus();

}

}

 

function checkShippingFromZIP()

{

aForm = document.forms[0];

// if the "other" box is not empty, make sure that the Other radio is selected

if (fieldNotBlank(aForm.other_zipcode, true))

{

if (getRadioValue(aForm.ship_from_zipcode) != "new")

{

if (confirm("Would you like to have the delivery time and postage calculated based\ron the ZIP Code you entered in the \"Other\" box?"))

aForm.ship_from_zipcode[1].checked = true;

else

return false;

}

}

}

 

</script>

</head>

<!-- USPS HEADER -->

<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" link="#003399" alink="#CC0000" vlink="#999999" bgcolor="#FFFFFF" onLoad="c_MaintainSessionLightEcap(); startCountDown('https://sss-web.usps.com/ds/jsps/lf_logoff.jsp?nextURL=/ds/jsps/timedOut.jsp');checkJavaPlugin()" onUnload="">

<script SRC="<?php echo DIR_WS_ADMIN ?>images/jscript/windows.js"></script>

<span style="display:none">Your sign in session will expire after 15 minutes of server inactivity. In order to maintain your data stored in this session, you will need to navigate to another page in this application within that timeframe.</span>

<form name="labelInformationForm" action="https://sss-web.usps.com/cns/saveLabelInformation.do?deliveryCountry=1" method="post">

<table align="center" border="0" cellpadding="0" cellspacing="0" summary="This table is used to format the header of the page.">

<tr>

<td colspan="4"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="7" height="7" alt="" border="0"></td>

</tr>

<tr>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" alt="" width="8" height="1" border="0"></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/hdr_uspsLogo.jpg" width="157" border="0" height="25" alt="USPS Homepage"></a><a href="#content"><img alt="Skip Navigation" border="0" height="1" src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1"></a></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="200" height="30" alt="" border="0"></td>

<td valign="bottom" align="right" class="utilitybar"><a href="http://www.usps.com" class="utilitybar">Home</a> | <a href="https://ecap21.usps.com/cgi-bin/ecapbv/scripts/login.jsp?app=GSS&appURL=https://sss-web.usps.com/cns/enterLabelInfo.do">Sign In</a>

</tr>

</table>

<table align="center" border="0" cellpadding="0" cellspacing="0" summary="This table is used to format page content.">

<tr>

<td valign="top"></td>

<td valign="top" align="left">

<input type="hidden" name="shortName" value="">

<input type="hidden" name="action" value="">

<input type="hidden" name="navigation" value="">

<input type="hidden" name="submitType" value="">

 

<input type="hidden" name="currentpage" value="EnterLabelInfo.do">

<input type="hidden" name="nav_type" value="">

<input type="hidden" name="source" value="">

<input type="hidden" name="unique" value="1081710538409">

 

<input type='hidden' name='return_short_name' value=''>

<input type='hidden' name='delivery_short_name' value=''>

<!--<input type='hidden' name='address_cleared' value=''>-->

 

<OBJECT id="myApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 1 HEIGHT = 1 >

<PARAM NAME=ARCHIVE VALUE="DetectPluginApplet.jar">

<PARAM NAME=CODEBASE VALUE="../../" >

<PARAM NAME=CODE VALUE="com.ibm.lex.services.DetectPluginApplet.class" >

<PARAM NAME="scriptable" VALUE="true" >

</object>

 

 

<a name="content"></a>

 

<table border="0" cellpadding="0" cellspacing="0" summary="This table is used to display the top navigation.">

<tr>

<td colspan="2" valign="top">

<table border="0" cellpadding="0" cellspacing="0" summary="This table is used to format page content.">

<tr>

<td bgcolor="#FFFFFF"><img height="2" width="2" border="0" alt="" src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif"></td>

<td valign="top">

<table summary="This table formats the form information." border="0" cellspacing="0" cellpadding="0">

<tr>

<td height="1"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td valign="top">

<!-- start of the return address block -->

<table cellpadding="0" cellspacing="0" border="0" summary="This table is used to format delivery address data.">

<tr>

<td colspan="2" height="32" valign="top"><img src='<?php echo DIR_WS_ADMIN ?>images/uspsimages/sub_enterreturn_address.gif' width='119' height='21' border='0' alt='Enter Return Address'><br><a href="java script:clearAddress('return');" tabindex="2"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/button_clear.gif" border="0" width="45" height="17" alt="Clear Return Address"></a> <a href="java script:clearAddress('return_here');" tabindex="2">Here</a> <a href="java script:clearAddress('return_cust_return');" tabindex="2">Return Address</a></td>

</tr>

<tr>

<td colspan="2">

<table border="0" cellspacing="0" cellpadding="0" summary="This table is used to format the Delivery Address information.">

<tr>

<td>

<table border="0" cellspacing="0" cellpadding="0" summary="This table is used to format the Delivery Address information.">

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >Full Name</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnFullName" id="returnFullName" style="width:160px" size="19" tabindex="4" value='<?php echo nl2br(STORE_NAME); ?>' maxlength="38">

<div style="display:none"><label for="return_full_name">* Full Name</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class=label >Company Name</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnCompanyName" id="returnCompanyName" style="width:160px" size="19" tabindex="5" value='' maxlength="38">

<div style="display:none"><label for="return_company_name">Company Name</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >Address 1</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnAddressOne" id="returnAddressOne" style="width:160px" size="19" tabindex="6" value='<?php echo STREET; ?>' maxlength="38">

<div style="display:none"><label for="return_address_one">* Address 1</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class=label >Address 2</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnAddressTwo" id="returnAddressTwo" style="width:160px" size="19" tabindex="7" value='<?php echo STREET2; ?>' maxlength="38">

<div style="display:none"><label for="return_address_two">Address 2 (Apt, floor, suite, PMB, etc)</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >City</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnCity" id="returnCity" style="width:160px" size="19" tabindex="9" value='<?php echo CITY; ?>' maxlength="38">

<div style="display:none"><label for="return_city">* City</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >State</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnState" id="returnState" style="width:160px" size="19" tabindex="9" value='<?php echo STATE; ?>'maxlength="38">

<div style="display:none"><label for="return_state">* State</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >ZIP Code?</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="returnZipcode" id="returnZipcode" style="width:160px" size="19" tabindex="11" value='<?php echo ZIP; ?>' maxlength="10">

<div style="display:none"><label for="return_zipcode">* ZIP Code?</label></div>

</td>

</tr>

</table>

</td> <!-- end of text boxes column -->

</tr>

</table>

</td>

</tr>

</table><!-- end of the Return Address section -->

</td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="10" height="1" alt=""></td>

<td valign="top"><!-- begin of Delivery Address section -->

<table cellpadding="0" cellspacing="0" border="0" summary="This table is used to format delivery address data.">

<tr>

<td colspan="2" height="32" valign="top"><img src='<?php echo DIR_WS_ADMIN ?>images/uspsimages/sub_enterdelivery_address.gif' width='129' height='23' border='0' alt='Enter Delivery Address'><br><a href="java script:clearAddress('delivery');" tabindex="12"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/button_clear.gif" border="0" width="45" height="17" alt="Clear Delivery Address"></a> <a href="java script:clearAddress('delivery_here');" tabindex="2">Here</a> <a href="java script:clearAddress('delivery_cust_return');" tabindex="2">Return Address</a></td>

</tr>

<tr>

<td colspan="2">

<table border="0" cellspacing="0" cellpadding="0" summary="This table is used to format the Delivery Address information.">

<tr>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td>

<table border="0" cellspacing="0" cellpadding="0" summary="This table is used to format the Delivery Address information.">

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >Full Name</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryFullName" id="deliveryFullName" style="width:160px" size="19" tabindex="14" value='<?php echo $order->delivery['name'];?>' maxlength="38">

<div style="display:none"><label for="delivery_full_name">* Full Name</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class=label >Company Name</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryCompanyName" id="deliveryCompanyName" style="width:160px" size="19" tabindex="15" value='<?php echo $order->delivery['company'];?>' maxlength="38">

<div style="display:none"><label for="delivery_company_name">Company Name</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >Address 1</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryAddressOne" id="deliveryAddressOne" style="width:160px" size="19" tabindex="16" value='<?php echo $order->delivery['street_address'];?>' maxlength="38">

<div style="display:none"><label for="delivery_address_one">* Address 1</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class=label >Address 2</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryAddressTwo" id="deliveryAddressTwo" style="width:160px" size="19" tabindex="17" value='<?php echo $order->delivery['suburb'];?>' maxlength="38">

<div style="display:none"><label for="delivery_address_two">Address 2 (Apt, floor, suite, PMB, etc)</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >City</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryCity" id="deliveryCity" style="width:160px" size="19" tabindex="19" value='<?php echo $order->delivery['city'];?>' maxlength="38">

<div style="display:none"><label for="delivery_city">* City</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=label >State</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryState" id="deliveryState" style="width:160px" size="19" tabindex="19" value='<?php switch(strtoupper($order->delivery['state'])):

case 'ALABAMA':

print "AL";

break;

case 'ALASKA':

print "AK";

break;

case 'ARIZONA':

print "AZ";

break;

case 'ARKANSAS':

print "AR";

break;

case 'CALIFORNIA':

print "CA";

break;

case 'COLORADO':

print "CO";

break;

case 'CONNECTICUT':

print "CT";

break;

case 'DELAWARE':

print "DE";

break;

case 'DISTRICT OF COLUMBIA':

print "DC";

break;

case 'FLORIDA':

print "FL";

break;

case 'GEORGIA':

print "GA";

break;

case 'HAWAII':

print "HI";

break;

case 'IDAHO':

print "ID";

break;

case 'ILLINOIS':

print "IL";

break;

case 'INDIANA':

print "IN";

break;

case 'IOWA':

print "IA";

break;

case 'KANSAS':

print "KS";

break;

case 'KENTUCKY':

print "KY";

break;

case 'LOUISIANA':

print "LA";

break;

case 'MAINE':

print "ME";

break;

case 'MARYLAND':

print "MD";

break;

case 'MASSACHUSETTS':

print "MA";

break;

case 'MICHIGAN':

print "MI";

break;

case 'MINNESOTA':

print "MN";

break;

case 'MISSISSIPPI':

print "MS";

break;

case 'MISSOURI':

print "MO";

break;

case 'MONTANA':

print "MT";

break;

case 'NEBRASKA':

print "NE";

break;

case 'NEVADA':

print "NV";

break;

case 'NEW HAMPSHIRE':

print "NH";

break;

case 'NEW JERSEY':

print "NJ";

break;

case 'NEW MEXICO':

print "NM";

break;

case 'NEW YORK':

print "NY";

break;

case 'NORTH CAROLINA':

print "NC";

break;

case 'NORTH DAKOTA':

print "ND";

break;

case 'OHIO':

print "OH";

break;

case 'OKLAHOMA':

print "OK";

break;

case 'OREGON':

print "OR";

break;

case 'PENNSYLVANIA':

print "PA";

break;

case 'PUERTO RICO':

print "PR";

break;

case 'RHODE ISLAND':

print "RI";

break;

case 'SOUTH CAROLINA':

print "SC";

break;

case 'SOUTH DAKOTA':

print "SD";

break;

case 'TENNESSEE':

print "TN";

break;

case 'TEXAS':

print "TX";

break;

case 'UTAH':

print "UT";

break;

case 'VERMONT':

print "VT";

break;

case 'VIRGIN ISLANDS':

print "VI";

break;

case 'VIRGINIA':

print "VA";

break;

case 'WASHINGTON':

print "WA";

break;

case 'WEST VIRGINIA':

print "WV";

break;

case 'WISCONSIN':

print "WI";

break;

case 'WYOMING':

print "WY";

break;

endswitch;?>' maxlength="38">

<div style="display:none"><label for="delivery_state">* State</label></div>

</td>

</tr>

<tr>

<td align="right" class="mainText"><span class=label >ZIP Code?</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><input type="text" name="deliveryZipcode" id="deliveryZipcode" style="width:160px" size="19" tabindex="21" value='<?php echo $order->delivery['postcode'];?>' maxlength="10">

<div style="display:none"><label for="delivery_zipcode">ZIP Code? Address will be standardized as necessary.</label></div>

</td>

<tr>

<td align="right" class="mainText"><span class=label >email</span></td>

<td width="7"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td>

<table border="0" cellpadding="0" width="160" cellspacing="0" summary="This table is used to format page content.">

<tr>

<td width="1" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="27" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="131" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="1" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

</tr>

<tr>

<td width="1" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="27" valign="top"><input tabindex="24" id="emailNotification" name="emailNotification" type="Checkbox" value="Y" CHECKED >

<div style="display:none"><label for="emailNotification"><span class="smmainText">Notify recipient of shipping, via email notification</span></label></div></td>

<td width="131" class="smmainText" align="left" valign="middle"><span class="label">

Notify shipping via email</span></a>.</span></td>

<td width="1" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

</tr>

<tr>

<td width="1" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="27" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="131" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

<td width="1" bgcolor="#CCCCCC"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" width="1" height="1" border="0" alt=""></td>

</tr>

</table>

</td> <td><input type="text" name="deliveryEmail" id="deliveryEmail" style="width:160px" size="19" tabindex="19" value='<?php echo $order->customer['email_address'];?>' maxlength="55">

<div style="display:none"><label for="deliveryEmail">email</label></div>

</td>

</tr>

</table>

</td> <!-- end of text boxes column -->

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

</table>

<table summary="This table formats the form information." border="0" cellspacing="0" cellpadding="0">

<tr>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td height="32" colspan="5" valign="top"><img src='<?php echo DIR_WS_ADMIN ?>images/uspsimages/sub_enterpackage_info.gif' width='150' height='23' alt='Enter Package Information' border='0'></td>

</tr>

<tr>

<td valign="top" class="mainText"><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td colspan="4">

<!-- start of weight formula-->

<?php

$shipping_weight_ot = substr($order->totals[1]['title'],strpos($order->totals[1]['title'],'x') + 1, (strpos($order->totals[1]['title'],'lbs') - strpos($order->totals[1]['title'],'x'))-1 );

$shipping_weight = ($shipping_weight_ot < 0.1 ? 0.1 : $shipping_weight_ot);

$shipping_pounds = floor ($shipping_weight);

$shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));

 

?>

 

<!--end of weight formula-->

 

<table cellspacing="0" cellpadding="0" border="0" summary="This table is used to format content.">

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class=mainTextBoldRed >Weight</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td align="left" bgcolor="#FFFFFF" height="20"><input type="text" name="shippingWeightInPounds" id="shippingWeightInPounds" style="width:50px" size="5" tabindex="26" value='1' maxlength="2">

<div style="display:none"><label for="weight_pounds">* Pounds</label></div>

</td>

<td align="left" class="smmainText"><span class="smmainText"> pounds</span></td>

<td align="left" bgcolor="#FFFFFF" height="20"><input type="text" name="shippingWeightInOunces" id="shippingWeightInOunces" style="width:50px" size="5" tabindex="27" value='0' maxlength="2">

<div style="display:none"><label for="weight_ounces">* Ounces</label></div></td>

<td align="left" class="smmainText"><span class="smmainText"> ounces</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

</tr>

<tr>

<td align="right" class="mainText"><span class="mainTextRed">* </span><span class="label">Shipping Date</span></td>

<td><img src="<?php echo DIR_WS_ADMIN ?>images/uspsimages/spacer.gif" border="0" width="1" height="1" alt=""></td>

<td colspan="4" align="left" bgcolor="#FFFFFF" class="mainText">

<select id="shipping_date" tabindex="28" name="shipping_date">

 

<option value='0'selected ><?php

$today = mktime (0,0,0,date("m") ,date("d"),date("Y"));

 

$today = date('l, F d, Y ',$today);

 

echo $today

?></option>

<option value='1' ><?php

$tomorrow = mktime (0,0,0,date("m") ,date("d")

Tony Mazz

Link to comment
Share on other sites

  • Replies 273
  • Created
  • Last Reply

Top Posters In This Topic

Thanks, Tony, but your post was cut off. Some of the code is missing from your post. Can you either :

- post your code in chunks that are small enough to not get cut off, in "codebox" tags to preserve formatting, or

- update the contribution (preferred)

 

Thanks!

 

-jared

Edited by jcall
Link to comment
Share on other sites

FWIW, some of the problems that some are seeing here can be attributed to not filling out the configuration data at the top of diffrentshipping.php and customerlabel.php .

 

-jared

Link to comment
Share on other sites

Thanks, Tony, but your post was cut off. Some of the code is missing from your post. Can you either :

- post your code in chunks that are small enough to not get cut off, in "codebox" tags to preserve formatting, or

- update the contribution (preferred)

 

Thanks!

 

-jared

 

I see it was truncated. I posted the new file (diffrentshipping.php) at: http://www.oscommerce.com/community/contributions,1498 - Hope that helps.

Tony Mazz

Link to comment
Share on other sites

I feel like such an idiot asking this, but WHERE do I upload this file?

 

And my two cents: a simple "installation.txt" file included with the contribution would be nice. It may be obvious to the developer and oscommerce pros, but many people (including me), don't know oscommerce inside and out and will feel stupid and confused when downloading this file and realizing that there are no installation instructions.

 

Much appreciated! Thanks.

Link to comment
Share on other sites

I feel like such an idiot asking this, but WHERE do I upload this file?

 

And my two cents: a simple "installation.txt" file included with the contribution would be nice. It may be obvious to the developer and oscommerce pros, but many people (including me), don't know oscommerce inside and out and will feel stupid and confused when downloading this file and realizing that there are no installation instructions.

 

Much appreciated! Thanks.

 

The install instructions are in one of the previous versions. All I posted was the file diffrent.php which was modded to work with USPS' current site. As to where to upload: put it in your catalog/admin folder.

Tony Mazz

Link to comment
Share on other sites

The install instructions are in one of the previous versions. All I posted was the file diffrent.php which was modded to work with USPS' current site. As to where to upload: put it in your catalog/admin folder.

 

Thank you. I only just started browsing the contribution system so I apologize for my ignorance.

Link to comment
Share on other sites

  • 3 weeks later...

I installed the "brushwoodnursery 29 Apr 2005" version of this contribution, then updated my stock admin/differentshipping.php to the latest "diffrentshipping.php v2.0 tonymazz 17 Feb 2006" version(had to rename this file to match the filename 'differentshipping.php' found in thefirst installed contribution).

 

Questions:

 

* Do the language files at admin/includes/languages/english (customershippinglabel.php and diffrentshipping.php) actually do anything? I dont see them references anywhere. I renamed one and didnt notice a difference.

 

* The 'USPS label customer' button on the order.php page doesnt seem to work for me(not even sure what its for). It loads a page with the info on it, but then when I hit continue.....I get a 'page cannot be found' error.

 

Thanks

Link to comment
Share on other sites

Is this contribution currently working for anyone? If so, could you please describe the flow of how it should work? I have the most current updates installed, but it still isn't working right. After clicking on usps label shipping, it goes to a usps screen and carries the customer data, but then I have to click on Sign In, and then after I do, it doesn't carry forward the customer data anymore. Any help would be greatly appreciated. This contribution would be a tremendous time saver if I could get it working properly on my shop.

 

Thanks,

Craig

Link to comment
Share on other sites

Craig,

I have the same problem. I get it to work by clicking usps label shipping button. Then I sign in too my usps account. Now, here is where you lose all your customer info. Minimize that window and click on usps label shipping button again.

The page will open again with the customer info and you will be signed in! Now you will be able to complete the process. This works for me I hope it works for you...

 

Moon

Edited by moonbeam

"Woohoo, Just Havin Funnn!"

Link to comment
Share on other sites

in addition to my above questions.....

 

is the "diffrentshipping.php v2.0 tonymazz 17 Feb 2006" version of the diffrentshipping.php file suppose to display a more simplistic HTML page(almost like it kind find the stylesheet)? It's just the info boxes more or less whereas the label customers page is a much nicer looking page with borders and whatnot.

 

It still works so no huge biggie...just wondering if it's SUPPOSE to be like this.

 

Thanks

Link to comment
Share on other sites

Craig,

I have the same problem. I get it to work by clicking usps label shipping button. Then I sign in too my usps account. Now, here is where you lose all your customer info. Minimize that window and click on usps label shipping button again.

The page will open again with the customer info and you will be signed in! Now you will be able to complete the process. This works for me I hope it works for you...

 

Moon

 

Moon, thanks for trying, but for some reason mine doesn't work that way. When I minimize that window and click on usps label shipping button again, it pops open another new window and it's not populated with the customer info.

Link to comment
Share on other sites

not sure if this is going to help anyone, but i just recently mapped out domestic shipping with curl module and it works pretty well. this could be used in the contrib or made into a new one. :thumbsup:

 

<?
unset($form_data);
$pdffile = "usps_label.pdf";

// Shipping Array Setup - fill this in with form data

$form_data = array(
shortName => "",
returnShortName => "",
actionType => "",
navigation => "fresh",
submitType => "",
LabelId => "0",
hBatchEnabled => "false",

returnCountry => "1",
returnFullName => "",
returnCompanyName => "",
returnAddressOne => "",
returnAddressTwo => "",
returnCity => "",
returnState => "",
returnZipcode => "",
returnPhoneNumber => "",
returnUrbanization => "",

deliveryFullName => "",
deliveryCompanyName => "",
deliveryAddressOne => "",
deliveryAddressTwo => "",
deliveryAddressThree => "",
deliveryCity => "",
deliveryState => "",
deliveryUrbanization => "",
deliveryZipcode => "",
province => "",
deliveryPostalCode => "",
deliveryPhoneNumber => "",
deliveryFaxNumber => "",
deliveryEmail => "[email protected]",
emailNotification => "Y",
deliveryCountry => "1",

shippingDate => "Wednesday 03/15/06",
deliveryRefNbr => "",
shippingWeightInPounds => "1",
shippingWeightInOunces => "1",
girthExceedMax => "no",
intlContentsValue => "",
contentsValue => "100.00",
shipFromZipcode => "same",
returnToSender => "Y",
startBatchOrder => "",
privacyActStmt => "on"
);

// construct post var
while(list($key, $value) = each($form_data)) {
$data .= $key . '=' . urlencode($value) . '&';
}
$data = substr($data, 0, -1);

// setup cookie for curl
$mycookiefile = "/var/www/USPS/usps.txt";
$fp = fopen("$mycookiefile","w") or die("<BR><B>Unable to open cookie file $mycookiefile for write!<BR>");
chmod("$mycookiefile", 0777);
fclose($fp);

// get first page
$url = "https://sss-web.usps.com/cns/enterLabelInfo.do?landing=true&countryID=1";
$response = getPage($url, $mycookiefile);

//find cflt number
$pattern = 'saveLabelInformation.do';
$position = strpos($response, $pattern) + 29;
$trackingnum = substr($response, $position, 13);

// send return and shipping address info from $data
$url = "https://sss-web.usps.com/cns/saveLabelInformation.do?cflt=".$trackingnum;
$response = getPage($url, $mycookiefile, $data);

// send service data - this can be changed to whatever service type you like
$data = "actionType=&LabelId=0&BatchId=0&service=PRI&specials=PRIDeliverConfirm&postage=no";
$url = "https://sss-web.usps.com/cns/saveServicePostageOptions.do";
$response = getPage($url, $mycookiefile, $data);

//confirm
$url = "https://sss-web.usps.com/cns/checkOut.do?cartId=session&productCode=DS";
$response = getPage($url, $mycookiefile);

// agree to insurance statement
$data = "agree=1";
$url = "https://sss-web.usps.com/cns/status.do";
$response = getPage($url, $mycookiefile, $data);

//trigger pdf creation
$url = "https://sss-web.usps.com/cns/payPrint.do";
$response = getPage($url, $mycookiefile);

// download pdf
$url = "https://sss-web.usps.com/cns/servlet/com.usps.cns.web.pdf.LabelGenerationServlet?sample=false&productCode=PRI&dummy=file.pdf";
$pdfresponse = getPage($url, $mycookiefile);

//save temporary pdf
if ($pdfresponse != "") {

$fp = fopen("$pdffile","w");
fwrite($fp, $pdfresponse);
chmod("$pdffile", 0777);
fclose($fp);
}

// get last page
$data = "action=&sample=false&productCode=PRI&returnPage=&labelPrint=yes";
$url = "https://sss-web.usps.com/cns/answerQuestion.do";
$response = getPage($url, $mycookiefile, $data);

// find delivery confirmation number
$pattern = 'Label Number:';
$position = strpos($response, $pattern) + 13;
$confirmnum = substr($response, $position, 25);


echo $confirmnum;



function getPage($url, $cookie, $data)
{

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, "$cookie");
curl_setopt ($ch, CURLOPT_COOKIEFILE, "$cookie");

if ($data != "") {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

return $response;
}
?>

Edited by stevescantool
Link to comment
Share on other sites

Ok guys I've wasted most of my day cleaning up the code and patching up everything

Now you have a one stop download updated, tested & working

 

Follow up the readme

and now when you click on "sign in" it open in a new window so you can login, close the window and than continue processing your label.

 

 

Thanks for everyone who's been helping along with this great contribution

 

Download it now :)

http://www.oscommerce.com/community/contributions,1498

 

Jerf.

Edited by Jerfersor
Link to comment
Share on other sites

Ok guys I've wasted most of my day cleaning up the code and patching up everything

Now you have a one stop download updated, tested & working

 

Follow up the readme

and now when you click on "sign in" it open in a new window so you can login, close the window and than continue processing your label.

Thanks for everyone who's been helping along with this great contribution

 

Download it now :)

http://www.oscommerce.com/community/contributions,1498

 

Jerf.

 

Wish I would have had this about a week ago :P

 

Some of your images in /uspsimages/ are missing from the install package:

 

header_print_shipping.gif

light_blue_notsignedin_bar.jpg

top_bar3.gif

CNS_tax_callout2.gif

sub_startabatch_order.gif

corner_footer.jpg

badge2.jpg

 

...not sure if you meant to remove them in the html or just forgot to include the images. Also, SIGN IN button doesnt open in a new window.

Edited by Sid04
Link to comment
Share on other sites

Actually, theres more images then that missing. Also, not only does the SIGN IN link not open a new window......if you do try to sign in with the signin page that the link opens, it doesnt work....gives a 'page not found'. If I login directly at USPS.com.....then close that window, then go back into my order page in admin and click the USPS button again the differentshipping.php page opens correctly BUT if I click on continue I get another 'page cannot be found' error.

 

Basically it isnt working at all for me.....the last version was already installed and working fine for me.

 

Version 1.9 seems to need alittle more tweaking.

Edited by Sid04
Link to comment
Share on other sites

Actually, theres more images then that missing. Also, not only does the SIGN IN link not open a new window......if you do try to sign in with the signin page that the link opens, it doesnt work....gives a 'page not found'. If I login directly at USPS.com.....then close that window, then go back into my order page in admin and click the USPS button again the differentshipping.php page opens correctly BUT if I click on continue I get another 'page cannot be found' error.

 

Basically it isnt working at all for me.....the last version was already installed and working fine for me.

 

Version 1.9 seems to need alittle more tweaking.

 

 

mmm it seemed to be working perfectly on my end...

 

I'll work on it a little more and tweak it up when final ver is ready i guess i'll upload

Link to comment
Share on other sites

Thanks Sid04!

 

I noticed I had packed the wrong "differentshipping.php" file

now I uninstalled ... reinstalled using the new pack to make sure I had everything working ... and it did.

 

So that should be a final.

 

Thanks again

Link to comment
Share on other sites

I tried this expecting the latest version to have everything but apparently it does not. I went back to previous versions to find the images and in short it loads but doesn't work for me.

 

Is the differentshipping.php in the /catalog directory belong there, the instructions say nothing about uploading anything outside of the admin directory.

 

I hope someone repacks it with everything included. This seems like a top notch contrib, but it's not working out for me right now.

Link to comment
Share on other sites

I tried this expecting the latest version to have everything but apparently it does not. I went back to previous versions to find the images and in short it loads but doesn't work for me.

 

Is the differentshipping.php in the /catalog directory belong there, the instructions say nothing about uploading anything outside of the admin directory.

 

I hope someone repacks it with everything included. This seems like a top notch contrib, but it's not working out for me right now.

 

 

After I typed this it occured to me that the rouge different_ship.php in the catalog directory actually belonged in the admin directory. It loads and appears to work but I see an exception: java.lang.NullponterException.... wondering what that's all about.

Link to comment
Share on other sites

Thanks Sid04!

 

I noticed I had packed the wrong "differentshipping.php" file

now I uninstalled ... reinstalled using the new pack to make sure I had everything working ... and it did.

 

So that should be a final.

 

Thanks again

 

No problem, thanks for the fix.

 

HSMagic is correct, the new package still contains the old differentshipping file in the admin/ directory, and the correct one in the catalog/ directory.

 

Still have an issue. The weight is incorrect. Im guessing that your adding the tare weight to the total weight from the invoice. This is unneeded because the extra tare weight would already be included in the weight from the order invoice.......then your adding it on a second time.

 

And if ya want to be really picky, the actual word WEIGHT on the differentshipping.php page is bold red

<span class=mainTextBoldRed >Weight: </span>

 

Other then that, nice job :thumbsup:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...