Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Canada Post Expedited US Business change name


greasemonkey

Recommended Posts

Hi everyone, I'm so not a coder... but I'm trying to change the name returned by the Canada Post shipping module for Expedited US Business and Small Package Air services

 

I've tried multiple versions of

 

}else
   if ($product=='Expedited US Business')
{
$strProduct=('USPS Priority Mail');
}
else if($product=='Small Packets Air')
{
$strProduct=('Small Parcel');

 

 

But it would seem my syntax is wrong of I don't know where to put it... Any help would be apprciated... below is the code in question from canadapost.php

 

 

$strProduct = substr($resultXML, strpos($resultXML, "<product id=")+strlen("<product id=>"), strpos($resultXML, "</product>")-strlen("<product id=>")-strpos($resultXML, "<product id="));
  $index = 0;
  $aryProducts = false;
  while (strpos($resultXML, "</product>")) {
   $name = substr($resultXML, strpos($resultXML, "<name>")+strlen("<name>"), strpos($resultXML, "</name>")-strlen("<name>")-strpos($resultXML, "<name>"));
   $rate = substr($resultXML, strpos($resultXML, "<rate>")+strlen("<rate>"), strpos($resultXML, "</rate>")-strlen("<rate>")-strpos($resultXML, "<rate>"));
   //$shippingDate = substr($resultXML, strpos($resultXML, "<shippingDate>")+strlen("<shippingDate>"), strpos($resultXML, "</shippingDate>")-strlen("<shippingDate>")-strpos($resultXML, "<shippingDate>"));
//SB edit US delivery estimates
   if ($name=='Small Packets Air')
{
$deliveryDate=('5 to 10 Business Days. Tracking number NOT available.');
}
else if($name=='Parcel Surface')
{
$deliveryDate=('4 to 12 Weeks');
}
else
{
$deliveryDate = substr($resultXML, strpos($resultXML, "<deliveryDate>")+strlen("<deliveryDate>"), strpos($resultXML, "</deliveryDate>")-strlen("<deliveryDate>")-strpos($resultXML, "<deliveryDate>"));
}
			//$deliveryDayOfWeek = substr($resultXML, strpos($resultXML, "<deliveryDayOfWeek>")+strlen("<deliveryDayOfWeek>"), strpos($resultXML, "</deliveryDayOfWeek>")-strlen("<deliveryDayOfWeek>")-strpos($resultXML, "<deliveryDayOfWeek>"));
   //$nextDayAM = substr($resultXML, strpos($resultXML, "<nextDayAM>")+strlen("<nextDayAM>"), strpos($resultXML, "</nextDayAM>")-strlen("<nextDayAM>")-strpos($resultXML, "<nextDayAM>"));
   //$packingID = substr($resultXML, strpos($resultXML, "<packingID>")+strlen("<packingID>"), strpos($resultXML, "</packingID>")-strlen("<packingID>")-strpos($resultXML, "<packingID>"));
   list($year, $month, $day) = split("-", $deliveryDate);
if (!tep_not_null($day)) {
 $deliveryDate = $year;
} else {
	$deliveryDate = date('F d, Y', mktime(0, 0, 0, $month, $day, $year));
}
   $aryProducts[$index] = array($name . ", <acronym title='Estimated Delivery Date'>EDD</acronym>: " . $deliveryDate => $rate);
   $index++;
   $resultXML = substr($resultXML, strpos($resultXML, "</product>") + strlen("</product>"));
  }
  return $aryProducts;
 } else {
  if (strpos($resultXML, "<error>")) return $statusMessage;
  else return false;
 }
}
 }

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