[ic] Item options on Resultspage?

Tony Coake interchange-users@icdevgroup.org
Mon Mar 10 16:04:01 2003


> Would love to help....can you send a copy of the
results.html file?

> Thanks,
Kevin

Thank you, Kevin

I was able to get it work per "item" by giving each one it's own form ....
but ... now the "Buy List" feature won't work.

Content of "results.html" follows...

Thanks again
Tony Coake
tone@crystalpark.com.au

----------------------------------------------------------

<br>

[if scratch did_order]
[include file="templates/components/cart_display"]
<br>
[/if]
[set did_order][/set]
[search-region]
[set munge_quantity]
[calc]
 $Scratch->{did_order} = 1;
 @q = split /\0/, $CGI->{mv_order_quantity};
 for (@q) {
  next unless length $_;
  $_ = "=$_";
 }
 @parms = grep /^mv_oi\d+/ && $CGI->{$_}, keys %{$CGI};

 # If we have parms, means an individual buy. If we don't
 # we want to strip empty items
 unless (@parms) {
  @i = split "\0", $CGI->{mv_order_item};
  for(my $i = 0; $i < @i; $i++) {
   next if length($q[$i]);
   $i[$i] = '';
  }
  @i = grep length($_), @i;
  @q = grep length($_), @q;
  $CGI_array->{mv_order_quantity} = \@q;
  $CGI->{mv_order_quantity} = join "\0", @q;
  $CGI_array->{mv_order_item} = \@i;
  $CGI->{mv_order_item} = join "\0", @i;
  return;
 }
 my $item = $parms[0];
 $item =~ /(\d+)/ or return;
 my $idx = $1;
 $idx--;
 $CGI->{mv_order_item} = $CGI->{$item};
 $CGI->{mv_order_quantity} = "$q[$idx]";
 return;
[/calc]
 [bounce href="[history-scan exclude=nothing]"]
[/set]

<br>


<table width="90%" border="0" cellspacing="0" cellpadding="3">
<tr class="contentbar2">
  <td width="80"><b>&nbsp;Product</b></td>
  <td align="right"><b>Code #</b></td>
  <td align="left"><b>Stock</b></td>
  <td align="center"><b>Price</b></td>
  <td align="center"><b>Qty</b></td>
  <td align="center"><b>Buy</b></td>
</tr>

[search-list]

[item-change 1][condition][item-field category][/condition]

<tr class="contentbar1">
      <td colspan="6">&nbsp;[either][value banner_text][or][item-field
category]  [/either]</td>
</tr>

[/item-change 1]

<FORM 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>

<table width="90%" border="0" cellspacing="0" cellpadding="3">
<tr valign="middle">


<td>[if-item-field image]<A HREF="[area [item-code]]"><img
src="items/[item-field image]" ALT="[item-description]" BORDER="0"
width="70" height="50"></A>[/if-item-field]</td>



      <td>
 <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">
 [item-calc]
 my $q = q{[item-data inventory quantity]};
 if($q > 0) {
  return <<EOF;
<font __FFACE__ size="1" color="#008000"><b>Y</b></font>
EOF
 }
 else {
  return <<EOF;
<a href="[area stock-alert [item-code]]"><b>N</b></a>
EOF
 }
[/item-calc]
      </td>
      <td align="right">


              [if-item-data options o_enable]
         [if-item-data !options o_modular]
           [table-organize cols=2 table=' ' font="size=1" pretty=1]
             [item-options td=1 label=1 bold=1 price=1]
           [/table-organize]
         [/if-item-data]
       [/if-item-data]

          [if-item-data options o_modular]
         [set arg][item-code][/set]
         [include templates/components/modular_buy]
       [/if-item-data]


</td>
      <td align="right"><input type=hidden name="mv_oi[item-increment]"
value=""><input type=text name=mv_order_quantity size=2 value=""></td>
      <td align="right">
    [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]
   </td>
</tr>

</FORM>

</table>
[/search-list]


[on-match]
<div align=right><br><INPUT TYPE=submit VALUE="Buy
List">&nbsp;&nbsp;&nbsp;</div>
[/on-match]


[no-match]
<BR><BR>
<BLOCKQUOTE>
[comment]
 Don't show the search string if it was empty, since it looks weird
 and the user will see the error below anyway.
[/comment]
[tmp matchstring][value-extended name=mv_searchspec joiner=" | "][/tmp]
[if scratch matchstring]
Sorry, no matches for <B>[scratch matchstring]</B>.
[/if]
[if value mv_search_error]
<P>
<B>
Errors:
<BR>
[value-extended name=mv_search_error joiner="<BR>"]
</B>
[/if]

<BR><BR>
</BLOCKQUOTE>
[/no-match]
<BR CLEAR=LEFT>
[more-list]
<BLOCKQUOTE>
Matches [matches] of [match-count] found.
<BR>[more]<BR>
</BLOCKQUOTE>
[/more-list]

[/search-region]

<br>