[ic] Tracking numbers in 4.9.7 UPS and Fedex question

Nick Hall interchange-users@icdevgroup.org
Thu Jan 23 16:49:00 2003


At 02:03 PM 1/23/2003, you wrote:
>It nice now their is an actual section to input tracking numbers. My 
>company ships UPS and Fedex. The problem is in the demo when you put in a 
>tracking number it defaults to a UPS link. Is their a way to code the 
>admin or the check_orders page to either put in UPS numbers or fedex 
>numbers and link it to the right UPS or Fedex tracking info page.
>
>I would imagine it could be something in this code in check_orders
>
>  if($tracking) {
>Debug("found tracking $tracking");
>                         my @ids = grep /\S/, split /\s+/, $tracking;
>                         my $tpl = $Variable->{TRACKING_NUMBER_QUERY} || 
> <<EOF;
><A 
>HREF="http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1={TRACKING_NUMBER}&TypeOfInquiryNumber=T">UPS 
>{TRACKING_NUMBER}</A>
>EOF
>
>                         for(@ids) {
>Debug("found id $_");
>                                 my $val = $tpl;
>                                 $val =~ s/{TRACKING_NUMBER}/$_/g;
>                                 $hash{status} .= $val;


All of our company's Fedex tracking numbers start with 155 (and UPS obviously
doesn't). I'm not sure if that is a standard prefix for Fedex Ground, since
we only ship ground, or if that is just a company specific prefix. Maybe
someone that ships a lot with Fedex will know? I've put the relevant section
of code that we're using which creates a tracking link automatically
whether or not it is a UPS or Fedex number below. We are currently using it
in a 4.8.6 catalog and I see from the CVS log that Mike modified the
check_orders.html page in revision 2.1 to work a little differently but
the same method should be easily adaptable (it looks like the status field
in the hash has been replaced by tracking):


if($hash{status} =~ /\d/) {
         my @ids = grep /\S/, split /\s+/, $hash{status};
         $hash{status} = '';
         for(@ids) {
                 if ($_ =~ /^155/) {  # Check if FED EX number (starts with 
155)
                         $hash{status} .= <<EOF;
<A 
HREF="http://www.fedex.com/cgi-bin/tracking?tracknumbers=$_&action=track">FED 
EX $_</A>
EOF
                 }
                 else  {  # UPS number or other
                         $hash{status} .= <<EOF;
<A 
HREF="http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=$_&TypeOfInquiryNumber=T">UPS 
$_</A>
EOF
                 }
         }
}
else {
         $hash{status} = <<EOF;
<A HREF="$hash{detail_url}">$hash{status}</A>
EOF
}


Hope this helps,

Nick Hall
SellToThem.com E-Commerce Solutions
http://www.selltothem.com