[ic] how to find weight for items in cart for shipping criteria
Ed LaFrance (New Media E.M.S.)
ic_users at newmediaems.com
Tue Aug 17 12:17:40 EDT 2004
At 10:06 PM 8/16/2004, you wrote:
>hi,
>
>IC 5.2.0 - foundation based catalog
>
>I'm trying to add an offset to my shipping calculation. The reason to add
>the offset is to calcualte the weight for the shipping box. The reason to
>do this is because there are some items which ship for free and so have
>weight 0 and I don't want to add the offset to them. Here is the code I
>have in my shipping.asc
>
>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>USPSROLLED: USPS Priority Mail
> criteria <<EOF
>[perl]
> my $total = 0;
> my $tmp_weight = 0;
> foreach my $item (@$Items) {
> $tmp_weight = $Tag->field('weight', $item->{code} );
> next unless $tmp_weight > 0;
> $total += $item->{quantity} * $tmp_weight ;
> }
> if ($total > 0) {
> $total += 1.0;
> }
> return $total;
>[/perl]
>EOF
> min 0
> max 0
> cost e Free Shipping!
>
> min 0
> max 5
> cost u
> table USPSPriority
> geo zip
> default_geo xxxxx
> adder 1
>
> min 5
> max 9999999
> cost e Error!
>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>The issue here is that, I cannot access the weight for each individual
>item. It is not stored in the cart along with each item and trying to call
>[data] or [field] is throwing errors.
>
>/cgi-bin/xxx/admin/test_code.html Safe: no access for database products at
>/usr/local/interchange-5.2.0/lib/Vend/Data.pm line 1036.
>
>Any suggestions on how to get weight of each item in the code segment above ?
>
>Thx
>-Akash
It's possible that this may be a lot easier than the above - have you tried
( -> = TAB ):
USPSROLLED -> USPS Priority Mail -> weight -> 0 -> 0 -> e Nothing to ship!
-> -> { adder => '1' )
USPSROLLED -> USPS Priority Mail -> weight -> 0 -> 5 -> u USPSPriority
USPSROLLED -> USPS Priority Mail -> weight -> 5 -> 999999 -> e Error!
- Ed
===============================================================
New Media E.M.S. Technology Solutions for Business
11630 Fair Oaks Blvd., #250 eCommerce | Consulting | Hosting
Fair Oaks, CA 95628 Ed.LaFrance at newmediaems.com
(916) 961-0446 http://www.newmediaems.com
(866) 519-4680 Toll-Free (916) 961-0447 Fax
===============================================================
More information about the interchange-users
mailing list