Scenario: Product listing with associated Tags. Each product also hace a product category associated which is stored as a tag. I have managed to get output of all the tags in a tag cloud but are unable to get a list of the categorys (tag groupnames) for some reason. Any ideas please...
Further to the above; I have found that I made a mistake and changed the tag folder structure. This adjusted and I can get a second list of current tags but are still unable to list the categories. Whenever I us getAllTagsInGroup I get an error thrown however getAllTags works and returns the tag list.
tag cloud by group name
Scenario: Product listing with associated Tags. Each product also hace a product category associated which is stored as a tag. I have managed to get output of all the tags in a tag cloud but are unable to get a list of the categorys (tag groupnames) for some reason. Any ideas please...
<xsl:variable name="currentStore" select="umbraco.library:GetXmlNodeById(Foodstuffs.library:GetCurrentRegionId())"/>
<xsl:variable name="productsAll" select="$currentStore/ancestor-or-self::*[count(./Promotions/ProductPromotion)>0]/Promotions/ProductPromotion [umbraco.library:DateGreaterThanOrEqual(validEndDate, $currentDate) and umbraco.library:DateGreaterThanOrEqual($currentDate, validStartDate)]"/>
<xsl:variable name="products" select="$currentStore/ancestor-or-self::*[count(./Promotions/ProductPromotion)>0]/Promotions/ProductPromotion [umbraco.library:DateGreaterThanOrEqual(validEndDate, $currentDate) and umbraco.library:DateGreaterThanOrEqual($currentDate, validStartDate) and contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))]"/>
<xsl:variable name="productscat" select="$currentStore/ancestor-or-self::*[count(./Promotions/ProductPromotion)>0]/Promotions/ProductPromotion [umbraco.library:DateGreaterThanOrEqual(validEndDate, $currentDate) and umbraco.library:DateGreaterThanOrEqual($currentDate, validStartDate) and contains(Exslt.ExsltStrings:lowercase(./category), Exslt.ExsltStrings:lowercase($filter))]"/>
<!-- START TAG CLOUD -->
<xsl:variable name="numberOfRecords" select="count($products)"/>
<xsl:value-of select="$numberOfRecords"/>
<br/>
<p>TAGS</p>
<xsl:if test="number($numberOfRecords) >0">
<xsl:variable name="commaListofTags">
<xsl:for-each select="$productsAll/tags">
<xsl:value-of select="concat(.,',')"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$commaListofTags"/>
<p>TAG</p>
<article class="clear martop20">
<div class="curved10 brd4px tagCloudGeneric rel">
<a class="curved5 sortButton" href="/promotions-competitions/?numberPerPage={$numberPerPage}">Show All</a>
<p>
<xsl:for-each select="tagsLib:getAllTags()/tags/tag[@group = 'ProductPromotion']">
<xsl:if test="contains(Exslt.ExsltStrings:lowercase($commaListofTags),Exslt.ExsltStrings:lowercase(.))">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(umbraco.library:NiceUrl($currentPage/@id),'?numberPerPage=',$numberPerPage,'&filter=',.)"/>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@nodesTagged > 5">
<xsl:value-of select="string('tagweight5')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('tagweight',@nodesTagged)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</p>
<div class="clear">
<xsl:value-of select="''"/>
</div>
</div>
</article>
<!-- END TAG list -->
<!-- START CATEGORY LIST -->
<P>CATEGORY</P>
<xsl:variable name="numberOfRecordscat" select="count($productscat)"/>
<xsl:value-of select="$numberOfRecordscat"/>
<br/>
<p>CATEGORY</p>
<xsl:variable name="commaListofcat">
<xsl:for-each select="$productsAll/category">
<xsl:value-of select="concat(.,',')"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$commaListofcat"/>
<p>CATEGORY LINKS</p>
<article class="clear martop20">
<div class="curved10 brd4px tagCloudGeneric rel">
<a class="curved5 sortButton" href="/promotions-competitions/?numberPerPage={$numberPerPage}">Show All</a>
<p>
<xsl:for-each select="tagsLib:getAllTagsInGroup('commaListofcat')/tags/tag[@group = 'ProductPromotion']">
<xsl:if test="contains(Exslt.ExsltStrings:lowercase($commaListofcat),Exslt.ExsltStrings:lowercase(.))">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(umbraco.library:NiceUrl($currentPage/@id),'?numberPerPage=',$numberPerPage,'&filter=',.)"/>
</xsl:attribute>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@nodesTagged > 5">
<xsl:value-of select="string('tagweight5')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('tagweight',@nodesTagged)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</p>
<div class="clear">
<xsl:value-of select="''"/>
</div>
</div>
</article>
<!-- END CATEGORY tag list -->
Further to the above; I have found that I made a mistake and changed the tag folder structure. This adjusted and I can get a second list of current tags but are still unable to list the categories. Whenever I us getAllTagsInGroup I get an error thrown however getAllTags works and returns the tag list.
<p>CATEGORY</p>
<xsl:variable name="commaListofcat">
<xsl:for-each select="$productsAll/tags">
<xsl:value-of select="concat(.,',')"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$commaListofcat"/>
<p>
<xsl:for-each select="tagsLib:getAllTags()/tags/tag[@group = 'ProductPromotion']">
<xsl:if test="contains(Exslt.ExsltStrings:lowercase($commaListofcat),Exslt.ExsltStrings:lowercase(.))">
OK by removing [@group = 'ProductPromotion'] I was able to get a list of categories out, dunno if it right completely but worked.
is working on a reply...