[ic] Size based shipping

Rick Eicher II interchange-users@interchange.redhat.com
Mon Dec 3 17:44:01 2001


> One problem that I see right off is :
> if ([item-modifier size] =~ /^xl/i) {$total += ([item-quantity] * 11.95);}
>
> Try changing "[item-quantity]" to "[nitems]".  I had this problem with my
> system.  I kept getting a shipping price of over 30 million dollars
> (hand-delivered by Tibeten monks?).
>
> Here is where I found my answer:
> http://interchange.redhat.com/cgi-bin/ic/dev/ictags_51.html  (thanks to
> Chris Knight)
>
>
>
> <original message follows>
> -------------------------
> Rick Eicher II interchange-users@interchange.redhat.com
> Mon Dec 3 11:44:00 2001
>
> ------------------------------------------------------------------
> ----------
> ----
>
> I am trying to make shipping to be based on the size of the items.
>
> I have looked throught the archives and spent time in the IRC chat. I have
> tried many different ways to make this work. I am now trying to use a
> usertag to make this work.
>
> I have a shipping.asc file of:
>
> FLATD   Standard        price   0       0       e No thing to ship
> FLATD   Standard        price   0       9999999 f [ship]
>
> I have a usertag defined in the catlog.cfg:
>
> #=================================================================
> =========#
>
> #Shipping user tag
>
> UserTag ship Routine <<EOF
> sub{
> package Vend::Interpolate;
> my $total =0;
> [item-list]
> if ([item-modifier size] =~ /^s/i) {$total += ([item-quantity] * 8.95);}
> if ([item-modifier size] =~ /^m/i) {$total += ([item-quantity] * 9.95);}
> if ([item-modifier size] =~ /^l/i) {$total += ([item-quantity] * 10.95);}
> if ([item-modifier size] =~ /^xl/i) {$total += ([item-quantity] * 11.95);}
> [/item-list]
> return $total;
> }
> EOF
>
> #=================================================================
> =========#
>
>
> 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;
}





I believe that the [item-modifier size] is not the right tag. So i made a
test.html as follows to test it:

[perl interpolate=1]
my $total = 0;
[item-list]
$total += ([item-quantity] * 8.95) if q{[item-modifier size]} =~ /^S/i;
$total += ([item-quantity] * 9.95) if q{[item-modifier size]} =~ /^M/i;
$total += ([item-quantity] * 10.95) if q{[item-modifier size]} =~ /^L/i;
$total += ([item-quantity] * 11.95) if q{[item-modifier size]} =~ /^XL/i;
[/item-list]
return $total;
[/perl]
hello

[item-list]
         [item-modifier size]<br>
         [/item-list]
bye


I use the hello and bye just to make sure the page is executing. But that is
all the out put that I am getting. I believe once I get this tag set right
then this usertag will work.

Any ideas?

Thanks for all the help,
Rick