[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Feedback on another component...
This component not much to look at besides a bunch of [if] statements, but
hopefully yall understand its purpose
Please send me any feedback on it, I was using it and it works just fine for
me, just thought I'd share it :)
-Brendan
[comment]
ui_component: special_search
ui_component_type: content
ui_component_group: Navigation
ui_component_label: Controllable Search Results
displaythumb:
label: Display Thumbnail for product
widget: radio
help: Turn on/off Thumbnail display
options: 1=Yes,=No
advanced: 1
displaysku:
label: Display SKU for product
widget: radio
help: Turn on/off SKU display
options: 1=Yes,=No
advanced: 1
displaystock:
label: Display Stock for product
widget: radio
help: Turn on/off in-stock/out-of-stock display
options: 1=Yes,=No
advanced: 1
displayprice:
label: Display Price for product
widget: radio
help: Turn on/off Price display
options: 1=Yes,=No
advanced: 1
autoquantity:
label: Auto-Quantity for product
widget: text
help: Set to a number to have this item auto buy this quantity when buy
button pushed, otherwise will display qty field
advanced: 1
displaybuy:
label: Display buy button for product
widget: radio
help: Turn on/off buy button display
options: 1=Yes,=No
advanced: 1
buyimage:
label: Buy button image file
widget: text
help: Write in a image file for the buy button, otherwise the default is
used.
displaybuylist:
label: Display buy list button for entire list
widget: radio
help: Turn on/off buy list button display
options: 1=Yes,=No
advanced: 1
displaycategory:
label: Display the category
widget: radio
help: Turn on/off category display
options: 1=Yes,=No
advanced: 1
[/comment]
<!-- BEGIN COMPONENT [control component search_results] -->
[tmp displaythumb][control displaythumb][/tmp]
[tmp displaysku][control displaysku][/tmp]
[tmp displaystock][control displaystock][/tmp]
[tmp displayprice][control displayprice][/tmp]
[tmp autoquantity][control autoquantity][/tmp]
[tmp displaybuy][control displaybuy][/tmp]
[tmp buyimage][control buyimage][/tmp]
[tmp displaybuylist][control displaybuylist][/tmp]
[tmp displaycategory][control displaycategory][/tmp]
[if scratch did_order]
[include file="templates/components/cart_display"]
[/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]
[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]
<table width="90%" border="0" cellspacing="0" cellpadding="3">
<tr class="contentbar2">
[if scratch displaythumb]<td align="center"> </td>[/if]
<td><b> Product</b></td>
[if scratch displaysku]<td align="center"><b>SKU</b></td>[/if]
[if scratch displaystock]<td align="center"><b>Stock</b></td>[/if]
[if scratch displayprice]<td align="center"><b>Price</b></td>[/if]
[if !scratch autoquantity]<td align="center"><b>Qty</b></td>[/if]
[if scratch displaybuy]<td align="center"><b>Buy</b></td>[/if]
</tr>
<tr>
[if scratch displaythumb]<td> </td>[/if]
<td> </td>
[if scratch displaysku]<td> </td>[/if]
[if scratch displaystock]<td> </td>[/if]
[if scratch displayprice]<td> </td>[/if]
[if !scratch autoquantity]<td> </td>[/if]
[if scratch displaybuy]<td> </td>[/if]
</tr>
[search-list]
[if scratch displaycategory][item-change 1][condition][item-field
category][/condition]
<tr class="contentbar1">
[if scratch displaythumb]<td> </td>[/if]
<td>[either][value banner_text][or][item-field category][/either]</td>
[if scratch displaysku]<td> </td>[/if]
[if scratch displaystock]<td> </td>[/if]
[if scratch displayprice]<td> </td>[/if]
[if !scratch autoquantity]<td> </td>[/if]
[if scratch displaybuy]<td> </td>[/if]
</tr>
[/item-change 1][/if]
<tr valign="middle">
<INPUT TYPE=hidden NAME="mv_order_item" VALUE="[item-code]">
[if scratch displaythumb]<td><a href="[area [item-code]]"><img border="0"
src="thumb/[item-field thumb]"></a></td>[/if]
<td align="left"><a href="[area [item-code]]">[item-description]</a></td>
[if scratch displaysku]<td align="center">[item-code]</td>[/if]
[if scratch displaystock]<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>[/if]
[if scratch displayprice]<td align="center">[item-price]</td>[/if]
[if !scratch autoquantity]<td align="center"><input type=hidden
name="mv_oi[item-increment]" value=""><input type=text
name=mv_order_quantity size=2 value=""></td>[else]<input type=hidden
name="mv_oi[item-increment]" value=""><input type=hidden
name=mv_order_quantity value="[scratch autoquantity]">[/else][/if]
[if scratch displaybuy]<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="[either][scratch
buyimage][or]__THEME_IMG_DIR__buynow.gif[/either]"
onClick="this.form.mv_oi[item-increment].value='[item-code]'" border=0>
[/else]
[/if]
</td>[/if]
</tr>
[/search-list]
</table>
[on-match]
[if scratch displaybuylist]<div align=right><br><INPUT TYPE=submit
VALUE="Buy List"> </div>[/if]
</FORM>
[/on-match]
[/search-region]
<!-- END COMPONENT [control component search_results] -->
-----------------------------------------
Brendan Crosser-McGay
brendan@paymentonline.com
-----------------------------------------