Akopia Akopia Services

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

Re: [mv] UPS lookup on each item



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

COOL!

Even comes with an optional gouping feature.

Thank You Mike !

KC

At 12:50 AM 1/31/00 -0500, you wrote:
>******    message to minivend-users from Mike Heins <mike@minivend.com>     
>
>Dear Kyle,
>
>
>Better would be a global usertag -- the one appended is an actual
>operational tag and is fully tested. It is called with:
>
>ups_each	Separate item UPS Ground	quantity	1	20	f [ups-each Ground]
>ups_each	Separate item UPS Blue`	quantity	1	20	f [ups-each 2ndDayAir]
>
>The defaults should work with any checkout resembling the MV demo.
>You can change the zip and zone with zip="[value postcode]" and
>zone="[value upszone]" if necessary -- check the docs.
>
>You can put an adder in by appending a number (or other MV tags)
>to the cost field.
>
>Thanks for all of *your* help to users on this list....
>
>Best,
>
>Mike Heins
>
>UserTag ups-each Order  mode
>UserTag ups-each PosNumber 1
>UserTag ups-each AddAttr
>UserTag ups-each Routine <<EOR
>sub {
>    my($mode, $opt) = @_;
>    $mode = 'Ground' unless $mode;
>    $opt->{'zip'}    = $::Values->{zip} unless $opt->{zip};
>    $opt->{'zone'}   = 'u'              unless $opt->{zone};
>    my $table        = $opt->{'table'}      || 'products';
>    my $weight_field = $opt->{weight_field} || 'weight';
>    my $group_field  = $opt->{group}        || undef;
> 
>    $opt->{zip} =~ s/\W//g;
>    if($opt->{zip} !~ /^\d\d\d/) {
>        $Vend::Session->{ship_message} .=
>                "Can't do UPS without a zip code.\n";
>        return;
>    }
>    my $cart = $Vend::Items;
>    my @queue;
>    my %queue;
>    my $item;
>    my ($group, $weight);
>
>    foreach $item (@$cart) {
>        $group = defined $group_field
>                ? Vend::Interpolate::tag_data($table, $group_field, 
>$item->{code})
>                : '';
>        $weight = Vend::Interpolate::tag_data(
>                        $table, $weight_field, $item->{code}
>                        );
>        unless ($weight > 0) {
>            $Vend::Session->{ship_diagnostic} .=
>                    "Item $item->{code} had no weight.\n";
>            next;   
>        }
>        my (@subqueue) = ();
>        my $i;
>        for ($i = 1; $i <= $item->{'quantity'}; $i++) {
>            push(@subqueue, $weight);
>        }
>        unless ($group) {
>            push(@queue, @subqueue);
>            next;
>        }
>        else {
>            $queue{$group} += $weight * $item->{'quantity'};
>        }
>    }
>    for(keys %queue) {
>        push(@queue, $queue{$_});
>    }
>    my $cost = 0;
>    for(@queue) {
>        $cost += Vend::Interpolate::tag_ups(
>                            $mode,
>                            $opt->{zip},
>                            $_,
>                            $opt->{zone},
>                        );
>    }
>    return $cost;
>}
>EOR
>-
>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

-
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: