ShopSite Tip: Removing Page Links from Search Results

We’ve written blog posts and tutorials on the ShopSite Search system a few times in the past, but today we wanted to review a topic that comes up pretty often:  How to remove the page links from search results.

The stock search templates will display your products as well as links to the pages those products are assigned to, but what if you want to show just the products without the page links?  This post will explain how to do that with a couple of settings and template changes.

Link Template Override

On the Merchandising > Custom Templates > Page/Product screen create a new Page template with a name of “search_nopagelink”.  Edit the new template and configure the code to be just the following:

[--DEFINE LINK_TO_PAGE--]
# No Page Links
[--END_DEFINE LINK_TO_PAGE--]

This new template will be what controls the display of the link.

On the Preferences > Search Settings > Search Layout screen enable the “Link Template Override:” checkbox and in its template drop-down select the “search_nopagelink” template that you just created.

But It’s Still There!

If the link is still appearing for some of your products, check the product’s Search Destination field and see if it’s set to “More Info”.   That will be on the Edit Product Info screen.   Change it from “More Info” to “Store” and the link will go away. (Your product’s name and image will still link to it’s More Info page unless you have a custom template that isn’t coded to do that.)

“Result Pages” Text

The changes above are all you need to do to remove the page links, but you may have just 1 more change left to clean up the search results.

Some search templates display a label for the page links, which defaults to the text of “Result pages”.  If you don’t see that text (or any other label for the page links that appears out-of-place) then your change is complete.  However if you do see that text here are the steps to remove it:

  1. Check the Preferences > Search Settings > Search Page Layout > “Search Template” field to see which search template your store is using.
  2. Edit that template (or make a copy of the stock version if you don’t already have a custom version)  on the Merchandising > Custom Templates > Advanced > Search Templates screen.
  3. Find the line that contains “[–Store.SearchResultPage –]” and either remove that template tag or place a “#” as the first character on the line to comment it out of the code.
  4. If you had to make a copy of the stock template, go back to the Preferences > Search Settings > Search Page Layout > “Search Template” field and set it to the name of the template that you created.

The “[–Store.SearchResultPage –]” tag is what displays the “Result pages” text so by removing the tag the text will no longer display in the search results.

Using Columns?

If you are using a template that displays your search results in columns, this method of hiding page links will not work correctly for you since blank columns will appear where the page links would normally be.  ShopSite has an article here with sample code for hiding page links while cleanly displaying the products in columns:

http://www.shopsite.com/templates/cookbook/search-columns.shtml

..

For suggestions on configuring ShopSite Search and more examples of what you can do with custom search templates you may be interested in viewing these articles:

Looking for a web host that understands ecommerce and business hosting?
Check us out today!

Leave a Reply