Rank: Member
Joined: 6/25/2008(UTC) Posts: 92
|
Does anyone know why hidden categories are showing up when I search our site By Category? Shouldn't hidden categories remain hidden even when searching?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Do you mean the category shows in the category filter dropdown on the search page or that products in a hidden category are showing in search results? If it's the former, then it might be a bug. If it's the latter and the products are not marked as hidden, that is the intended behavior since a product can appear in multiple categories (e.g. one hidden and one not hidden). |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 6/25/2008(UTC) Posts: 92
|
Thanks for your reply, Aaron. The category displays in the category filter dropdown on the search page which does sound like a bug to me also. Regarding active items attached to the hidden category -- if those items are attached to only the hidden category, my opinion is that they should not display until the category has been activated or until they have been associated to an already active category.
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
I looked at the code, and it appears to be a bug. The AddIndentedChildren function in the Category class needs to check the Hidden property of a category before adding it to the list. It doesn't look like this function or its caller, ListFullTreeWithIndents, are used by anything other than the SearchCriteria user control, so I think it's safe to change the code to only show visible categories. Below is a code fix: File: \BVSoftware.Bvc5.Core\Catalog\Category.vb Replace the AddIndentedChildren function with the code below and recompile. The bug fix is commented. Code: Private Shared Sub AddIndentedChildren(ByRef result As Collection(Of System.Web.UI.WebControls.ListItem), ByVal parentId As String, ByVal currentDepth As Integer)
Dim children As Collection(Of Catalog.Category) = Catalog.Category.FindChildren(parentId) If children IsNot Nothing Then For Each c As Catalog.Category In children If Not c.Hidden Then ' <DEVELISYS> BUG fix: only include visible categories </DEVELISYS> Dim spacer As New StringBuilder For i As Integer = 0 To currentDepth - 1 spacer.Append("_") Next Dim li As New System.Web.UI.WebControls.ListItem li.Value = c.Bvin li.Text = spacer.ToString & c.Name result.Add(li)
AddIndentedChildren(result, c.Bvin, currentDepth + 1) End If Next End If End Sub
|
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 6/25/2008(UTC) Posts: 92
|
Aaron - thanks for going above and beyond with your fix post and then cross-posting to the bugs forum. Your help is appreciated!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.