I've upgraded a solution from dynamicweb 7 to dynamicweb 8. The solution used a notificationsubscriber to extend the breadcrumb on productdetail and productgroup pages. With the API changes in version 8 the extenders also had to change, so I modified it slightly to the one added below. With debugging i'm landing in the notificationsubscriber, but the tags i'm willing to use can't be found, so the output isn't rendered. What could possibly go wrong here?
This is the template tag in (for example) a productlist:
<span class="breadcrumb"><a href="/">Home</a><!--@DwLegend--><!--@Innovadis:BreadcrumbExtender--></span>
This is the code for the notificationsubscriber:
Imports Dynamicweb.Frontend
Imports System.Configuration.ConfigurationManager
Imports Dynamicweb.Extensibility
Imports Dynamicweb
Imports System.Configuration
Imports System.Text
Imports System.Web
Namespace ZoeAndLola.Lib
<Subscribe(Dynamicweb.Notifications.Standard.Page.OnOutput)> _
Public Class INNO_BreadCrumbSubscriber
Inherits NotificationSubscriber
Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Dynamicweb.Extensibility.NotificationArgs)
'TODO: Add code here
'Sample usage of notifications args
'Dim paragraphArgs As Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs = DirectCast(args, Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs)
If Not HttpContext.Current.Request.RawUrl.ToString.ToLower.Contains("/admin/") Then 'uitsluiten dat functies onnodig in admin worden aangeroepen
'If args Is Nothing OrElse args.Length = 0 Then
' Return
'End If
'Dim obj As Object = args(0)
'If Not (TypeOf obj Is Dynamicweb.Rendering.Template) Then
' Return
'End If
'Dim Template As Dynamicweb.Rendering.Template = DirectCast(args, Dynamicweb.Rendering.Template)
Dim template As Dynamicweb.Rendering.Template = TryCast(args, Dynamicweb.Notifications.Standard.Page.OnOutputArgs).template
Dim s = template.TagExists("Innovadis:BreadcrumbExtender")
'If template.TagExists("Innovadis:BreadcrumbExtender") Then
Dim sBreadcrumb As String = ""
Dim sPageID As String = ""
If Not HttpContext.Current.Request.QueryString.[Get]("id") Is Nothing Then
sPageID = HttpContext.Current.Request.QueryString.[Get]("id")
End If
If Not HttpContext.Current.Request.QueryString.[Get]("groupid") Is Nothing Or Not HttpContext.Current.Request.QueryString.[Get]("productid") Is Nothing Then
Dim sMyUrlGroupID As String = ""
If Not HttpContext.Current.Request.QueryString.[Get]("groupid") Is Nothing Then
sMyUrlGroupID = HttpContext.Current.Request.QueryString.[Get]("groupid")
End If
Dim sMyProductID As String = ""
If Not HttpContext.Current.Request.QueryString.[Get]("productid") Is Nothing Then
sMyProductID = HttpContext.Current.Request.QueryString.[Get]("productid")
End If
If sMyProductID <> "" Then
Dim myProduct As eCommerce.Products.Product = eCommerce.Products.Product.GetProductByID(sMyProductID)
If myProduct.Groups.Count > 0 Then
sMyUrlGroupID = myProduct.Groups.Item(0).ID
End If
sBreadcrumb = "<span class=""Legend""> > " & myProduct.Name & "</span>"
End If
Dim myUrlGroup As eCommerce.Products.Group = eCommerce.Products.Group.GetGroupByID(sMyUrlGroupID)
If sMyProductID <> "" Then
Dim sMyProductGroupUrl As String = SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" & sPageID & "&groupid=" & sMyUrlGroupID)
sBreadcrumb = "<span class=""Legend""> > <a href=" & sMyProductGroupUrl & ">" & myUrlGroup.Name & "</a></span>" & sBreadcrumb
Else
sBreadcrumb = "<span class=""Legend""> > " & myUrlGroup.Name & "</span>" & sBreadcrumb
End If
If myUrlGroup.ParentGroups.Count > 0 Then
Dim myParentGroup As eCommerce.Products.Group = myUrlGroup.ParentGroups.Item(0)
Dim sMyParentGroupUrl As String = SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" & sPageID & "&groupid=" & myParentGroup.ID)
sBreadcrumb = "<span class=""Legend""> > <a href=" & sMyParentGroupUrl & ">" & myParentGroup.Name & "</a></span>" & sBreadcrumb
If myParentGroup.ParentGroups.Count > 0 Then
Dim myParentParentGroup As eCommerce.Products.Group = myParentGroup.ParentGroups.Item(0)
Dim sMyParentParentGroupUrl As String = SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" & sPageID & "&groupid=" & myParentParentGroup.ID)
sBreadcrumb = "<span class=""Legend""> > <a href=" & sMyParentParentGroupUrl & ">" & myParentParentGroup.Name & "</a></span>" & sBreadcrumb
If myParentParentGroup.ParentGroups.Count > 0 Then
Dim myParentParentParentGroup As eCommerce.Products.Group = myParentParentGroup.ParentGroups.Item(0)
Dim sMyParentParentParentGroupUrl As String = SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" & sPageID & "&groupid=" & myParentParentParentGroup.ID)
sBreadcrumb = "<span class=""Legend""> > <a href=" & sMyParentParentParentGroupUrl & ">" & myParentParentParentGroup.Name & "</a></span>" & sBreadcrumb
End If
End If
End If
End If
template.SetTag("Innovadis:BreadcrumbExtender", sBreadcrumb)
End If
'End If
End Sub
End Class
End Namespace