Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS Rate V4, Intl Rate V2 (official support thread)


Guest

Recommended Posts

The original author of this module is no longer on the forum, so this is about as active as it gets.

 

My copy (v1.7) doesn't have a foreach() on Line 95, so I can't say for sure, but it could be problem with the Special Services that you have set. I seem to remember that some of these changed in the January 2013 revision, so that could be the problem.

 

Again, this is mostly a guess based on the information available. If you want a better guess, post 20 lines or so around line 95, and indicate which line that is in your post.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

Thank you very much for your reply. Here's the whole file. I've tried messing with the Special Services to no avail. By default I have them all checked to no.

 

I also created a new item with a weight of .0625 lbs so I could pinpoint at exactly which weight the error occurred. Adding that item, in any quantity, would not cause the error. However when I added quantities of the items I normally sell, it happened right around 4 lbs. Very confusing.

 

Any ideas you have would be super appreciated, and thanks again for jumping in to help!!!

 

<?php
/*
USPS Rate V4 Intl Rate V2 - v.1.7
Copyright (c) 2012 osCbyJetta
Released under the GNU General Public License
*/
class usps
{
var $code, $title, $description, $icon, $enabled;
   function usps()
 {
 global $order;
 $this->code = 'usps';
 $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE;
 $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION;
 $this->sort_order = MODULE_SHIPPING_USPS_SORT_ORDER;
 $this->icon = DIR_WS_ICONS . 'shipping_usps.gif';
 $this->tax_class = MODULE_SHIPPING_USPS_TAX_CLASS;
 $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
 if ($this->enabled == true && (int)MODULE_SHIPPING_USPS_ZONE > 0)
  {
  $check_flag = false;
  $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
  while ($check = tep_db_fetch_array($check_query))
   {
   if ($check['zone_id'] < 1) $check_flag = true;
   elseif ($check['zone_id'] == $order->delivery['zone_id']) $check_flag = true;
   }
  if ($check_flag == false) $this->enabled = false;
  }
 }
   function quote($method = '')
 {
 global $order, $shipping_weight, $shipping_num_boxes, $currencies, $shipping;
 $iInfo = '';
 $methods = array();
 $shipping_weight = ($shipping_weight < 0.0625 ? 0.0625 : $shipping_weight);
 $this->pounds = (int)$shipping_weight;
//In the following line, the digit 3 represents rounding shipping weight up to 3 decimal places - 01/27/13 a.forever edit
 $this->ounces = ceil(round(16 * ($shipping_weight - $this->pounds), 3));
 $uspsQuote = $this->_getQuote();
 if (isset($uspsQuote['Number'])) return false;
 if ($order->delivery['country']['iso_code_2'] == 'US')
  {
  $dExtras = array();
  $dOptions = explode(', ', MODULE_SHIPPING_USPS_DMST_SERVICES);
  foreach ($dOptions as $key => $val)
   if(strlen($dOptions[$key]) > 1)
 if ($dOptions[$key+1] == 'C' || $dOptions[$key+1] == 'S' || $dOptions[$key+1] == 'Y')
  $dExtras[$dOptions[$key]] = $dOptions[$key+1];
  }
 else
  {
  $iExtras = array();
  $iOptions = explode(', ', MODULE_SHIPPING_USPS_INTL_SERVICES);
  foreach ($iOptions as $key => $val)
   if(strlen($iOptions[$key]) > 1)
 if ($iOptions[$key+1] == 'C' || $iOptions[$key+1] == 'S' || $iOptions[$key+1] == 'Y')
  $iExtras[$iOptions[$key]] = $iOptions[$key+1];
  if (MODULE_SHIPPING_USPS_REGULATIONS == 'True')
   $iInfo =  '<div id="iInfo">' .
    '<div id="showInfo" class="ui-state-error" style="cursor:pointer; text-align:center;" onclick="$(\'#showInfo\').hide();$(\'#hideInfo, #Info\').show();">' . MODULE_SHIPPING_USPS_TEXT_INTL_SHOW . '</div>' .
    '<div id="hideInfo" class="ui-state-error" style="cursor:pointer; text-align:center; display:none;" onclick="$(\'#hideInfo, #Info\').hide();$(\'#showInfo\').show();">' . MODULE_SHIPPING_USPS_TEXT_INTL_HIDE .'</div>' .
    '<div id="Info" class="ui-state-highlight" style="display:none; padding:10px; max-height:200px; overflow:auto;">' . '<b>Prohibitions:</b><br>' . nl2br($uspsQuote['Package']['Prohibitions']) . '<br><br><b>Restrictions:</b><br>' . nl2br($uspsQuote['Package']['Restrictions']) . '<br><br><b>Observations:</b><br>' . nl2br($uspsQuote['Package']['Observations']) . '<br><br><b>CustomsForms:</b><br>' . nl2br($uspsQuote['Package']['CustomsForms']) . '<br><br><b>ExpressMail:</b><br>' . nl2br($uspsQuote['Package']['ExpressMail']) . '<br><br><b>AreasServed:</b><br>' . nl2br($uspsQuote['Package']['AreasServed']) . '<br><br><b>AdditionalRestrictions:</b><br>' . nl2br($uspsQuote['Package']['AdditionalRestrictions']) .'</div>' .
   '</div>';
  }
 if (isset($uspsQuote['Package']['Postage']) && tep_not_null($uspsQuote['Package']['Postage'])) $PackageSize = 1;
 else $PackageSize = ($order->delivery['country']['iso_code_2'] == 'US' ? sizeof($uspsQuote['Package']) : sizeof($uspsQuote['Package']['Service']));
 for ($i=0; $i<$PackageSize; $i++)
  {
  $Services = array();
  $hiddenServices = array();
  $hiddenCost = 0;
  $handling = 0;
  $types = explode(', ', MODULE_SHIPPING_USPS_TYPES);
  if (isset($uspsQuote['Package'][$i]['Error']) && tep_not_null($uspsQuote['Package'][$i]['Error'])) continue;
  $Package = ($PackageSize == 1 ? $uspsQuote['Package']['Postage'] : ($order->delivery['country']['iso_code_2'] == 'US' ? $uspsQuote['Package'][$i]['Postage'] : $uspsQuote['Package']['Service'][$i]));
  if ($order->delivery['country']['iso_code_2'] == 'US')
	 {
   if (tep_not_null($Package['SpecialServices']['SpecialService']))
 foreach ($Package['SpecialServices']['SpecialService'] as $key => $val)
  if (isset($dExtras[$val['ServiceName']]) && tep_not_null($dExtras[$val['ServiceName']]) && ((MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && $val['AvailableOnline'] == 'true') || (MODULE_SHIPPING_USPS_RATE_TYPE == 'Retail' && $val['Available'] == 'true')))
   {		
   $val['ServiceAdmin'] = $dExtras[$val['ServiceName']];
   $Services[] = $val;
   }
   $cost = MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && tep_not_null($Package['CommercialRate']) ? $Package['CommercialRate'] : $Package['Rate'];
   $type = ($Package['MailService']);
   }
  else
   {
   foreach ($Package['ExtraServices']['ExtraService'] as $key => $val)
 if (isset($iExtras[$val['ServiceName']]) && tep_not_null($iExtras[$val['ServiceName']]) && ((MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && $val['AvailableOnline'] == 'True') || (MODULE_SHIPPING_USPS_RATE_TYPE == 'Retail' && $val['Available'] == 'True')))
  {		
  $val['ServiceAdmin'] = $iExtras[$val['ServiceName']];
  $Services[] = $val;
  }
   $cost = MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' && tep_not_null($Package['CommercialPostage']) ? $Package['CommercialPostage'] : $Package['Postage'];
   $type = ($Package['SvcDescription']);
   }
  if ($cost == 0) continue;
  foreach ($types as $key => $val)
   if(!is_numeric($val) && $val == $type)
  {
  $minweight = $types[$key+1];
  $maxweight = $types[$key+2];
  $handling = $types[$key+3];
  }
  foreach ($Services as $key => $val)
   {
   $sDisplay = $Services[$key]['ServiceAdmin'];
   if ($sDisplay == 'Y') $hiddenServices[] = array($Services[$key]['ServiceName'] => (MODULE_SHIPPING_USPS_RATE_TYPE == 'Online' ? $Services[$key]['PriceOnline'] : $Services[$key]['Price']));
   }
  foreach($hiddenServices as $key => $val)
   foreach($hiddenServices[$key] as $key1 => $val1)
 $hiddenCost += $val1;
  if ((($method == '' && in_array($type, $types)) || $method == $type) && $shipping_weight < $maxweight && $shipping_weight > $minweight)
   $methods[] = array( 'id' => $type,
	 'title' => str_replace(array('RM', 'TM', '**'), array('®', '™', ''), $type),
	 'cost' => ($cost + $handling + $hiddenCost) * $shipping_num_boxes);
  }
 if (sizeof($methods) == 0) return false;
 if (sizeof($methods) > 1)
  {
  foreach($methods as $c=>$key)
   {
	  $sort_cost[] = $key['cost'];
	  $sort_id[] = $key['id'];
   }
  array_multisort($sort_cost, (MODULE_SHIPPING_USPS_RATE_SORTER == 'Ascending' ? SORT_ASC : SORT_DESC), $sort_id, SORT_ASC, $methods);
  }
 $this->quotes = array( 'id' => $this->code,
    'module' => $this->title . ' ' . $this->pounds . ' lbs, ' . $this->ounces . ' oz',
    'methods' => $methods,
    'tax' => $this->tax_class > 0 ? tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']) : null,
    'icon' => tep_not_null($this->icon) || tep_not_null($iInfo) ? (tep_not_null($this->icon) ? tep_image($this->icon, $this->title) : '') . (tep_not_null($iInfo) ?  '<br>' . $iInfo : '') : null);
 return $this->quotes;
 }
   function _getQuote()
 {
 global $order, $shipping_weight;
 if ($order->delivery['country']['iso_code_2'] == 'US')
  {
  $ZipDestination = substr(str_replace(' ', '', $order->delivery['postcode']), 0, 5);
  $request = '<RateV4Request USERID="' . MODULE_SHIPPING_USPS_USERID . '">' .
  '<Revision>2</Revision>';
  $package_count = 0;
  foreach(explode(', ', MODULE_SHIPPING_USPS_TYPES) as $request_type)
   {
   if(is_numeric($request_type) || preg_match('#International#' , $request_type)) continue;
   $FirstClassMailType = '';
   $Container = 'VARIABLE';
   if (preg_match('#First\-Class#', $request_type))
 {
 if ($shipping_weight > 13/16) continue;
 else
  {
  $service = 'First-Class Mail';
  if ($request_type == 'First-Class MailRM Letter') $FirstClassMailType = 'LETTER';
  elseif ($request_type == 'First-Class MailRM Large Envelope') $FirstClassMailType = 'FLAT';
  else $FirstClassMailType = 'PARCEL';
  }
 }
   elseif ($request_type == 'Media MailRM') $service = 'MEDIA';
// In the following line, changed Parcel to Standard due to USPS service name change - 01/27/13 a.forever edit
   elseif ($request_type == 'Standard PostRM') $service = 'PARCEL';
   elseif (preg_match('#Priority MailRM#', $request_type))
 {
 $service = 'PRIORITY COMMERCIAL';
 if ($request_type == 'Priority MailRM Flat Rate Envelope') $Container = 'FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority MailRM Legal Flat Rate Envelope') $Container = 'LEGAL FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority MailRM Padded Flat Rate Envelope') $Container = 'PADDED FLAT RATE ENVELOPE';
 elseif ($request_type == 'Priority MailRM Small Flat Rate Box') $Container = 'SM FLAT RATE BOX';
 elseif ($request_type == 'Priority MailRM Medium Flat Rate Box') $Container = 'MD FLAT RATE BOX';
 elseif ($request_type == 'Priority MailRM Large Flat Rate Box') $Container = 'LG FLAT RATE BOX';
 elseif ($request_type == 'Priority MailRM Regional Rate Box A') $Container = 'REGIONALRATEBOXA';
 elseif ($request_type == 'Priority MailRM Regional Rate Box B') $Container = 'REGIONALRATEBOXB';
 elseif ($request_type == 'Priority MailRM Regional Rate Box C') $Container = 'REGIONALRATEBOXC';
 }
   elseif (preg_match('#Express MailRM#', $request_type))
 {
 $service = 'EXPRESS COMMERCIAL';
 if ($request_type == 'Express MailRM Flat Rate Envelope') $Container = 'FLAT RATE ENVELOPE';
 elseif ($request_type == 'Express MailRM Legal Flat Rate Envelope') $Container = 'LEGAL FLAT RATE ENVELOPE';
 elseif ($request_type == 'Express MailRM Flat Rate Boxes') $Container = 'FLAT RATE BOX';
 }
   else continue;
   $request .= '<Package ID="' . $package_count . '">' .
   '<Service>' . $service . '</Service>' .
   ($FirstClassMailType != '' ? '<FirstClassMailType>' . $FirstClassMailType . '</FirstClassMailType>' : '') .
   '<ZipOrigination>' . SHIPPING_ORIGIN_ZIP . '</ZipOrigination>' .
   '<ZipDestination>' . $ZipDestination . '</ZipDestination>' .
   '<Pounds>' . $this->pounds . '</Pounds>' .
   '<Ounces>' . $this->ounces . '</Ounces>' .
   '<Container>' . $Container . '</Container>' .
   '<Size>REGULAR</Size>' .
   '<Machinable>TRUE</Machinable>' .
   '</Package>';
   $package_count++;
   }
  $request .= '</RateV4Request>';
  $request =  'API=RateV4&XML=' . urlencode($request);
  }
 else
  {
  $request =  '<IntlRateV2Request USERID="' . MODULE_SHIPPING_USPS_USERID . '">' .
  '<Revision>2</Revision>' .
  '<Package ID="0">' .
  '<Pounds>' . $this->pounds . '</Pounds>' .
  '<Ounces>' . $this->ounces . '</Ounces>' .
  '<MailType>All</MailType>' .
  '<GXG>' .
   '<POBoxFlag>N</POBoxFlag>' .
   '<GiftFlag>N</GiftFlag>' .
  '</GXG>' .
  '<ValueOfContents>' . ($order->info['subtotal'] + $order->info['tax']) . '</ValueOfContents>' .
  '<Country>' . tep_get_country_name($order->delivery['country']['id']) . '</Country>' .
  '<Container>RECTANGULAR</Container>' .
  '<Size>LARGE</Size>' .
  '<Width>2</Width>' .
  '<Length>10</Length>' .
  '<Height>6</Height>' .
  '<Girth>0</Girth>' .
  '<OriginZip>' . SHIPPING_ORIGIN_ZIP . '</OriginZip>' .
// In the following line, changed N to Y to activate optional commercial base pricing for international services - 01/27/13 a.forever edit
  '<CommercialFlag>Y</CommercialFlag>' .
  '<ExtraServices>' .
	   '<ExtraService>0</ExtraService>' .
	   '<ExtraService>1</ExtraService>' .
	   '<ExtraService>2</ExtraService>' .
	   '<ExtraService>3</ExtraService>' .
	   '<ExtraService>5</ExtraService>' .
	   '<ExtraService>6</ExtraService>' .
  '</ExtraServices>' .
  '</Package>' .
  '</IntlRateV2Request>';
  $request =  'API=IntlRateV2&XML=' . urlencode($request);
  }
 $body = '';
 $http = new httpClient();
 if ($http->Connect('production.shippingapis.com', 80))
  {
  $http->addHeader('Host', 'production.shippingapis.com');
  $http->addHeader('User-Agent', 'osCommerce');
  $http->addHeader('Connection', 'Close');
  if ($http->Get('/shippingapi.dll?' . $request)) $body = preg_replace(array('/\<sup\>\&reg;\<\/sup\>/', '/\<sup\>\&trade;\<\/sup\>/', '/\" /', '/\",/', '/\"<br>/', '/<br>/'), array('RM', 'TM', '",', '" ', '"<br>', 'BREAK'), htmlspecialchars_decode($http->getBody()));
//   mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $body);
  $http->Disconnect();
  return json_decode(json_encode(simplexml_load_string($body)),TRUE);
  }
 else return false;
 }
   function install()
 {
 tep_db_query("ALTER TABLE `configuration` CHANGE `configuration_value` `configuration_value` TEXT NOT NULL, CHANGE `set_function` `set_function` TEXT NULL DEFAULT NULL");
 tep_db_query("update " . TABLE_CONFIGURATION . " SET configuration_value =  'true' where configuration_key = 'EMAIL_USE_HTML'");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable USPS Shipping', 'MODULE_SHIPPING_USPS_STATUS', 'True', 'Do you want to offer USPS shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enter the USPS User ID', 'MODULE_SHIPPING_USPS_USERID', 'NONE', 'Enter the USPS USERID assigned to you.', '6', '0', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_USPS_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_USPS_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_USPS_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Methods (Domestic and International)',  'MODULE_SHIPPING_USPS_TYPES',  '0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00, 0, 70, 0.00', '<b><u>Checkbox:</u></b> Select the services to be offered<br><b><u>Minimum Weight (lbs)</u></b>first input field<br><b><u>Maximum Weight (lbs):</u></b>second input field<br><br>USPS returns methods based on cart weights.  These settings will allow further control (particularly helpful for flat rate methods) but will not override USPS limits', '6', '0', 'tep_cfg_usps_services(array(\'First-Class MailRM Letter\', \'First-Class MailRM Large Envelope\', \'First-Class MailRM Parcel\', \'Media MailRM\', \'Standard PostRM\', \'Priority MailRM\', \'Priority MailRM Flat Rate Envelope\', \'Priority MailRM Legal Flat Rate Envelope\', \'Priority MailRM Padded Flat Rate Envelope\', \'Priority MailRM Small Flat Rate Box\', \'Priority MailRM Medium Flat Rate Box\', \'Priority MailRM Large Flat Rate Box\', \'Priority MailRM Regional Rate Box A\', \'Priority MailRM Regional Rate Box B\', \'Priority MailRM Regional Rate Box C\', \'Express MailRM\', \'Express MailRM Flat Rate Envelope\', \'Express MailRM Legal Flat Rate Envelope\', \'Express MailRM Flat Rate Boxes\', \'First-Class MailRM International Letter**\', \'First-Class MailRM International Large Envelope**\', \'First-Class Package International ServiceTM**\', \'Priority MailRM International\', \'Priority MailRM International Flat Rate Envelope**\', \'Priority MailRM International Small Flat Rate Box**\', \'Priority MailRM International Medium Flat Rate Box\', \'Priority MailRM International Large Flat Rate Box\', \'Express MailRM International\', \'Express MailRM International Flat Rate Envelope\', \'Express MailRM International Flat Rate Boxes\', \'USPS GXGTM Envelopes**\', \'Global Express GuaranteedRM (GXG)**\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Extra Services (Domestic)', 'MODULE_SHIPPING_USPS_DMST_SERVICES', 'Certified MailRM, N, Insurance, N, Adult Signature Restricted Delivery, N, Registered without Insurance, N, Registered MailTM, N, Collect on Delivery, N, Return Receipt for Merchandise, N, Return Receipt, N, Certificate of Mailing, N, Express Mail Insurance, N, Delivery ConfirmationTM, N, Signature ConfirmationTM, N', 'Included in postage rates.  Not shown to the customer.', '6', '0', 'tep_cfg_usps_extraservices(array(\'Certified MailRM\', \'Insurance\', \'Adult Signature Restricted Delivery\', \'Registered without Insurance\', \'Registered MailTM\', \'Collect on Delivery\', \'Return Receipt for Merchandise\', \'Return Receipt\', \'Certificate of Mailing\', \'Express Mail Insurance\', \'Delivery ConfirmationTM\', \'Signature ConfirmationTM\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Extra Services (International)', 'MODULE_SHIPPING_USPS_INTL_SERVICES', 'Registered Mail, N, Insurance, N, Return Receipt, N, Restricted Delivery, N, Pick-Up, N, Certificate of Mailing, N', 'Included in postage rates.  Not shown to the customer.', '6', '0', 'tep_cfg_usps_extraservices(array(\'Registered Mail\', \'Insurance\', \'Return Receipt\', \'Restricted Delivery\', \'Pick-Up\', \'Certificate of Mailing\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Retail pricing or Online pricing?', 'MODULE_SHIPPING_USPS_RATE_TYPE', 'Online', 'Rates will be returned ONLY for methods available in this pricing type.  Applies to prices <u>and</u> add on services', '6', '0', 'tep_cfg_select_option(array(\'Retail\', \'Online\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Rates Sort Order:', 'MODULE_SHIPPING_USPS_RATE_SORTER', 'Ascending', 'Ascending: Low to High<br>Descending: High to Low', '6', '0', 'tep_cfg_select_option(array(\'Ascending\', \'Descending\'), ', now())");
 }
   function keys()
 {
 return array('MODULE_SHIPPING_USPS_STATUS', 'MODULE_SHIPPING_USPS_USERID', 'MODULE_SHIPPING_USPS_TAX_CLASS', 'MODULE_SHIPPING_USPS_ZONE', 'MODULE_SHIPPING_USPS_SORT_ORDER', 'MODULE_SHIPPING_USPS_TYPES', 'MODULE_SHIPPING_USPS_DMST_SERVICES', 'MODULE_SHIPPING_USPS_INTL_SERVICES', 'MODULE_SHIPPING_USPS_RATE_TYPE', 'MODULE_SHIPPING_USPS_RATE_SORTER');
 }
