[ic] Size based shipping (works)

Rick Eicher II interchange-users@interchange.redhat.com
Wed Dec 5 13:55:01 2001


> Quoting Rick Eicher II (rick@texol.net):
> > Ok I almost have this working. Every thing works but the if statement.
> >
> > Here is my user tag now:
> >
> > #Shipping user tag
> >
> >
> > UserTag ship Routine <<EOF
> > sub{
> > package Vend::Interpolate;
> > my $total =0;
> >
> > for(@$Items) {
> > #if {$Tag->accessories('size') =~ /^s/i} {$total +=
> $_->{quantity} * 8.95;}
> > if {$Tag->accessories{'Size'} =~ /^m/i} {$total +=
> $_->{quantity} * 9.95;}
> > #if {$Tag->accessories('size') =~ /^l/i} {$total +=
> $_->{quantity} * 10.95;}
> > #if {$Tag->accessories('size') =~ /^xl/i} {$total += $_->{quantity} *
> > 11.95;}
> > }
> > return $total;}
> > EOF
> >
> >
> > I just can not figure out how to do the "$Tag->accessories{Size}" part.
>
> That never would have compiled.
>
> UserTag ship Routine <<EOF
> sub {
>     package Vend::Interpolate;
>     my $total =0;
>
>     for my $item (@$Items) {
> 	if    ($item->{size} =~ /^s/i ) { $total +=
> $item->{quantity} * 8.95;  }
> 	elsif ($item->{size} =~ /^m/i ) { $total +=
> $item->{quantity} * 9.95;  }
> 	elsif ($item->{size} =~ /^l/i ) { $total +=
> $item->{quantity} * 10.95; }
> 	elsif ($item->{size} =~ /^xl/i) { $total +=
> $item->{quantity} * 11.95; }
>     }
>     return $total;
> }
> EOF
>
> I have corrected your spacing a bit -- is there a shortage of whitespace
> characters in your area? 8-)
>

Not that anyone would be surprised but that worked. I change size to Size
but that all.
Thanks Mike!

Thanks for everyone that helped me on this!

rick