[ic] how to calculate item-subtotal by the item price *and* packing unit

Ed LaFrance interchange-users@icdevgroup.org
Fri Aug 16 11:29:01 2002


At 09:43 AM 08/16/2002 +0200, you wrote:
>Hi List,
>
>I've the item price and the quantity. If 1 quantity of an item is in the 
>basket, the item-subtotal has to dispay the price like
>
>1 quantity * item-prive * packing unit (from the field unit)
>
>For example a cake of soap cost 0.50 $. In the basket, it has to displays as
>
>sku  description    Qt.(Unit)  price   unit   item total
>1234 soap           1          0.50 $  72     36.00 $
>
>Can I use CommonAdjust to calculate the item total with
>
>price * quantity + field unit
>
>? My customer export his products table from his software and is not able 
>to set the price with 36.00$ instead of 0.50 $.
>
>Any tips?
>
>Thanks!
>
>Joachim

There a couple of ways I can think of. The only CommonAdjust documentation 
I could fine dates back to the Minivend days; I adapted it into a document 
called ic_ecommerce some time ago. It's in the IC distribution, and also here:
http://www.insitehosting.com/icdocs/ic_ecommerce.html

You could try the & CODE atom, perhaps something like:

& &tag_data('products', 'price', $Vend::Interpolate::item->{code}) * 
&tag_data('products', 'unit', $Vend::Interpolate::item->{code})

Or you could write a usertag that does a similar calculation to the above, 
call it pack_price, and then invoke it in the CommonAdjust string:

CommonAdjust '[pack_price]'

...Mike H. wrote a pretty good example of just such a usertag; I have 
employed the technique a few times myself:

http://interchange.redhat.com/pipermail/interchange-users/2001-June/009214.html


- Ed L.







===============================================================
Increase profits from your Interchange store...
http://www.newmediaems.com/cgi-bin/nm/software_fus.html
===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================