[ic] Serious! Confirmed that item modifiers are lost moving to receipt.html

Ubi interchange-users@interchange.redhat.com
Thu May 23 04:48:01 2002


 Dear all, I've changed subject so that my problem can be defined more
precisely.

 As all custom pricing routines that I have written failed only in
receipt.html (but not in checkout.html nor any other page), apparently
because the $Cart variable gets corrupted. Now, I've written this silly
tag that returns the item-modifier for the last object:

# Ubi: just for test, TESTED AND WORKS IN ord/checkout.html but
#      not in receipt.html

UserTag test-mod Routine <<EOR
sub {
        my $cart = $Vend::Session->{carts}{main};
        my $item;
        my $prod_format;
        foreach $item (@$cart) { $prod_format = $item->{formats}; }
        return $prod_format;
}
EOR

 and it returns "s1024x768", as it should do, in checkout.html,
but provides "1" in receipt.html (tested with various basket contents).

 Is there any logical reason why the $Vend::Session->{carts}{main} looses
the values that I need or this tag fails for some obscure reason ???


-- This is some extra data you may want to know about: --

tested with Interchange 4.6.5 (?), 4.8.3, 4.8.5

--- in catalog.cfg you have the lines (* for "secret" data): ---

(...)

# Ubi: using Postgres

Variable SQLDSN dbi:Pg:dbname=********
Message Ubi: using PostgreSQL, DSN=__SQLDSN__

# Ubi: products table section

Database            products products.txt __SQLDSN__
Database            products KEY    code
Database            products USER   ***********
Database            products PASS   ***********
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

(...)

# Ubi: this tells the system which is the field containing the price
#      ([item-price] uses it) and, presumably, it says which field is
looked
#      for a valid price first

PriceField     price

(...)

# Ubi: to calculate the total, given that the Interchange [subtotal]
#      failed for us

UserTag full-cost Interpolate
UserTag full-cost Order number
UserTag full-cost Routine <<EOR
sub {
        my $cart = $Vend::Session->{carts}{main};
        my $nitems = shift;
        my $item;
        my $curr_prc;
        my $prod_format;
        my $full_prc = 0;
        my $perc_mod = 1;

        foreach $item (@$cart) {

                $prod_format = $item->{formats};
                my $curr_prc = 30;
                if ($prod_format eq "s1600x1200") { $curr_prc = 9 };
                if ($prod_format eq "s1024x768")  { $curr_prc = 4 };
                if ($prod_format eq "s800x600")   { $curr_prc = 3 };

                $full_prc = $full_prc + $curr_prc;
        }

        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 };

        $full_prc = $full_prc * $perc_mod;

        return $full_prc;
}
EOR


(...)

###########################################################
# Ubi: it was UseModifier   size__MVC_FIELDMUNGE__ color
# Ubi: it is for us, instead

UseModifier formats
###########################################################