function remove()
 {
 tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 }
function check()
 {
 if (!isset($this->_check))
  {
  $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_USPS_STATUS'");
  $this->_check = tep_db_num_rows($check_query);
  }
 return $this->_check;
 }
}
?>

Link to comment
Share on other sites

Unfortunately this forum deletes empty lines, so I still don't know where line 95 is. You'll have to find it for me.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Sorry, that was before I came into this discussion. That code should still work. Since it's not working, I can only try an experiment. Find the three lines just above line 95:

 

}
else
{

 

and replace with this:

 

}
elseif( isset( $Package['ExtraServices']['ExtraService'] ) )
{

 

That's based on a bunch of guesswork, so please post whether this works or not.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

is the USPS version here for flatrate working with 2.3.3?? or should I not bother? I was interested in this as 99% of all our items in the store will be able to be shipped in a USPS Flat rate box

 

but from what I am seeing here its not working well with 2.3.3 I have no other shipping modules installed right now so looking for some assistance if possible

 

Thanks

Link to comment
Share on other sites

Don't bother with this module if you're only going to ship flat rate. Just set up the Flat shipping module with the shipping cost. You'll have to update the cost yourself when the rates change, but your shipping page will load a lot faster.

 

This gets a lot more complicated if you want to have different shipping costs for certain products. You'll need to install MVS and different modules for each class of products. This is a lot of work to set up, so think carefully before you decide to do this.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I installed the modules and I got this issue, can someone help me.

I set the price for priority is $8.00 but in the checkout page it displays the server pricing and in two different columns. Anyone got this issue?

post-321892-0-78490500-1371760102_thumb.png

Link to comment
Share on other sites

  • 4 weeks later...

Hello I have installed the usps module on 2.3.3 and is working very well - I then install the Free shipping by item by Jetta and it also works very well.

 

I have one small issue that involves the USPS module in that when in item is checked for free shipping and weight of the item falls between the min and max weight set in the admin for a USPS service, the USPS shipping pic displays in the check out screen next to the FREE shipping text.

 

I have attached a pic for clarification for the issue

 

Can anyone point me to where I would look for a solution for this?

 

 

Thanks!

post-320710-0-66903500-1373675119_thumb.png

Link to comment
Share on other sites

Anyone working on the 28 July name changes?

 

 

Express Mail will be renamed to “Priority Mail Express.”

 

“1 DAY” or “2 DAY” will now be printed on the Priority Mail Express shipping labels.

 

Express Mail International will be renamed to “Priority Mail Express International,” and Express Mail Corporate Accounts will be renamed to “USPS Corporate Accounts.”

 

Priority Mail:

 

Priority Mail labels will now include estimated delivery time (1 DAY, 2 DAY or 3 DAY)

 

The appropriate timeframe will be calculated automatically. Shippers cannot choose between these three options.

 

Priority Mail remains a non-guaranteed service. The Postal Service does not provide a money-back guarantee if items sent via Priority Mail fail to arrive by the scheduled delivery date.

 

Priority Mail shipments will include USPS insurance coverage of $50 or $100 depending on your pricing level with the postal service. Please see the end of this document for additional information about USPS insurance and alternative insurance through ShipWorks.

 

International Shipments:

 

Electronic Delivery Confirmation will now be available in several more countries, in addition to Canada. Countries eligible for this service are: Australia, Belgium, Brazil, Croatia, Denmark, France, Germany, Great Britain, Israel, Netherlands, New Zealand, Spain, and Switzerland.

 

Carrier Route Code:

 

Domestic 4x6 shipping labels will now include a new Carrier Route Code. This 4-digit code will appear on the right of the return address and immediately to the left of the current Retail Distribution Code.

Edited by FlyingKites
Link to comment
Share on other sites

USPS has contacted all Web Tools customers to advise that the testing platform is available.

USPS will release updates to the Web Tools APIs on 28 July 2013. The staging environment is currently open for testing your updated applications. the July release notes are here https://www.usps.com/business/web-tools-apis/welcome.htm

Link to comment
Share on other sites

All,

 

What is the procedure to allow multiple items to be purchased? Specifically, a store (v2.3.3) set up with this shipping module works fine so long as only one item is purchased. When a customer selects more than one item, no shipping options show up in checkout, they only appear for single item purchases.

 

Any thoughts?

 

Many thanks!

 

Sincerely,

 

DesertCoder

Link to comment
Share on other sites

That is not correct. You can add any number of items to your cart and get a quote from USPS. So your problem point to another issue e.g services chosen and/or weight of the order.

 

Kym,

 

Thasnk you for the response. I'm using the 'Resteict Methods' add on for this module which works great, though to get multiple item shipping quotes, I ended up unchecking all of the restricted methods and now all is well.

 

Thank you for your help!

 

Cheers,

 

DesertCoder

Link to comment
Share on other sites

usps.phpAttached is a patched version of USPS Methods 5.2.1 to handle the 28 July 2013 name changes. You need to uninstall the old module then load this one and install. Don't forget to keep note of your settings including USPS userid. Edited by FlyingKites
Link to comment
Share on other sites

Kym, do you know if this will work with the older osc versions? I actually am running oscMax 2.0.25 .. I never upgraded my usps module the last round of changes and everything has been working just fine.. your version is oh so different than the one I'm running after doing a compare of the file making me VERY nervous!

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

USPS changed the staging platform since my last comment. Attached is new version of the USPS Methods 5.2.1 which works as at today. This module should with MS 2.2 and 2.3.

 

If you are using another version of USPS and/or USPS Methods 6.x then you could use this for reference in terms of the service name changes.

 

usps.php

Edited by FlyingKites
Link to comment
Share on other sites

The staging platform is returning some extraneous characters in service names which were causing the module to fail once the effected service was selected so we've had to make an update to the USPS Methods 5.2.1 to strip them out. We noticed that transit times are displaying as 'x" days instead of EDD. And they don't look too accurate. usps.php

Link to comment
Share on other sites

Just want to summarize the changes we have noted to date:

 

In addition to Express Mail changing to Priority Mail Express, we believe that other service names have switched from using the ® to symbol despite the release notes indicating they remain unchanged.

 

As per the release notes, Priority Mail now returns {0} the number of days to deliver for domestic services. This makes the Display Transit time for domestic services redundant for the most part. If you are using this transit feature in any USPS version you will need to review that code.

 

As noted above there are extraneous characters in the Priority Express Mail service name which for some sites might cause issues if the service is used. It appears to be related solely to Priority Mail Express 1 Day delivery and may be a quirk of the staging platform.

 

 

Link to comment
Share on other sites

This is going to be a real mess to convert for the MVS users. I am trying to work on a version but the code is so much different from the last rendition. Any suggestions would be much appreciated.

Link to comment
Share on other sites

Matt - can you please define "MVS users" I don't run osC but I do run the older osCmax, in which I am using USPS Rate V4 Intl Rate V2

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Sorry, MVS is Multiple Vendor Shipping its a addon for stores that dropship directly from the supplier or from other locations other than the main store address.

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