This is because the product page is just a virtual node in Merchello so it doesn't sit within your sites content tree, so in theory doesn't have an ancestor.
I haven't tried this myself but I think if you associate a node from within your Umbraco content tree as a parent node on the virtual product node, then you should be able to use things like AncestorsOrSelf like your doing within your header. You can do this by hooking into an event on the ProductContentFactory
Im totally new to umbraco and merchello so this might be a stupid question.
Where is the ProductContentFactory located?
I dont seem to have the ProductContentFactory anywhere in my Solution when I search for it and I cant find anything about it on https://merchello.readme.io/
The ProductContentFactory is just the class which exposes the event. You need to create your own class which inherits from Umbraco's ApplicationEventHandler and then override the ApplicationStarting method and hook up your event handler as shown in my previous comment
Access header/footer content on ftProduct
I made two partials (footer and header) which I want to render on all pages.
I have added FastTrack to my site by following the "Integrating Merchello Into An Existing Website" video.
They way I get content on a partial is like they do in the umbraco template:
The content from my partials work on all other FastTrack views but not the ftProduct
How do I make ftProduct able to get that content?
Hey Jonas,
This is because the product page is just a virtual node in Merchello so it doesn't sit within your sites content tree, so in theory doesn't have an ancestor.
I haven't tried this myself but I think if you associate a node from within your Umbraco content tree as a parent node on the virtual product node, then you should be able to use things like AncestorsOrSelf like your doing within your header. You can do this by hooking into an event on the
ProductContentFactory
Let me know if this works for you :)
Cheers, Tom
Hi Tom,
Im totally new to umbraco and merchello so this might be a stupid question.
Where is the ProductContentFactory located?
I dont seem to have the ProductContentFactory anywhere in my Solution when I search for it and I cant find anything about it on https://merchello.readme.io/
Hey Jonas,
It's located in the
Merchello.Web.Models.VirtualContent
namespace. Although I've just had a look and it looks like the FastTrack starterkit already does this: https://github.com/Merchello/Merchello/blob/f3dd636fb3449d58d82ecd178b2ce9b1093c9615/src/Merchello.FastTrack.Ui/UmbracoEventHandler.cs#L115 so that might mean setting the parent doesn't mean those methods work start to work :( Maybe set a breakpoint in your product view and double check the Parent property isn't null.Yea to me it would seem like something they already thought of.
I would still like to try your suggestion out though, Im just having trouble understanding umbraco/merchello.
The way I installed merchello was to go to Umbraco > Developer > Packages > Install local
And here I uploaded the Merchello 2.5.0.zip which I got from: https://our.umbraco.org/projects/collaboration/merchello/
I have looked everywhere and I dont have the ProductContentFactory.cs file.
When I look at https://github.com/Merchello/Merchello/ I can see it has the file in src\Merchello.Web\Models\VirtualContent
Shouldn't I have the whole "src" folder + files in my project as well?
The ProductContentFactory is just the class which exposes the event. You need to create your own class which inherits from Umbraco's ApplicationEventHandler and then override the ApplicationStarting method and hook up your event handler as shown in my previous comment
https://our.umbraco.org/documentation/reference/events/Application-Startup
https://our.umbraco.org/documentation/getting-started/Code/Subscribing-To-Events/
Cheers,
Tom
is working on a reply...