Listing Search Form Modification

Top  Previous  Next

In this section you may find instructions how to modify the listing search forms:

 

 

By default, the system contains three types of  listing search forms:

1.

Quick search form,

2.

Advanced search form,

3.

My Listings search form.

 

 

The following templates are used for these forms.

1.

The /templates/[Theme Name]/classifieds/quick_search.tpl  file is used to display Quick search form.

2.

The /templates/[Theme Name]/classifieds/search_form.tpl  -   for Advanced search  form.

3.

The /templates/[Theme Name]/classifieds/my_listings_form.tpl  -   for My Listings search  form.

 

See the default  quick search form on the Pic.7. The listing search forms use the syntax which you can see in the notes (Pic.7.) to display the fields. The administrator can change field names, delete existing fields, add new fields to these forms.

 

If you want to modify these forms, follow the instructions given below for the quick search form.

 

quick_search_form

 

Pic.7. Default Quick Search Form.

 

 

Add a Listing Field to a Search Form

 

To display a listing field caption on a search form, use the syntax:

 

{$form_fields.ListingFieldID.caption}.

 

E.g., to display the caption of the 'Beds' field (list type) on the default quick search form, use the syntax:

 

{$form_fields.Beds.caption} (Pic.8.)

 

 

To display search fields, use the syntax:

 

{search property = ListingFieldID template = [Your Template Name]}

 

If you do not specify the template (template = [Your Template Name]), the system will display the default template of a type.

 

 

To add a listing field to the quick search form, e.g., 'Beds' field:

Open the   /templates/[Theme Name]/classifieds/quick_search.tpl file and locate there the code:

 

            <tr>

                    <td width="40">or Zip:</td><td>{search property=Zip template="geo.location.tpl" '}</td>

                    <td width="45">{$form_fields.Price.caption}&nbsp;$ :</td><td>{search property=Price '}</td>

            </tr>

 

This code displays the 'Zip Code' and 'Price' fields (their captions and input boxes) (Pic.8.).

 

After this code insert the code:

 

<tr>

                    <td>{$form_fields.Beds.caption} :</td><td colspan=3>{search property=Beds}</td>

            </tr>

 

This code displays the 'Beds' field (its caption and input box).

 

On the Pic.8. you may see how the 'Beds' field will be displayed on the quick search form.

 

quick_search_form2

 

Pic.8. Added Listing Field.

 

 

Delete a Listing Field from a Search Form

 

If you want to delete a listing field from a search form, find the code which displays the caption and exterior view of this listing field and delete it from the file.

 

 

Create a Page Contained Listing Search Form

 

To create an additional page with a search form, e.g., the 'Power Search' page with the search form contains all listing fields even those which are not included in the advanced search form:

 

Create the 'power_search.tpl'  file in the /templates/[Theme Name]/classifieds/ folder with the code from the /templates/[Theme Name]/classifieds/search_form.tpl  file.

Add the additional fields (their captions and input boxes) to this file. Use the syntax given above (See 'Add a Listing Field to a Search Form').

Go to Admin Panel -> Site Layout -> User Pages

Create the '/power_search/' page where 'URI' = '/power_search/', 'Module' = 'classifieds', 'Function' = 'search_form', Parameters: 'listing_type_id' = 'HomesForSale' , 'form_template' = 'power_search.tpl' .

 

To display this page on your site, place a link with the  '[Your_Site_URL]/power_search/'  URL in any section of your site.

 

 

Add a New Search Form to Each Page

 

To add a new search form to each page of your site, e.g., to make a quick search only by City and State ('Tiny Search' form):

 

Create the  'tiny_search.tpl'  file in the /templates/[Theme Name]/classifieds/ folder with the following code:

 

<form method="post" action="{$GLOBALS.site_url}/search_results">

<table>

            <tr>

                    <td align="left" style="font-weight:bold" colspan="2">Find Homes for Sale</td>

            </tr>

            <tr>

                    <td>{$form_fields.City.caption}:</td><td>{search property=City}</td>

            </tr>

            <tr>

                    <td>{$form_fields.State.caption}:</td><td>{search property=State}</td>

            </tr>

            <tr>

                    <td align="left" colspan="2"><input type="submit" class="button" style="width:80px" value="Find"/></td>

            </tr>

</table>

</form>

 

This code displays the newly created 'Tiny Search' form with the following components: the 'Find Homes for Sale' caption, drop down lists with cities and states and the 'Find' button (Pic.9.).  

 

 

 

To add a new search form to each page of your site, you need modifying   /templates/[Theme Name]/main/main.tpl ,   /templates/[Theme Name]/main/index.tpl:

 

In  the /templates/[Theme Name]/main/main.tpl (the main page) , /templates/[Theme Name]/main/index.tpl (other front end pages)  locate the code:

 

    <div class="pollBlock">

            {module name="poll" function="poll_form"}

    </div>

 

This code displays the 'Poll Block'.

 

After this code insert the lines:

 

    <div class="pollBlock">

            {module name="classifieds" function="search_form" form_template="tiny_search.tpl" listing_type_id="HomesForSale"}

    </div>

 

This code displays the newly created 'Tiny Search' form.

 

Pic.9. shows the tiny search form will be displayed on the main page.

 

tiny_search_form

 

Pic.9. Tiny Search Form on Each Page