[ic] ups_cache expires

Steve Graham icdev at mrlock.com
Fri Feb 3 11:06:09 EST 2006


>
>Patches are always welcome! 8-)
>
> >
> > I know this is not really an issue on 1 day cache expire, but with
> > expire set to 30+ days - it will add up.
>
>It also cuts down unnecessary traffic. +1.
>
>--
>Mike Heins


Hello,

Here is what I did to make the cache_table only store & search the 
1st 3 digits of the zip code.
I am editing QueryUPS.pm - not really sure which file I should edit 
(ups_query.tag or QueryUPS.pm), but this works.


add new variable $zip5
 >>
sub calculate {
         my ($mode, $weight, $row, $opt, $tagopt, $extra) = @_;

+my $zip5;
<<

add/change following lines:
 >>
    # In the U.S., UPS only wants the 5-digit base ZIP code, not ZIP+4
         $country eq 'US' and $zip =~ /^(\d{5})/ and $zip = $1;
+        $zip5 = $zip;
+       $country eq 'US' and $zip =~ /^(\d{3})/ and $zip = $1;
<<

any calls to getUPS(... need the $zip5 variable
 >>>
         ($maxcost, $zone, $error)
                                 = getUPS( $opt->{service}, $origin, 
$zip5, $modulo, $country);
                         if($error) {
                                 do_error(       "Ship mode %s: Error 
calling UPS service %s",
                                                         $mode,
                                                         $opt->{service}, );
                                 return 0;
                         }
                         $shipping += $maxcost;
                 }

                 undef $error;
::logDebug("calling getUPS( $opt->{service}, $origin, $zip5, $w, $country)");
                 ($tmpcost, $zone, $error)
                         = getUPS( $opt->{service}, $origin, $zip5, 
$w, $country);

<<<

any comments appreciate

Thanks,
Steve Graham





More information about the interchange-users mailing list