Category Filtering
Last Post 12/07/2011 01:53 PM by David Allen. 10 Replies.
Author Messages
David Allen
New Member
New Member
Posts:9
Avatar

--
12/06/2011 01:38 PM
    Currently, when you instantiate the Articles module and set it to filter by category, it ORs together the categories selected. I would like to see a switch in the settings to allow this to be selectable AND/OR so that you can use categories for different purposes.
    David O'Leary
    Efficion Consulting Staff
    Basic Member
    Basic Member
    Posts:151
    Avatar

    --
    12/06/2011 02:23 PM
    In recent versions, we added the ability to specify MustHaveAllCategories (i.e. And) vs. MustHaveOne (i.e. Or) on the backend. Currently this isn't used by any of the released pieces of the interface. We hope to release a Category Tab bar that makes use of the functionality in the next version.
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/06/2011 02:29 PM
    Cool David! Is there anyway to accelerate this development? I could really use this like -- right now ;-)
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/06/2011 02:31 PM
    Conversely -- since I have the source to the categories module -- I could probably figure out how to do it myself... eh?
    David O'Leary
    Efficion Consulting Staff
    Basic Member
    Basic Member
    Posts:151
    Avatar

    --
    12/06/2011 02:45 PM
    The functionality is already there. It's really just a matter of styling it all nicely. The MustHaveOneCategory and MustHaveAllCategories is already released. We've built the Category Tab bar a couple different ways for different clients but want to tweak it some before releasing it. But, if you include the Categories module on the Articles page and then click on a category, it will append the category to the QueryString and that will filter the Articles module by that category as a MustHaveAll.

    So, you could either modify the display listing of Categories or you could copy the rendered code generated by the Categories module and then tweak it to meet your needs until we release the Category Tab Bar.
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/06/2011 03:05 PM
    So... in the code below (from ArticleListBase.ascx.vb)...

     
    Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                Try
                    'TODO: 4.1- Need option to display username or full name or displayed name for author (This can be done with template change)
                    'TODO: 4.1- Search results should include image thumbnail
                    'TODO: 4.1- Get DNN Export and Import functionality working
    
                    If rptArticles Is Nothing And lstArticles Is Nothing Then
                        Exit Sub
                    End If
                    FilterByCategory = Settings("FilterByCategory") = "True"
                    If FilterByCategory Then
                        MustHaveOneCategoryList = Settings("CategoryID")
                    End If
    


    all that I need to do is change

    MustHaveOneCategoryList = Settings("CategoryID")

    to

    MustHaveAllCategoryList = Settings("CategoryID")

    and I am done?
    David O'Leary
    Efficion Consulting Staff
    Basic Member
    Basic Member
    Posts:151
    Avatar

    --
    12/06/2011 03:09 PM
    you never really stated what you were trying to do, but that should cause the module to only show articles that match all of the specified categories.
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/06/2011 03:10 PM
    That is exactly what I want to do. Thanks so much for making this thing so flexible!! You rock David!
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/07/2011 01:15 PM
    David: Is this the only change required to get the AND vs OR behavior? I am not seeing any change in behavior...
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/07/2011 01:46 PM
    OK - Never-mind my last post. I screwed up the fiilename. I've fixed that, and now I am getting this error when I try to logon to the portal:


    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30175: class 'ArticleListBase' and class 'ArticleListBase', declared in 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\18233005\6ae75d98\App_SubCode_Articles.cta_eshu.2.vb', conflict in namespace 'Articles'.

    Source Error:

    Line 9:
    Line 10: Namespace EfficionConsulting.Articles
    Line 11: Public MustInherit Class ArticleListBase
    Line 12: Inherits DotNetNuke.Entities.Modules.PortalModuleBase
    Line 13:

    Source File: C:\Domains\whitewave.303software.net\App_Code\Articles\ArticleListBase.ascx.vb Line: 11

    Perhaps I need to recycle the app pool?
    David Allen
    New Member
    New Member
    Posts:9
    Avatar

    --
    12/07/2011 01:53 PM
    Nevermind... again... Got it working correctly now.


    ---