[ic] many warehouses shipping

Kevin Walsh interchange-users@interchange.redhat.com
Tue Apr 16 12:55:01 2002


> 
> I have a usertag that is global:
> 
> ########################################################
> UserTag  ups-query  Order  mode origin zip weight country
> UserTag  ship  Routine <<EOR
> sub {
>         my( $mode, $zip, $weight, $country) = @_;
>         $country        = $::Values->{$::Variable->{UPS_COUNTRY_FIELD}}  if
> ! $country;
>         $zip            = $::Values->{$::Variable->{UPS_POSTCODE_FIELD}} if
> ! $zip;
>         $country = uc $country;
> 
>         my $shipping = 0;
>         my %origins;
>         $origins{$_->{origin}} = $_->{weight} for (@{$Carts->{main}});
> 
>         foreach (keys %origins){
>            $shipping += $Tag->ups_query({
>                mode => $_,
>                origin => $origin,
>                zip => $zip,
>                country => $country,
>                weight => $origins{$_},
>            });
>        }
> 
>         return $shipping;
> }
> EOR
> #############################
> 
> I have origin as a hiden field in the buy now forms. I pull this data from
> an added column of the products table.
> 
> 
> I call the user tag from my shipping.asc file.
> 
> ...
> 1DA     UPS Next Day Air        weight  0       150     f [ship zip="[value
> zip]" mode="1DA" weight="@@TOTAL@@"]
> ...
> 
> 
> But when I check out I get:
> 
>   Shipping mode '1DA': bad formula. Returning 0.No match found for mode
> '1DA', quantity '1',
>   returning 0.
> 
> If I change the formula to a ups-query tag it works fine, so I believe the
> problem is with my tag of with the way I call it.
> 
The problem is clearly with the usertag.

You are doing this:

    UserTag  ups-query  Order  mode origin zip weight country
    UserTag  ship  Routine <<EOR

Have you tried using the same tag name on both of those lines?

Also, since your tag is designed to work out the weights for itself,
why is it necessary for you to pass in a 'weight' parameter?
If you set the UPS_POSTCODE_FIELD variable, you can avoid having to
pass the zip parameter as well.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/