[ic] Problem with more-list and Buy Now button

Philip Alves interchange-users@icdevgroup.org
Mon Dec 2 11:03:01 2002


> Howdy all!
>
> I'm working with IC 4.8.6, and have been customizing the demo.  On my
> results page, I've added plus and minus buttons for quantity.  This is did
> with JavaScript, and it works well on the first page of results.  This is
> where the problem starts, though.  If there are [more] pages, then these
> plus minus buttons add only 1 to the cart, regardless of how many should
be
> added.
>
> For example, on the first results page, if the minimum order quantity is
48,
> and I hit the plus button, then hit Buy Now, 48 gets added to the cart
like
> it should.  Now, if I go to the second results page, and try the exact
same
> thing, only 1 gets added.  Here's what the code looks like:
>
> In <HEAD>:
>
> <SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
>
> <!--
> var listpointer;
> var qty;
>
> function recalcform()
> {
>  for (var i=0;i<document.resultsform.elements.length;i++)
>  {
>
>   if (document.resultsform.elements[i].name == "mv_order_item")
>   {
>    qty = document.resultsform.elements[i+3].value;
>
>    if (qty<0){
>     qty=0;
>     document.resultsform.elements[i+3].value=0;
>    }
>
>    document.resultsform.elements[i+2].value=qty;
>   }
>  }
>
> }
> // -->
> </SCRIPT>
>
> ________________________
> On results.html:
>
> <FORM name="resultsform" ACTION="[area nothing]" METHOD=POST>
> <input type=hidden name=mv_session_id value="[data session id]">
> <INPUT TYPE=hidden  NAME="mv_action" VALUE="refresh">
> <INPUT TYPE=hidden  NAME="mv_separate_items"  VALUE="0">
> <INPUT TYPE=hidden  NAME="mv_click" VALUE="munge_quantity">
>
> **<--snip-->**
>
>  <INPUT TYPE=hidden  NAME="mv_order_item"  VALUE="[item-code]">
>  <a href="[area [item-code]]">[item-description]</a>
>       </td>
>       <td align="center">[item-code]</td>
>       <td align="center"><b>
>        [if data products::Stock::[item-code] =~ /Y/]<font
> color="#008000">[item-data products Stock]</font>
>               [else]<font color=darkred>[item-data products Stock]</font>
>                 [/else]
>                 [/if]</b>
>       </td>
>       <td align="center">[item-price]</td>
>       <td align="center"><input type=hidden name="mv_oi[item-increment]"
> value=""><input type=hidden name=mv_order_quantity value="0"><input
> type=text name=qty[item-increment] size="4" value="0" readonly></td>
>       <td align="center">
>         <input type="button" value="+ [item-data products min_qty]"
>
onClick="this.form.qty[item-increment].value=parseInt(this.form.qty[item-inc
> rement].value)+[item-data products min_qty]; recalcform(); return false;">
> </td>
>       <td align="center">
>         <input type="button" value="- [item-data products min_qty]"
>
onClick="this.form.qty[item-increment].value=parseInt(this.form.qty[item-inc
> rement].value)-[item-data products min_qty]; recalcform(); return false;"
> ></td>
>             <td align="center">
> [if data products::Stock::[item-code] =~ /Y/]
>     [if session browser =~ /mac/]
>    <input type=submit value="[L]Buy now[/L]"
> onClick="this.form.mv_oi[item-increment].value='[item-code]'" border=0>
>   [else]
>    <input type=image src="__THEME_IMG_DIR__buynow.gif"
> onClick="this.form.mv_oi[item-increment].value='[item-code]'" border=0>
>   [/else]
>   [/if]
> [else]
>      [if data products::avail_date::[item-code] =~ /29991231/]<b>N/A</b>
>      [else]
> <b>[item-data products avail_date]</b>
>     [/else]
>     [/if]
> [/else]
> [/if]
>    </td>
>       <td align="center">[nitems qualifier=code
> compare="^[item-code]$"]</td>
> </tr>
>
> **<--snip-->**
>
> </FORM>
>
> **<--snip-->**
>
> [more-list]
> <BLOCKQUOTE>
> Matches [matches] of [match-count] found.
> <BR>[more]<BR>
> </BLOCKQUOTE>
> [/more-list]
>
> Anybody have any ideas as to what might be going wrong?  Is this a bug
with
> IC, or a problem I've created?  I'm stumped.
>

Hello again.  I've just noticed one other thing that may shed some more
light on my problem to anyone smarter than me :)

Like I said, everything works fine on the first page of results, and then
gets messed up on subsequent pages.  What I've just noticed is that simply
clicking the "Buy Now" button adds 1, even if it no quantity has been
entered.  So, regardless of the entered quantity, "Buy Now" always adds 1.
Very annoying!

Again, thanks!

Phil