My site has 5 related product content pickers and i can see from the XML that they all have some data in it. I am trying to get the title of the related product so i can link to it. I can get the link to work using the NiceUrl library but when i try and get the title of the item it returns nothing?
I've never really used GetItem, but it looks like that should work. Does the target product have a field called "title" or are you actually trying to get the @nodeName ? Per this wiki it seems you cannot get the nodeName and other "attributes", only field data.
title is an field i have put as i saw you couldn't get to the @nodeName, i have read that wiki too but thought i was doing something wrong. The picked node does have a title field with something in it but i can inly assume that the GetItem function doesn't work?
<xsl:if test="$currentPage/relatedProduct1 > 0"> <!-- You might need this line to avoid errors when saving --> <xsl:variable name="targetPage" select="umbraco.library:GetXmlNodeById($currentPage/relatedProduct1)"/> <xsl:if test="not($targetPage/error)"> Title: <xsl:value-of select="$targetPage/title"/> </xsl:if> </xsl:if>
GetItem not returning anything
Hi,
My site has 5 related product content pickers and i can see from the XML that they all have some data in it. I am trying to get the title of the related product so i can link to it. I can get the link to work using the NiceUrl library but when i try and get the title of the item it returns nothing?
Can someone point me in the right direction or see if i've been a bit dumb?
Thanks
Chris
Hi Chris,
I've never really used GetItem, but it looks like that should work. Does the target product have a field called "title" or are you actually trying to get the @nodeName ? Per this wiki it seems you cannot get the nodeName and other "attributes", only field data.
-Tom
Hi Tom,
title is an field i have put as i saw you couldn't get to the @nodeName, i have read that wiki too but thought i was doing something wrong. The picked node does have a title field with something in it but i can inly assume that the GetItem function doesn't work?
Do you know a different way i could do it?
Thanks
Chris
Try this:
-Tom
Thanks Tom,
here's my final solution:
Cool, glad it worked...not sure what's up with GetItem.
Also are you duplicating that code block for each picker? You could make one template to handle it all :)
-Tom
is working on a reply...