Fork me on GitHub

Multiple Categories per Module  Bottom

  • When I was looking at the Category Registry part of the Categories module, I was under the impression that 'Property Name' was there so you can have multiple categories per module (ie, a custom module having one category selector box for the "Global" choices and another category selector box for "ActiveStatus" choices). However, the way the categories_mapobj table is set up does not take Property Name into account. Am I misinterpreting the use of Property Name? If I am, what is that field for and will there eventually be a way to have multiple categories per module? If I'm not, am I missing the way to have multiple categories or is there a fix on the way?
  • I guess you can take a look to the 'Quotes' Value Addons module.
    I see that each item supports many categories. But yes, trying to implement something with multiple categories, i still don't know how to identify the respective field (may looking at the parent category, but it's not good) if the property name is not used by CategoryRegistry.

    --
    - Mateo T. -
    Mis principios... son mis fines
  • There definitely has to be a way to implement the Property Name though. For example, lets say I am creating a module and I want each item to be classified under a "Global" category. However, I also want to use the "ActiveStatus" categories to determine whether or not that item is active or not. Or perhaps in the News module, instead of having a seperate field there for pn_published_status, why not just be able to use the "Pending Status Extended" categories? It's just not practical in many cases to look through every category an item is associated with and find the one who's Parent category is "ActiveStatus" or whatever.
  • I can only talk in general terms here because I don't have code to hand, however when you send an object to DBUtil for an insert or update, the categories are specified as an array e.g:

    '___CATEGORIES___' => array('1','2'),

    So for multiple categories just add entries to the array.

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • Inserting/Updating the categories isn't the problem. It's getting them (and just if it isn't clear, I'm not talking about selecting multiple categories within the same general group, but rather Categories from completely different sections of the Categories hierarchy).

    So lets say I have a module with 4 category selector boxes ('Global', 'ActiveStatus', 'YesNo' and 'Pending Status Extended'). Now when I want to update an item in that module I need to specify a selected value for each selector box. Am I to search through all the selected categories for the one who's parent is 'Global' or 'ActiveStatus'? And what if the selected category is more than one sub-category down? Does that mean we have to search all parents, grand-parents, etc? I guess we could make it recursive, but in many cases that just isn't practical and to me isn't user-friendly.

    If we have a field called Property Name (which to the best of my knowledge is not currently being used), why not use it to be able to distinguish different category boxes/types? Just my opinion though. It just seems a lot of the Categories API is quite difficult and far from what PostNuke usually does.

This list is based on users active over the last 60 minutes.