Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] UPS lookup on each item



******    message to minivend-users from "kyle@invisio.com" <kyle@invisio.com>     ******

Hey all,

I need to loop over every item ordered and do a ups
lookup for each one to get a total shipping cost.

I know this has come up before and I have had a little
time to go over the archives, faqs and docs. I have
just slapped this together and have not tested it yet.
I would appreciate any feedback before I build a new
site to test this out (the current site I want to use it
in is too busy to experiment on).

I believe my perl is sound, but am still a little unclear on
passing the info to the sub.

Any comments are welcome.

Thanks
Kyle (KC)

# in shipping.asc

ups_each	Shipping	weight	1	9999	s ups_calc weight,quantity, ;Ground
error	Contact us	weight	0	150	e No UPS shipping available.


# in catalog.cfg
   
Sub <<EOF
sub ups_calc {
	@basket = @_;
	my $mode = $basket[1];
	my $zip = $Safe{'values'}->{zip};
 
	foreach my $i (keys %{ $basket[0] }) {
		my $ups_cost = Vend::Interpolate::tag_ups($mode, $zip,
$basket[0]{$i}{'weight'});
		$ups_cost *= $basket[0]{$i}{'quantity'};
		if ($ups_cost < .01) {my $error = "error"}
		$total_cost += $ups_cost;
	}

	if ($error == "error") {return '>error';}
	else {return $total_cost;}
}
EOF

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: