Announcement

Collapse
No announcement yet.

I need to manually customise the search tool to provide much more sophisticated se...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I need to manually customise the search tool to provide much more sophisticated se...

    I need to manually customise the search tool to provide much more sophisticated searching for my customers.

    Creating Multiple Search Tools

    The advanced search in SellerDeck is a powerful tool but there is a limitation in that SellerDeck will only ever generate a single search form on a single search page. This is limited if you have two different types of product in your online store and you would like to search on each product type individually.

    In order to generate your own multiple search forms, you will first need to allow SellerDeck to get as far as it can automatically. For example, you might have an online store that has one section of DVDs and one section of CDs. Each DVD may have a 'Director' property whereas each CD may have a 'Artist' property.

    You can set up the 'Searchable Properties' tab to search on these two properties.

    Which will automatically create a corresponding search page.

    If you now upload this catalog (or go to 'Web | Generate Web Site') it will generate an HTML file called 'search.html' and a file called 'customsearch.fil' which you will find in your Site1 (or equivalent) directory. These are the files that you will need to customise.

    Finally, go to 'Settings | Search Settings | Search Options' and un-check where it says 'Catalog Maintains Search Page'. This will mean that SellerDeck will no longer create any more search page HTML or a customsearch.fil file; even if you make a change to the search settings in the application. You are now able to customise these files to your exact specifications.

    Editing the Search Page HTML

    'search.html' is now a totally complete, fully functional HTML page that can be opened in any visual HTML editor such as 'Dreamweaver'.

    When you open up this file for editing, please take note of the following:

    The <form></form> tags of the search form are located right at the top and bottom of the main area of the page. Therefore if you are going to create multiple search forms on the same page, you will have to duplicate and relocate the <form…> and </form> tags to surround each separate HTML form.

    You will need to ensure that any <input type="hidden"> elements are included correctly in each search form.

    You could begin by rearranging the HTML to create an independent search form to look something like this:

    <p>What director are you looking for?</p>
    <form method="get" action="http://your.URL/cgi-bin/ss000001.pl">
    <input type="hidden" name="RANDOM" value="NETQUOTEVAR:RANDOM" />
    <input type="hidden" name="PAGE" value="SEARCH" />
    <select size="1" name="S_Director1_0">
    <option value="Baz Luhrmann" selected>Baz Luhrmann

    ...

    ...

    <option value="Stephen Spielberg">Stephen Spielberg

    </select>
    <input type=SUBMIT name=ACTION value="Search">
    </form>

    Notice that two hidden input fields are required to get the Perl to treat the form correctly.

    Editing the 'customsearch.fil' files

    This online search will not work yet as we still need to create a 'customsearch.fil' file just for this form to use.

    When you open up customsearch.fil in Wordpad, you get something like this:

    1

    Price!PR

    Text!SS!TB

    And

    Text Property!S_Director1_0

    And

    Text Property!S_Artist1_1

    And

    (In Notepad, the line breaks will appear as black blobs)

    This file tells the online search which values to look for in the catalogue and how the results are to be combined with each other.

    A breakdown of this file is as follows:




    To edit the above 'customsearch.fil' file to work with an online form that is only looking for 'Directors', you will need to change it to the following:

    1

    Text Property!S_Director1_0

    And then save it as something like 'customsearch2.fil'. The file name must be of the form 'customsearch#.fil'.Ensure there are no blank lines at the bottom of the file.

    In order to get your new search form to look for this 'customsearch#.fil' file you need to add a line of code to the search tool of the following form:

    <input type=HIDDEN name="SN" VALUE="#">

    Where '#' is the number used in the 'customsearch#.fil' file.

    If you did save the file as 'customsearch2.fil', the HTML form code in the search page will now look like the following:

    <p>What director are you looking for?</p>

    <form method="get" action="http://your.URL/cgi-bin/ss000001.pl">

    <input type="hidden" name="RANDOM" value="NETQUOTEVAR:RANDOM" />

    <input type=HIDDEN name="SN" VALUE="2">

    <input type="hidden" name="PAGE" value="SEARCH" />

    <select size="1" name="S_Director1_0">

    <option value="Baz Luhrmann" selected>Baz Luhrmann

    ...

    ...

    <option value="Stephen Spielberg">Stephen Spielberg

    </select>

    <input type=SUBMIT name=ACTION value="Search">

    </form>

    In order to have SellerDeck to upload this new file, you will need to add it into the list in 'Design | Additional Files'.

    This technique can be expanded to create multiple search pages, each one with a different search tool on it.Remember to add any additional search pages to the 'Design | Additional Files'list in order for them to be uploaded. Note that SellerDeck will not automatically link to any custom written search pages so you will have to write your own HTML to include these.

    Joining Search Terms Together in Different Ways

    You can also edit the 'customsearch.fil' file to join the search terms together in more complex ways.For instance, in the case of a catalogue of films, you may wish people to choose either the director or the star of the movie they want, and then choose what genre (Thriller, Comedy etc.) of film they are interested in. E.g. "Find all action films starring Harrison Ford or directed by Steven Spielberg."

    If you set up 'Director', 'Star' and 'Genre' as custom properties and set up the 'Searchable Properties' tab to search on them, the 'customsearch.fil' file generated would look something like the following:

    1

    Text!SS!TB

    Text Property!S_Director1_0

    And

    Text Property!S_Star1_1

    And

    Text Property!S_Genre1_2

    And

    This file would still search on keywords, and would only find films that contain the director AND the star AND the genre chosen. You could make the 'Director' and 'Star' fields both optional (to allow people to search on either) but you could not search on the director OR the star at the same time, and then look for the genre.

    However, you can do this by changing 'customsearch.fil' to something like the following:

    1

    Text Property!S_Director1_0

    Text Property!S_Star1_1

    Or

    Text Property!S_Genre1_2

    And

    This code removes the references to the keyword search (allowing you to remove the keyword search box from the search page) and changes how the search properties are joined together. Online, the search would act on this file in the following way:

    1. It would firstly see line 2 and find all the films of the chosen director (e.g. Steven Spielberg). It makes a list of them and stores them this list in its memory

    2. It then would read line 3 and find all the films starring the chosen star (e.g. Harrison Ford) and adds this list to the director list and holds it in its memory.

    3. The 'Or' in line 4 tells the search to combine both lists into one. If it was an 'And' then the search at this point would disregard all films starring Harrison Ford that were not directed by Steven Spielberg (and vice versa)

    4. The search reads line 5 now and finds all the films of the chosen genre (e.g. Action), makes a list of them and stores them in its memory.

    5. The 'And' in line 6 means that it will firstly compare the genre list with the director and star list, keeping the products that match. It disregards all the products that do not fulfil either criteria.

    6. The products that match the required criteria are then displayed in the results page.

    Remember that the 'And' or 'Or' command refers to how the preceding line is to be combined with the results gathered so far.
    Attached Files
Working...
X