[ic] Minimum Shipping Weight?

Ed LaFrance interchange-users@lists.akopia.com
Fri Jun 15 12:18:01 2001


At 10:11 AM 06/15/2001 -0400, you wrote:

>How can I set a minimum weight for shipping? Like 5lb order minimum in
>order to check out.
>
>
>I'm on IC 4.6.2.
>
>

Here's one way:

First, check pages/ord/checkout.html to assure that the weight is being 
tallied on that page - the code looks like this:

[item-list]
...
         [if-item-field weight]
         [seti weight][summary amount=`[item-quantity] * [item-field 
weight]`][/seti]
         [/if-item-field]
...
[/item-list]

Then add this input somewhere below the [item-list][/item-list] block, but 
before the end of the form.

[seti total_weight][summary format="%s" total=1][/seti]
[if scratch total_weight >= 5]
         <input type=hidden name=weight_min_ok value=1>
[else]
         <input type=hidden name=weight_min_ok value=''>
[/else]
[/if]

Then add this to the checkout_profile in etc/profiles.order (shown with a 
little context):

__NAME__                            checkout_profile
....
weight_min_ok=required Your order must weigh at least 5lb.
...
[if value country =~ /^(US|CA)$/i]
         state=state_province "[value state]" is not a valid US/Canada 
state or province.
....
__END__

Reconfig, and now the submit should fail if the total order weight is less 
that 5 lb (kg, etc, whatever you use).  Take a look at the [error] tag doc 
for how to incorporate an error message into the checkout display.

- Ed L.


===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================