[ic] images in search results for beginner

Julia Jacobs interchange-users@interchange.redhat.com
Wed Feb 20 23:08:01 2002


On 2/20/02 6:58 PM, "catchersgearonly" <info@catchersgearonly.com> wrote:

> I've seen this question asked several times and was wondering what would be
> the easiest way.
> 
> I want to first get rid of the in stock column for my results when someone
> clicks a category.  I think I can do this by just editing the results.html
> page and taking the short code out of the page. Am I missing anything else.
> 
> Secondly I want to add a small pic or thumbnail to the list of results is
> there a setting to do this or do I have to change some code on the page( or
> something totally different)
> 
> Thanks again,
> Kevin

Hi Kevin!

Welcome to Interchange!  There is an easy way you can tackle this issue:

Use the ever talented Brenden Crosser-McGay's wonderful special search
component.  Just copy and paste the following text to a .txt file. Make sure
its got Unix spacing and all that stuff (I don't know how much of a beginner
you are so if I sound patronizing, please forgive me).  Then upload it to
the /templates/components directory using the Content area of Interchanges
Administration UI.  Then when you go to the results.html page choose the
special search component in one of your empty component areas and replace
the content section with a <br>.  The special search component will let you
choose if you want the results page to display the thumb image as well as
other cool options in an easy fasion.

[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">&nbsp;</td>[/if]
  <td><b>&nbsp;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>&nbsp;</td>[/if]
  <td>&nbsp;</td>
[if scratch displaysku]<td>&nbsp;</td>[/if]
  [if scratch displaystock]<td>&nbsp;</td>[/if]
  [if scratch displayprice]<td>&nbsp;</td>[/if]
  [if !scratch autoquantity]<td>&nbsp;</td>[/if]
  [if scratch displaybuy]<td>&nbsp;</td>[/if]
</tr>

[search-list]

[if scratch displaycategory][item-change 1][condition][item-field
category][/condition]
<tr class="contentbar1">
[if scratch displaythumb]<td>&nbsp;</td>[/if]
  <td>[either][value banner_text][or][item-field category][/either]</td>
[if scratch displaysku]<td>&nbsp;</td>[/if]
  [if scratch displaystock]<td>&nbsp;</td>[/if]
  [if scratch displayprice]<td>&nbsp;</td>[/if]
  [if !scratch autoquantity]<td>&nbsp;</td>[/if]
  [if scratch displaybuy]<td>&nbsp;</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">&nbsp;&nbsp;&nbsp;</div>[/if]
</FORM>
[/on-match]

[/search-region]
<!-- END COMPONENT [control component search_results] -->

-- 
Julia Jacobs
Currant Media
407-977-4523
Fax 407-261-0176
http://www.currantmedia.com
Members of The Better Business Bureau
* Multimedia Producers
* Web Design & Development
* 2D/3D Graphics/Animation
* Hosting, domain and e-mail
* E-Commerce ­ check, credit card validation