[ic] Modified Shipping
Miguel Navarro
interchange-users@icdevgroup.org
Mon Jun 30 23:02:00 2003
Hi all
I am trying to alter shiping by a category field I created in the products
table. From the archives I believed that this UserTag would work but it is
not.. Can someone point out what I am doing wrong?
Thanks in advance
UserTag smallbiz_ship Routine <<EOR
sub {
my $total = 0;
my $n = 0;
my $item_quant = 0;
my $total_item_quant = 0;
my $ship_charge=0;
my $add_ship_charge=0;
my $ship_cat = "";
my $sku = "";
for my $item (@$Items) {
$sku = $item->{sku}; # also tried $item->{code};
$item_quant = $item->{quantity};
$total_item_quant += $item_quant;
$ship_cat = $Tag->query( { sql => "select ship_cat from
product
s where sku='$sku'", wantarray => 1 } );
$ship_cat = $ship_cat->[0]->[0];
if ($ship_cat eq '2') {
$ship_charge ="8.95";
$add_ship_charge= "2.95";
}
if ($n eq "0") {
$total = $ship_charge;
if ($item_quant > 1) {
$item_quant = $item_quant - 1;
$total += $item_quant*2;
}
} else {
$total += $item_quant*2;
}
$total = $ship_cat;
}
return $total;
}
EOR