[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] minivend and sql, it is not true
Quoting mike@minivend.com (mike@minivend.com):
>
> Quoting Raj Goel (frostbit@brainlink.com):
> > Only the shipping monstrosities & locale remain as gdbm tables. And
> > I expect to rectify that when MV 4.0 comes out.
>
> I resemble that remark!
>
> But seriously, I have posted multiple times requests for someone to come
> up with a coherent framework that bests MiniVend's shipping. No one has
> come up with anything close, nor have I seen anything anywhere else that
> comes close.
OK, so it is a monstrosity, or used to be. Since no one came up with any
suggestions that I could live with, I decided to take a close look at
it. I redid virtually everything but maintain almost complete backwards
compatibility. The only thing that goes away is the incredibly ridiculous
subroutine interface.
Now this:
upsg UPS Ground weight 0 0 e Nothing to ship!
upsg UPS Ground weight 0 150 u Ground [default zip 98366] 3.00 min5.00
upsg UPS Ground weight 150 999999 e @@TOTAL@@ lbs too heavy for UPS
is the same as:
upsg: UPS Ground
criteria weight
min 0
max 0
type error
message Nothing to ship!
min 0
max 150
type ups
table 2ndDayAir
geo zip
default_geo 98366
adder 3
at_least 5.00
min 150
max 999999
type error
message @@TOTAL@@ lbs too heavy for UPS
You can also do things like:
upsg: UPS Ground
perl 1
criteria <<EOF
my $crit = 0;
$Tmp->{heavy_items} = $Tmp->{bulky_items} = 0;
foreach $item (@{$Carts->{main}}) {
$crit += $Tag->data('products', 'weight', $item->{code});
$Tmp->{heavy_items}++ if $item->{heavy};
$Tmp->{bulky_items}++ if $item->{bulky};
}
$Shipping->[OPT]->{additional} .= ' heavy ';
if $Tmp->{heavy_items};
$Shipping->[OPT]->{additional} .= ' bulky ';
if $Tmp->{bulky_items};
return $crit;
EOF
heavy: Surcharge for heavy items
perl 1
criteria $Tmp->{heavy_items}
min 1
max 10
type x
multiplier 20
heavy: Surcharge for heavy items
# This returns 1 if there are bulky items
criteria $Tmp->{bulky_items} > 0;
perl 1
min 1
max 10
type f
formula <<EOF
foreach $item (@{$Carts->{main}}) {
next unless $item->{bulky};
$inches += $Tag->data('products', 'dimension', $item->{code});
etc();
etc();
}
return $total_charge;
EOF
You get the idea.
There are multiple other things you can do with the new setup.
1. Add shipping modes on the fly
2. Select shipping with a database query
3. Build in-line subroutines to determine criteria
4. Build shipping labels automatically, ignoring modes
that show up at zero cost
5. Add UPS origin zones on the fly
6. Look up shipping via UPS.com
7. More....like specifying individual shipmodes
for individual products, scanning multiple applicable
ship modes, specifying multiple ship modes, etc.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
It's a little-known fact 131 Willow Lane, Floor 2 | || _ \
that the Y1K problem caused Oxford, OH 45056 | || |_) |
the Dark Ages. -- unknown <mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\