Since here is the friendliest forum on the planet, I want to ask you one little more thing. I added some checkboxes on the product document type(starterkit) and I want to search based on these properties. As mentioned before on this forum i use the fallowing snippet to get the prevalues.
<xsl:template match="/">
<div id="propertysearch"> <!-- Variable gets the list of values from the datatype --> <xsl:variable name="filterList" select="umbraco.library:GetPreValues('1350')"/> <!-- TODO: This is the ID of the page to redirect to, needs hooking up to a variable --> <form action="{umbraco.library:NiceUrl('1351')}"> <xsl:for-each select="$filterList//preValue"> <input type="checkbox" name="filter" value="{current()}"/> <label for="{@id}"> <!-- <option value="{@id}">--> <xsl:value-of select="current()"/> <!-- </option>--> </label>   </xsl:for-each> <input type="submit" class="filterButton" value="Search Properties" /> </form> </div> </xsl:template>
And on the search result page i call the fallowing xslt;
<xsl:variable name="filterBy" select="umbraco.library:RequestQueryString('filter')" /> <xsl:template match="/" > <div id="products" class="productList" itemscope="" itemtype="http://schema.org/ItemList"> <!-- The following div#invokeXSLT is used by the update script to load the correct xslt when updating the UI --> <div class="invokeXSLT">productList.xslt</div>
Property based product search
Hi,
Since here is the friendliest forum on the planet, I want to ask you one little more thing. I added some checkboxes on the product document type(starterkit) and I want to search based on these properties. As mentioned before on this forum i use the fallowing snippet to get the prevalues.
<xsl:template match="/">
<div id="propertysearch">
<!-- Variable gets the list of values from the datatype -->
<xsl:variable name="filterList" select="umbraco.library:GetPreValues('1350')"/>
<!-- TODO: This is the ID of the page to redirect to, needs hooking up to a variable -->
<form action="{umbraco.library:NiceUrl('1351')}">
<xsl:for-each select="$filterList//preValue">
<input type="checkbox" name="filter" value="{current()}"/>
<label for="{@id}">
<!-- <option value="{@id}">-->
<xsl:value-of select="current()"/>
<!-- </option>-->
</label>  
</xsl:for-each>
<input type="submit" class="filterButton" value="Search Properties" />
</form>
</div>
</xsl:template>
And on the search result page i call the fallowing xslt;
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:include href="productList_product.xslt"/>
<xsl:param name="currentPage"/>
<xsl:variable name="filterBy" select="umbraco.library:RequestQueryString('filter')" />
<xsl:template match="/" >
<div id="products" class="productList" itemscope="" itemtype="http://schema.org/ItemList">
<!-- The following div#invokeXSLT is used by the update script to load the correct xslt when updating the UI -->
<div class="invokeXSLT">productList.xslt</div>
<ul>
<xsl:for-each select="$currentPage/node">
<xsl:variable name="propertyattributes" select="data [@alias = 'categorytag']"/>
<xsl:variable name="searchvalues" select="umbraco.library:Split($filterBy, ',')" />
<xsl:variable name="match">
<xsl:for-each select="$searchvalues/value">
<xsl:if test="contains(concat(',', $propertyattributes, ','), concat(',', string(.), ','))">1</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="count($searchvalues/value) = string-length($match)">
<li><xsl:value-of select="data [@alias = 'categorytag']"/></li>
</xsl:if>
</xsl:for-each>
</ul>
nothing displayed on the search page, any help?
thanks.
is working on a reply...