Getting ShopSite Pages to Appear in Search Results

Forum Forums Tutorials Getting ShopSite Pages to Appear in Search Results

This topic contains 0 replies, has 1 voice, and was last updated by  Anonymous 12 years ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #48711

    Anonymous
    Participant

    ShopSite has an extremely powerful search system, but it’s purpose is to search for products so it does not automatically support the return of a content page in the search results, such as a Shipping Policy, Contact Us, or Returns page. However, with some minor custom template changes and a hidden product, you can have a content page appear in your search results along with products.

    For this process to work you create one product for each content page that you want to display and that product’s fields, such as Description and Search Keywords, are populated with the values your vistors may search for. When this product appears in the search results a custom template is used to link to the content page instead of to the product.

    Step 1: Use An Extra Field For The Content Page URL
    We’ll start by adding an extra product field which will contain the filename of the content page. This will be used in the search results when we link to the content page. Under Preferences > Extra Fields > Product Extra Fields, select an unused product field and assign it a name to remind you what the field is used for. In our example we are using Product Field 4 with a name of “Content Page URL”.

    Step 2: Add A Page To Index Our Content Products
    For a product to be searchable in ShopSite it must be assigned to a page. We’re going to add a new page just for these products and use the following settings:

    - Page Name: “Content Page Hidden Products”
    - File Name: “content_page_products.html”
    - Index: [checked] (Must be on so these products are indexed for searching)
    - Google Sitemap Settings: [unchecked] (We do not want this page to appear in the Sitemap)

    Step 3: Update The Product Template To Display The Page URL
    The “[-- DEFINE PRODUCT --]” section of your product template determines what is displayed in the search results when a product matches what a user searches for. Since we want to override the normal product display and link to our content page some changes will need to be made.

    Note: If you are using the “Product Template Override:” field on Preferences > Search Settings > Search Layout, then the template changes detailed here would be made to the template you have listed in that field.

    In your product template, find the “[-- DEFINE PRODUCT --]” section and add the following lines right *after* the “[-- DEFINE PRODUCT --]” line:

    Note: Change “Field4″ in this code to the Field# that you used for your extra product field.

    [-- IF PRODUCT.Field4 --]
    [-- VAR.nopagelink "YES" --]
    <a href="[--PRODUCT.Field4 --]">[-- PRODUCT.Name --]</a>
    [-- ELSE --]
    [-- VAR.nopagelink "NO" --]
    

    Next, add the following line right *before* the “[-- END_DEFINE PRODUCT --]” line of your template:

    [-- END_IF --]
    

    What This Does:
    These code changes cause the template to check for our extra product field. If a filename is there then a link to the content page is displayed. If the extra product field is blank the template continues with the regular product display.

    Step 4: Update The Page Template To Not Display A Page Link
    This step will not be required if you are using a custom template that is not displaying page links in your search results, but if you are displaying page links then you will want to modify your template slightly.

    Note: If you are using the “Link Template Override:” field on Preferences > Search Settings > Search Layout, then the template changes detailed here would be made to the template you have listed in that field.

    Find the “[--DEFINE LINK_TO_PAGE--]” section of your page template. It may look like this:

    [--DEFINE LINK_TO_PAGE--]
    <a href="[-- PAGE.FileName --]">[-- IF PAGE.LinkGraphic --][-- PAGE.LinkGraphic --]<br>[-- END_IF --][-- IF PAGE.LinkText --][-- PAGE.LinkText --]<br>[-- END_IF --][-- IF PAGE.LinkName --][-- PAGE.LinkName --][-- ELSE --][-- PAGE.Name --][-- END_IF --]</a>
    [--END_DEFINE LINK_TO_PAGE--]
    

    You will update the code with 2 lines before the link and 1 line after, as shown here:

    [-- DEFINE LINK_TO_PAGE --]
    [-- IF VAR.nopagelink "YES" --]
    [-- ELSE --]
    <a href="[-- PAGE.FileName --]">[-- IF PAGE.LinkGraphic --][-- PAGE.LinkGraphic --]<br>[-- END_IF --][-- IF PAGE.LinkText --][-- PAGE.LinkText --]<br>[-- END_IF --][-- IF PAGE.LinkName --][-- PAGE.LinkName --][-- ELSE --][-- PAGE.Name --][-- END_IF --]</a>
    [-- END_IF --]
    [-- END_DEFINE LINK_TO_PAGE --]
    

    What This Does:
    This code checks a variable called “nopagelink” to see if it’s set to “Yes”. If it is, then the page is one of our content pages and we want to bypass the display of the default link since we are displaying it with our custom product template.

    Step 5: Add A Content Page
    Now that our templates are ready, the next step is to add the content page. In our example we have added a paged called “Privacy Policy” and set it’s File Name field to “privacypolicy.html”. This will be the page we link to in the search results.

    Step 6: Add A Product To Link To Our Content Page
    The next step is to add a product and configure it for our search results. The following settings were used in our example:

    - Product Name: “Privacy Policy” (Set to the name of our content page from Step 5)
    - Search Destination: “Store”
    - Content Page URL: (Product Field 4): “http://www.yourdomain.com/privacypolicy.html” (Our extra field, set to the URL and filename of the content page from Step 5)
    - Template: [the product template edited in Step 3]
    - Assign Product to Pages: Assign to the “Content Page Hidden Products” page from Step 2.

    Note: Since this product is what will trigger your content page to appear in the search results, be sure to fill in the “Product Description:” field with the text of your content page and fill in the “Search Keywords:” field (if you have ShopSite Pro) with any additional keywords that visitors may search for which you want this page to appear for.

    Step 7: Publish & Test
    Once the steps above are complete you will just need to publish your store for the changes to take effect and then search for one of the words that appear in your product. The product will show up in the search results with a link to your content page.

    For a working example, visit the following page on our sample store:
    http://shopsite-demo.lexiconn.com/content_page_example.html

    On that page, search for “policy” in the search form and the “Content Page Example” page will appear in the search results.

    Additional Reading
    For additional information on ShopSite’s search systemn and what can be done with it you may be interested in these tutorials:

    ShopSite Search and Order Anywhere
    http://support.lexiconn.com/news/viewtopic.php?t=342

    Using ShopSite Search for Dynamic Looking Pages

    http://support.lexiconn.com/news/viewtopic.php?t=338

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.