[ic] Help! Pricing routines fail in receipt.html (but work otherwise)

Ubi interchange-users@interchange.redhat.com
Wed May 22 10:22:01 2002


 Dear all,

 I'm struggling against a very hard problem with Interchange (4.8.3,
4.8.5)...

 I'm using some custom tags to calculate the prices of items,
in pages basket.html, checkout.html, receipt.html

 The problem is that, when it comes to page receipt.html, Interchange
seems to have forgotten about item modifiers ( [item-modifier formats]
does not work too, and returns empty values) and my calculation of prices,
done via proprietary tag mix-sale-off:

 [mix-sale-off number="[nitems]" prodformat="[item-modifier formats]" ]

always returns 30 per discount percentage (see variable curr_prc) whereas
it should return 30 or 9 or 4 or 3 per discount percentage.

 Is it this an Interchange problem, or I am doing something nasty here???


--- THIS IS THE (TRIVIAL) TAG

UserTag mix-sale-off Interpolate
UserTag mix-sale-off Order number prodformat
UserTag mix-sale-off Routine <<EOR
sub {
        my $nitems = shift;
        my $prodformat = shift;
        my $perc_mod = 1;

        my $curr_prc = 30;
        if ($prodformat eq "s1600x1200") { $curr_prc = 9 };
        if ($prodformat eq "s1024x768")  { $curr_prc = 4 };
        if ($prodformat eq "s800x600")   { $curr_prc = 3 };

        if ($nitems == 2)                    { $perc_mod = .95 };
        if (($nitems > 2) && ($nitems < 5))  { $perc_mod = .90 };
        if (($nitems > 5) && ($nitems < 10)) { $perc_mod = .85 };
        if ($nitems > 10)                    { $perc_mod = .80 };

        $curr_prc = $curr_prc * $perc_mod;
        return $curr_prc;
}
EOR


-- THIS IS THE DATABASE DEFINITION:

Database            products products.txt __SQLDSN__
Database            products KEY    code
Database            products ChopBlanks   1
Database            products COLUMN_DEF   price=float
Database            products COLUMN_DEF   print_price=float
Database            products COLUMN_DEF   code=char(20)
Database            products COLUMN_DEF   image=char(255)

NoImport            products



-- THIS IS WHERE I RECALL THE TABLE FIELD "formats"
   (which maybe even unnecessary, given that I only use custom tags)

UseModifier formats