[ic] [total-cost] & [salestax] & manually added items

Ed LaFrance (New Media E.M.S.) ic_users at newmediaems.com
Mon Oct 11 10:15:42 EDT 2004

At 12:10 AM 10/11/2004, you wrote:

>Hello list,
>for an SAP-OCI-interface implementation I put items (not existing in the
>products db) manually into the users basket. Price, taxrate, description
>etc. come per item dynamically from the interface (simple http-post
>submission...), so I loop through $CGI and put these items into the
>active cart:
>push (@{$Carts->{main}}, {
>                         code=>"$v",
>                         description=>$desc,
>                         price=>$price,
>                         quantity=>$qty,
>                         comment => $long,
>                         supplier_id => $sup,
>                         taxrate => $tax,
>                         oci => 1,
>                 });
>In the [item-list] I can access several item properties (e.g. taxrate,
>price) only by using [item-modifier ...], that's ok and I can handle
>that but how can I make [total-cost] and [salestax] at the end of my
>basket page show the correct values including quantity,price and taxrate
>of my manually added items?!?! :|
>Do I have to add the items otherwise? As onfly-items? Who can help me?

If you use 'mv_price' instead of 'price' in your cart attributes, the 
subtotal should tally up automatically in the foundation demo, since the 
CommonAdjust atom '$' is designed to do this.\

Do you really need to post the taxrate individually with each item? Do your 
taxrates vary per-item and per-order? If not (or even if so), you should 
just use one of the built-in methods for calculating tax that are available 
in interchange. If you really need to do it your way, I guess you could do 
something like this in Perl:

my $tax;
foreach (@$Items) {
         $tax += $_->{mv_price} * $_->{quantity} * $_->{taxrate};
$Tag->assign( { salestax => $tax } );

- Ed

New Media E.M.S.              Technology Solutions for Business
11630 Fair Oaks Blvd., #250   eCommerce | Consulting | Hosting
Fair Oaks, CA  95628          Ed.LaFrance at newmediaems.com
(916) 961-0446                http://www.newmediaems.com
(866) 519-4680 Toll-Free      (916) 961-0447 Fax

More information about the interchange-users mailing list