Smilehouse Workspace HOWTO Articles

Howto create an advanced search page

We need to create a new page inside Workspace that contains the search form.
This can be done by creating an HTML code that contains only the required content.
This means that you should not include <head> and <html> etc. header tags into this file,
because the headers and footers will be loaded from the Workspace automatically.

You can download an example file here. (TIP: right-click the link and select "save target as..")

When the file is ready, use the Workspace File Manager to upload the file into Workspace.
When you create a link to your advanced search page, use the following code:
<a href="?pageID=search.html">Advanced Search</a>
Where the search.html is the name of the file you uploaded into Workspace.

For additional information about using the File Manager,
see the "Including content from the Workspace file manager" HOWTO document.


Basic form settings

Required settings for the form are:

<form accept-charset="UTF-8" method="POST" name="AdvancedSearch" action="PublishedService" encoding="UTF-8" enctype="application/x-www-form-urlencoded">
<input name="action" value="advancedsearch" type="hidden">

Implies that this form is for Advanced Search

<input name="file" value="page" type="hidden">
<input name="pageID" value="3" type="hidden">

Tells what page should be shown after the submit (3 = product list)

<input name="advancedsearch.attributes" value="name,publisher,all" type="hidden">
A list of the attributes that are used in this form.

For every attribute, you need to set type and properties:


Attribute Type

<input name="advancedsearch.name" type="text" value="">
This creates an input field for the attribute "name" in which a user can type the search word(s).

<input name="advancedsearch.name.type" value="contains" type="hidden">
This tells that the attribute "name" is a type "contains" attribute.

Possible types are:
contains (if we are looking for a word "auto", the search matches also "automobile", "superauto" etc. strings)
exact (searches only for exact matches, applicable for e.g. item codes)
minvalue (searches only matches that are at least the search string value)
maxvalue (searches only matches that are at most the search string value)


Attribute Properties

<input name="advancedsearch.name.properties" value="name,textInfo2,textInfo3,textInfo4" type="hidden">

Possible properties are:

itemCode Item code
name Product name
price Product price
vat VAT %
unitPrice Unit price
unitType Unit type
packetType Packet type
packetSize Packet size
title1 ... title4 Titles 1-4
slogan1 ... slogan4 Slogans 1-4
textInfo1 ... textInfo4 Info texts 1-4
openField1 ... openField20 Open fields 1-20
supplierId Supplier ID
supplierName Supplier name
supplierItemCode Suppliers product item code
manufacturerId Manufacturer ID
manufacturerName Manufacturer name
manufacturerItemCode Manufacturer item code
picture1Alt ... picture5Alt Picture 1-5 ALT text
file1LinkText ... file5LinkText File 1-5 link text


Additional form settings


Setting the product groups where the search is effective:

<input name="advancedsearch.groupcode" value="software,dvd,music" type="hidden">
You can restrict the searched groups by giving the group codes. The search is effective only to these groups.
<input name="advancedsearch.gid" value="345,533,895" type="hidden">
You can restrict the searched groups by giving the group IDs. The search is effective only to these groups.
<input name="advancedsearch.path" value="/Entertainment/" type="hidden">
You can restrict the searched groups by giving the group path names. The search is effective only to these groups.

Setting the ordering rules for the search results:

<input name="advancedsearch.orderby" value="price" type="hidden">
Tells the product field that is used for ordering.
<input name="advancedsearch.orderby.direction" value="desc" type="hidden">
Tells the direction of ordering. (desc = descending, asc = ascending).


Closing the form

You need to close the form by adding the </form> tag in the end.


Examples

View the example file

Other examples:
http://www.kirjapaikka.fi/PublishedService?pageID=laajahaku.html
http://www.suurikuu.fi/PublishedService?pageID=haku.html
http://kauppa.extremevideo.fi/PublishedService?pageID=haku



<< Back to HOWTO index




Article information

Software: Smilehouse Workspace
Author: Juha Valvanne
About author: Juha Valvanne is working at Smilehouse as a User Interfaces Designer and Project Manager.
Contact author: juha.valvanne@smilehouse.com

HOWTO
Learn how to use Workspace more efficient! Find latest tips and tricks from here


 
© Smilehouse