I have all my products in one folder. I render the individual products below "product Group" nodes by selecting them with the ultimate picker (alias=varegruppe ).
The ultimate picker is defined on the "product" document type and is a checkbox list with the "product group nodes"
I use the following xslt to list the products in the product groups they are connected to.
So far so good, but this only works if the product has only one product group selected, example: 1109
If multiple groups are selected, the output from the ultimate picker is like: 1109,1110,1111. And the it breaks
So i would like to call in the cavalry on how to split the output on the above example, so that the products are shown on alle 3 productgroup pages, 1108,1110,1111.
Hope this is clear enough. if not ill try to make it clearer.
As it's a Friday I'm a little slow, but what you basically want to do is to is
* on a product group page, iterate through the subnodes (products) * check that the 'varegruppe' property on the product node contains the id of the current page * if so, display
the following xslt is completely untested, but the "contains" function can check the varegruppe string (1011, 1023, 101) to see if the current page id is present and if so display. You should be able to do this from right within the foreach loop, without having to use an extra xsl:if
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1' and contains(string(data [@alias='varegruppe']), string($thispage))]">
Splitting odes from ultimate picker
Hi
Imcurrently building a small product catalogue.
I have all my products in one folder. I render the individual products below "product Group" nodes by selecting them with the ultimate picker (alias=varegruppe ).
The ultimate picker is defined on the "product" document type and is a checkbox list with the "product group nodes"
I use the following xslt to list the products in the product groups they are connected to.
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']">
<xsl:if test="data [@alias = 'varegruppe'] = $thispage">
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="data [@alias = 'teaser']"/>
</a>
</xsl:if>
</xsl:for-each>
So far so good, but this only works if the product has only one product group selected, example: 1109
If multiple groups are selected, the output from the ultimate picker is like: 1109,1110,1111. And the it breaks
So i would like to call in the cavalry on how to split the output on the above example, so that the products are shown on alle 3 productgroup pages, 1108,1110,1111.
Hope this is clear enough. if not ill try to make it clearer.
Thanks
This should do it, or help point you in the right direction
Dan
As you can see from Dan's post you should use the Split function to achieve your task.
It has been documented here http://our.umbraco.org/wiki/reference/umbracolibrary/split
/Jan
Ok, i get it in theory, but i still cant get it to work. I think maybe its a bit flipped on its head in my case.
The green box are product groups. The red box are products. On each product i check which product groups the product should be shown in.
How would i do this?
Sorry for the newbie questions :)
oh i tried to put in an image, that didnt work to well
image can be found here http://www.proff-art.dk/splitexample.jpg
As it's a Friday I'm a little slow, but what you basically want to do is to is
* on a product group page, iterate through the subnodes (products)
* check that the 'varegruppe' property on the product node contains the id of the current page
* if so, display
the following xslt is completely untested, but the "contains" function can check the varegruppe string (1011, 1023, 101) to see if the current page id is present and if so display. You should be able to do this from right within the foreach loop, without having to use an extra xsl:if
You just made my weekend, thanks. It seems to work
cool. The only thing to remember is that with a check as simple as this you may eventually get false positives.
E.g. 10110 "contains" 1011, as does 10111, 10112 etc etc. If you see this being a problem eventually a few more checks may be required.
Enjoy your weekend ;-)
is working on a reply...