[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
shipping (was Re: [mv] minivend and sql, it is not true)
On Wed, 03 Nov 1999, you wrote:
> ****** message to minivend-users from mikeh@minivend.com ******
> 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
^^^^^^
What is this?
> 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
This is nice! Much cleaner than the ideas I was looking at a while ago.
Is this code compiled when the catalog is brought up, or when the shipping
mode is called? One thing I like about the old subroutine system is that
the code is precompiled. I have complex shipping calculations and the
resultant routine is several pages of code. If it is compiled each
time a shipping calculation is needed, it will add to the overall latency
significantly.
> heavy: Surcharge for heavy items
> perl 1
Something missing here?
> 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.
Very nice!
Is this going to be in 4.0 or 4.1?
Best,
Kyle (KH)