Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • rich hamilton 117 posts 136 karma points
    Sep 17, 2012 @ 18:55
    rich hamilton
    0

    Product Search

    I have styled my product listings, but want to have a search from a text box to return products as search results.

    I can do this using xslt search, but has anyone done this already? is there a simple XSLT I can use with the same styling as the Teacommerce starter kit so that I have the ADD TO CART buttons already linked up and working.

     

    Many thanks

  • Rune Grønkjær 1372 posts 3103 karma points
    Sep 18, 2012 @ 08:06
    Rune Grønkjær
    0

    I have done this a couple of times. I'm using Umbraco Examine and the uComponent xslt search helper methods, which works fine.

    Here you can read how to set up examine:
    http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx

    I use this small piece of xslt for my search form:

    <xsl:variable name="q" select="umbraco.library:RequestQueryString('q')"/>
          <xsl:variable name="searchPageId" select="$currentPage/ancestor-or-self::Lang/SearchPage/@id" />
          <xsl:if test="string($searchPageId) != ''">
        
            <form action="{umbraco.library:NiceUrl($searchPageId)}" method="get">
              <input type="text" name="q" class="searchQ" value="{$q}" />
              <input type="submit" class="btn" value="{umbraco.library:GetDictionaryItem('Form_Search')}" />
            </form>
            
          </xsl:if>

    And this is how I get the search result:

    <xsl:variable name="q" select="umbraco.library:RequestQueryString('q')"/>
      <xsl:variable name="searchNodes" select="ucomponents.search:QuickSearch($q, false(), 'ProductSearcher')"/>

    Now you have a bunch of products, or whatever and can display them on the website

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft