[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Code for 2 column buy list
Field added to products database: include_on_list (Yes or No value)
<br>
[if scratch did_order]
[include file="templates/components/cart_display"]
[/if]
[set did_order][/set]
[search-region more=1
search="
fi=products
st=db
co=1
sf=include_on_list
se=Yes
op=rm
nu=0
bs=1
su=1
ml=9999
tf=category
to=x
"]
[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]
[tmp cross_sale][value-extended name=mv_searchspec index=0][/tmp]
[on-match]
<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">
[/on-match]
[seti matches_count][value mv_search_match_count][/seti]
<!--
[perl]$Scratch->{half_matches} = int(($Scratch->{matches_count} /
2)+2);[/perl]
-->
<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td
width="50%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr class="contentbar2">
<td><b> Product</b></td>
<td align="center"><b>Price</b></td>
<td align="center"><b>Qty</b></td>
<td align="center"><b>Buy</b></td>
</tr>
<tr><td colspan="4"> </td></tr>
[search-list]
[if term="[item-increment]" op="==" compare="[scratch half_matches]"]
</table></td><td width="50%" valign="top"><table width="100%" border="0"
cellspacing="0" cellpadding="3">
<tr class="contentbar2">
<td><b> Product</b></td>
<td align="center"><b>Price</b></td>
<td align="center"><b>Qty</b></td>
<td align="center"><b>Buy</b></td>
</tr>
<tr><td colspan="4"> </td></tr>
<tr class="contentbar1">
<td colspan="4"> [either][value banner_text][or][item-field
category][/either]</td>
</tr>
[/if]
[item-change 1][condition][item-field category][/condition]
<tr class="contentbar1">
<td colspan="4"> [either][value banner_text][or][item-field
category][/either]</td>
</tr>
[/item-change 1]
<tr valign="middle">
<td>
<INPUT TYPE=hidden NAME="mv_order_item" VALUE="[item-code]">
<a href="[area [item-code]]">[item-description]</a>
</td>
<td align="center">[item-price]</td>
<td align="center"><input type=hidden name="mv_oi[item-increment]"
value=""><input type=text name=mv_order_quantity size=2 value=""></td>
<td align="center">
[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>
[/search-list]
</td></tr>
</table>
</td></tr>
</table>
[on-match]
<div align=right><br><INPUT TYPE=submit VALUE="Buy
List"> </div>
</FORM>
[/on-match]
[no-match]
<BR><BR>
<BLOCKQUOTE>
Sorry, no matches for <B>[calc]
my $joiner = ' AND ';
$joiner = ' OR ' if
defined $Search->{''}->{mv_orsearch}[0]
and $Search->{''}->{mv_orsearch}[0];
my @str = grep /\D/, @{$Values->{mv_searchspec}};
return join $joiner, @str;
[/calc]
[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>
[/search-region]
<br>