[ic] item-price and loop-price is not the same and have not the same behavior with IC 4.8.5

Joachim Leidinger interchange-users@icdevgroup.org
Fri Jul 19 10:43:01 2002


Hi List,


I read

[loop-price n* noformat*]

Evaluates to the price for optional quantity n (from the products file) 
of the current item, with currency formatting. If the optional 
``noformat'' is set, then currency formatting will not be applied.

and

[item-price n* noformat*]

Evaluates to the price for quantity n (from the products file) of the 
current item, with currency formatting. If the optional ``noformat'' is 
set, then currency formatting will not be applied.

But with

code   title   HEURO1  HEURO10  HERUO20    EKEURO
0001   beer    10      9        8          20

and

PriceField     no_price
CommonAdjust products:HEURO1,HERUO10,HEURO20

UserDB         default    scratch    dealer

Autoload <<EOR
[perl]
     if($Scratch->{dealer}) {
             $Config->{PriceField} = 'no_price';
     } else {
             $Config->{PriceField} = 'EKEURO';
	}
[/perl]
EOR

I get alway the right price with [item-price]. But if I use

[loop
random="2"
search="
       sf=Neu
       rf=code
       cs=1
...etc.
"]

[loop-price]

[/loop]

and I'm a dealer, I still get the price 20 instead of 10!

I noticed, the autoload function is not loading right, because

1. log in as dealer first
2. search for an item
3. order an item (the basket is not showing per default)
4. show the basket
I get the debug infos

--------- snip ---------
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: price for item before chain 66673E=12.00 PriceField=EKEURO
Vend::Data:debug: price for item 66673E=12 item={'mv_ip' => "0",'code' 
=> "66673E",'mv_ib' => "products",'size' => "",'mv_cache_price' => 
"12",'quantity' => "1",'color' => "",}
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: item_price initial call: 66673E
--------- snip ---------

note the wrong PriceField "EKEURO". The price "12" in mv_cache_price is 
   wrong.

4. show the basket once more again and I get

---------- snip  ------------
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: price for item before chain 66673E= PriceField=no_price
Vend::Data:debug: price for item 66673E=5.99 item={'mv_ip' => "0",'code' 
=> "66673E",'mv_ib' => "products",'size' => "",'mv_cache_price' => 
"5.99",'quantity' => "1",'color' => "",}
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: item_price initial call: 66673E
---------- snip  ------------

and the price "5.99" is right. Note the right PriceField!

If I go to the start page which has the codes

--------- snip ---------
[loop
	random="2"
	search="
	      sf=code
	      se=66673E
... 
			"]
--------- snip ---------

The price is right, because I was in the basket. If I call the same page 
once more again, PriceField is changed to EKEURO suddenly.

------- snip -------

in the basket:

Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: price for item before chain 66673E= PriceField=no_price
Vend::Data:debug: price for item 66673E=5.99 item={'mv_ip' => "0",'code' 
=> "66673E",'mv_ib' => "products",'size' => "",'mv_cache_price' => 
"5.99",'quantity' => "1",'color' => "",}
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: item_price initial call: 66673E


call the start page:
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: price for item before chain 66673E= PriceField=no_price
Vend::Data:debug: price for item 66673E=5.79 item={'mv_ib' => "",'code' 
=> "66673E",'quantity' => "10",}


call the start page once more again:
Vend::Data:debug: item_price initial call: 66673E
Vend::Data:debug: price for item before chain 66673E=12.00 PriceField=EKEURO
Vend::Data:debug: price for item 66673E=12 item={'mv_ib' => "",'code' => 
"66673E",'quantity' => "10",}
------- snip -------

What is the cause? The scratch variable "dealer" is always right and I 
don't lost the value of that variable. Why is PriceField not set right, 
if I'm a dealer?

Any hints, suggestions and helps are very welcome!

Thanks!

Joachim

-- 
Hans-Joachim Leidinger | Dipl.-Phys.Ing. Entwicklung eCommerce
[leidinger@bpanet.de]
Black Point Arts Internet Solutions GmbH
http://www.bpanet.de