[ic] [item-subtotal] in array lists

Mike Heins mike at perusion.com
Wed Jun 3 13:35:40 UTC 2009

Quoting Stefan Hornburg (Racke) (racke at linuxia.de):
> Mike Heins wrote:
> > Quoting Stefan Hornburg (Racke) (racke at linuxia.de):
> >> Hello,
> >>
> >> Is there a reason that [item-subtotal] doesn't work in array lists like
> >>
> >> [query sql="select sku,quantity from cart_products where cart = 2009" list=1]
> >> ...
> >> [/query]
> >>
> >> It appears to be an omission which should be fixed in Interpolate.pm.
> >>
> > 
> > Why? There is no cart item to subtotal. 
> Table cart_products has sku and quantity as the inline shopping cart.
> So there are cart items to subtotal.
> Purpose:
> I don't want to store saved carts (and wishlists) into Perl hashes
> inside database fields.
> > Now if you decided to allow
> > cart items to be arrays as well as hashes,
> > 
> > I think it would be as useful to have [item-math quantity * subtotal].
> > 
> IMHO all lists should behave pretty much the same. These undocumented
> exceptions aren't any good.

They aren't undocumented. But even if they were, the work that someone
should do is to bring hash and array lists together completely. And I
don't quite see how to do that. 8-)

But it occurs to me that it would not be too difficult to provide
this exception routine (pseudo-code)

	s{\[item-(\w+)\s*(.*?)\]}{extra_routines($1, $2)}g;

Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.328.4479  <mike at perusion.com>

Unix version of an Outlook-style virus:
It works on the honor system. Please forward this message to everyone
you know, and delete a bunch of your files at random.

More information about the interchange-users mailing list