[ic] Munge-Quantity: Keep or Toss?

Kevin Walsh kevin at cursor.biz
Thu Feb 26 16:34:12 EST 2004

Thomas J.M. Burton [tom at globalfocusdm.com] wrote:
> I'm upgrading our catalogs from IC 4.8.6 to IC 5.0 and have encountered
> some trouble in the results page used with one of the catalogs.
> I have the results page set up to display a list of the resulting items
> from a search, each with a quantity box. There are several "add to cart"
> buttons in the page. Under 4.8.6 this worked without a problem - any
> items in the list that had a value in the quantity field were added to
> the cart while those left blank were not.
> Under 5.0, all items on the page are added to the cart regardless of
> what's in the quantity field. 
> This results page is based off of the one in the Foundation demo, but I
> removed the code related to munge_quantity because Mike had mentioned a
> while back that it should not be used (see
> http://www.icdevgroup.org/pipermail/interchange-users/2001-April/006926.html).
> I'm confused as this code is still in the Foundation demo distributed
> with v5.0 despite what seems to be significant changes to the structure
> of the demo. 
> My results page contains the following code (simplified for this post):
> <form action="[process-target]" method="POST">
> <input type=hidden name=mv_todo value=refresh>
> <input type=hidden name=mv_separate_items value="1">
>    [search-region]
>      [search-list]
>        [item-description] [item-price]
>        <input type=hidden name=mv_order_item value="[item-code]">
>        <input size="2" name="mv_order_quantity" value="">     
>    [/search-list] [/search-region]
> <input type="image"
>          src="/interface/images/button_order_purple.gif"       
>         value="add to order" name="order">
> Should this code still work in IC 5.0 or am I missing something? Is
> munge_quantity now necessary in order to do a "buy list" sort of form,
> or is it still something that shouldn't be in there at all?
Instead of [process-target], try using [area nothing].

The 5.0.0 Foundation demo's results_buylist component has a line that
looks like this:

  [seti results_return_to][history-scan exclude="nothing" count="0"][/seti]

Make sure you have that line in your page code.

Also change your "mv_todo" to "mv_action" and include this line in
your <form>:

  <input type="hidden" name="mv_click" value="munge_quantity">

When you submit the form, the "munge_quantity" callback code will
be executed.  The code will set up the appropriate CGI variables to
order the chosen products and will then bounce the user to the
[scratch results_return_to] URI.

I suggest that you copy the "munge_quantity" code from the 5.0.0
Foundation demo and don't forget the [seti results_return_to]...[/seti]

   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/

More information about the interchange-users mailing list