[ic] Size based shipping

interchange-users@interchange.redhat.com interchange-users@interchange.redhat.com
Mon Dec 3 20:03:01 2001


On Mon, Dec 03, 2001 at 04:56:03PM -0600, Rick Eicher II wrote:
> > One problem that I see right off is :
> > if ([item-modifier size] =~ /^xl/i) {$total += ([item-quantity] * 11.95);}

...

> > When i load an item into the cart it gives me a shipping cost of
> > $154,792,564.00 for a medium
> > and $154,792,620.00 for a large. Now while i plan to retire
> > someday I do not
> > think I will get many sales on this site.:)
> >
> > So what have I done wrong? lol To me the code looks write but I know that
> > one can not proof read there own essay.
> >
> > I am useing redhat 7.1 and interchange 4.8.3(rpm). Not that that
> > will matter
> > much.
> 
> Here is my latest version of the usertag in my catalog.cfg:
> 
> #Shipping user tag
> 
> UserTag ship Routine <<EOF
> sub{
> package Vend::Interpolate;
> my $total =0;
> [item-list]
> if ([item-modifier size] =~ /^s/i) {$total += ([nitems] * 8.95);}
> if ([item-modifier size] =~ /^m/i) {$total += ([nitems] * 9.95);}
> if ([item-modifier size] =~ /^l/i) {$total += ([nitems] * 10.95);}
> if ([item-modifier size] =~ /^xl/i) {$total += ([nitems] * 11.95);}
> [/item-list]
> return $total;
> }


This is certainly one of the harder ways.  I'd suggest:

Learn how to do it in straight perl; there are numerous examples in the list.
This will be hard to maintain unless you do.

Give each size a different code.  This way works now, but what happens when
you have another item with size attributes?


-- 

Christopher F. Miller, Publisher                               cfm@maine.com
MaineStreet Communications, Inc           208 Portland Road, Gray, ME  04039
1.207.657.5078                                         http://www.maine.com/
Content/site management, online commerce, internet integration, Debian linux