
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Size based shipping (almost got it)
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-)
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
"All you need in this life is ignorance and confidence, and
then success is sure." -- Mark Twain
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users