[ic] many warehouses shipping

Rick Eicher II interchange-users@interchange.redhat.com
Thu Apr 18 10:02:01 2002


I need it to read the weights from the cart and "group" them by origin. But
the line that is suppose to do this does not work. I was fortunite enoght to
be given this code, which is good. the bad part is I have understand most of
my usertag except for this one line of code in question. I have two added
hidden fields in my cart one for origin the other for weight.

Does anyone know how to do this?

Again here is my user tag that does not work.
#################################################################
UserTag  ship  Order  mode zip country
UserTag  ship  Routine <<EOR
sub {
        my($mode, $zip, $country) = @_;
        $country        = $::Values->{$::Variable->{UPS_COUNTRY_FIELD}}  if
! $country;
        $zip            = $::Values->{$::Variable->{UPS_POSTCODE_FIELD}} if
! $zip;
        $country = uc $country;

        my $shipping = 0;
        my %weight;
        $weight{$_->{origin}} = $_->{weight} for (@{$Carts->{main}}); ##Code
line in question

        foreach (keys %weight){
              $shipping += $Tag->ups_query({
               mode => $mode,
               origin => $_,
               zip => $zip,
               country => $country,
               weight => $weight{$_},
           });
       }

        return $shipping;
}
EOR
##############################################

Thanks for all who have helped,
Rick Eicher II