Screen: ShopSite > Merchandising > Custom Templates

Creating a Custom Search Template

Custom search templates allow you to control the appearance of search results pages in your store. Like a page template, a search template controls the page-wide settings, but other templates can affect the appearance of links and product listings. The search settings allow you to set an override search-results product and page link template to keep a consistent look on your search pages. When designing a search template, it may be a good idea to design an accompanying Page template with a Link To Page definition, and a Product template, to be used in conjunction with your Search template.

See the Custom Template Tutorial for more detailed information about creating ShopSite Custom Templates.

To Create a Search Template:

Search templates are essentially HTML documents which contains special tags to retrieve information from your ShopSite database. When designing a search template, you can use your favorite HTML editor to get the look you want, then substitute in the custom template tags in the appropriate places.

1. Get Acquainted with ShopSite

You will find it easier to design a custom template if you're at least somewhat familiar with how ShopSite works, both from a customer and merchant perspective. It is especially important to become familiar with the features and function of the search tool, product templates, and page templates.

2. Study the Examples

Look over the custom template specification to see the tags that are available. It will be one of your primary references while creating templates, or you can use the short version once you have the hang of it.

You may also want to look at the default search template (you can copy it into your custom templates using the Copy ShopSite Template button) and see how it works.

3. Create Your Template

You can use any text editor or HTML editor to create your template. If you are using a WYSIWYG editor, enter the custom template tags as plain text. Some editors may complain about or not allow you to put the DEFINE and END_DEFINE tags outside the html opening and closing tags, but your template will not work properly unless they are there.

Save your template with a descriptive name and in a location where you will be able to find it. Custom templates do not require any file extension, although your editor may.

4. Upload Your Template

Once your template is ready for testing, upload it to your store by going to the Merchandising > Custom Templates screen, finding the Search Templates section, and clicking on the Upload Template button. Enter the local path or Browse... for your template file. You may optionally indicate a different filename for the template on the server, then click Upload File.

You can also use FTP to upload the template to the correct directory. Keep these points in mind:

5. Test Your Template

Once you have uploaded the template, you should test it by selecting it as the template in the Preferences > Search Settings > Search Layout screen. You will probably not want to test the template on a live store, in case something doesn't work the way you expected it to. Be sure to test all the Search Layout and Content features to make sure they work properly.

  1. Enter values for all the fields used by the template.
  2. Go to the store and view the search page in a browser. Verify that all the search page elements are there and that the layout looks the way you planned.
  3. View the search page using other browsers that customers might use, to make sure the page looks okay in all browsers.
  4. Delete the values for some of the fields used by the template, then reload the search page and make sure it still looks okay.
  5. Check the HTML of the output page by running it through an HTML validator, such as http://www.htmlhelp.com/tools/validator or http://validator.w3.org.
  6. View the source of the output page. If the ShopSite parser did not recognize a tag, or if a database field was empty, it replaced the custom template tag with an HTML comment tag containing information about the problem, like this:
  7. <!-- VAR ASPARAGUS IS NOT DEFINED -->

Make any necessary changes and test the template again, then tell the merchant that it is available. The merchant should be able to select the template from the Preferences > Search Settings > Search Layout screen


ShopSite Help and Resource Center
Last updated: March 01, 2010
Give Feedback


ShopSite Shopping Cart Software