Michel_ VIP
Total posts: 61
05 Jul 2012 02:13

Cobalt Records Modules shows all section records (for one or more types).

I'd like to modify your mod_cobalt_records to display only current category records (according to different criteria, just like your actual component).

So I cloned this module to create another one.

I can find easily the current ItemId.

In _js_res_categories, I can find the related category id (params - category_Itemid)

In _js_record, the categories array is stored.

So, I can filter records according to the right category.

But it's not so easy to do.

Modify the template is not enough. Of course, I can filter in the template.

But records are limited to the 'limit' specified in the module .xml file.

So if I set for example this limit to 10, I can only filter the 10 records...

So I have to use the filter before.

In api.php the records are obtained with this command :

$records = JModel::getInstance('Records', 'CobaltModel');

How to use the filter with this command (or at another place).

Thanks for help.

Last Modified: 02 Mar 2014


Sergey
Total posts: 13,748
06 Jul 2012 00:10

I am not exactly sure why you do all this things. To get list with categories you simply set $cat_id in Api call. You can even set it as JRequest::getInt('cat_id') to make it responsive to current page.

How to use the filter with this command (or at another place).

Which filters? Limit? Or other?

Please tell me what you are trying to achieve, may be there is better solution. Just tell me what is your idea. What you want to show to users and where in the record list or full record.


Michel_ VIP
Total posts: 61
06 Jul 2012 01:22

I just want to display records list (with links) according to category (same as the module mod_cobalt_records do for sections).

In my website, I have only one section with all categories, something like this :

World > Europe > France > Paris

And I use a type for Europe, another one for Asia,...

With mod_cobalt_records, I can only choose section and type(s). So, in my case, I can display the records list for Europe, Asia,.. but not for subcategories (France, Paris, ...).

And I want to display a record list for the corresponding (sub)category (for example in 'Paris', the list with the top 10 most rated, the 5 most recent,..).

In fact, I want to do the same thing the mod_jsc_content_list module did in Mighty Resources (but limited in records titles with links). So, it must be a good idea. :D


Sergey
Total posts: 13,748
06 Jul 2012 05:24

You have to set record mode those categories as "records in category and subcategories" then you place Europe category ID in module and see all records from all it's subcategories.

And the rest is only to create text parameter for module to enter category ID and pass it to API method call.


pepperstreet VIP
Total posts: 3,837
06 Jul 2012 23:07

Sounds like a "small" part of my older idea/feature request topic ;-) I agree with Michel, it should have the same basic features like Resources Content-List. I did not checkout the current release, but I guess that a lot of things are still missing... (no offense, just a reminder!)


Sergey
Total posts: 13,748
07 Jul 2012 07:55

In this particular issue nothing is missing. It even adds few things more. I think Resources could not do what Michel is trying to achieve. It is vice versa. Only Cobalt can do that. It is just the matter of not clear understanding what Itemid is stand for in Joomla. But that is common. I myself spent a lot of time before I coud completely understand it.


Michel_ VIP
Total posts: 61
09 Jul 2012 02:41

Again thanks for your help, Sergey.

I added a new field for the category (simply the category id) in the .xml file.

And added a condition in the module php file (take the category parameter and if not present, use the current category).

But why you don't publish a module like this (equivalent to the Mighty Resources module) ?

For you, it's only 10 minutes to create this module.

Are you worry about performance for a module like this ?


Michel_ VIP
Total posts: 61
09 Jul 2012 02:50

Sergey is right.

Cobalt is much more powerful than Mighty Resources, but I also think some minor things are still missing (like this module...).

With good Cobalt knowledge (and I think this is the main problem, Cobalt is so powerful you have to spend time before using it), you can do about everything you want (of course for CCK).


Sergey
Total posts: 13,748
09 Jul 2012 06:16

Thank you Michel.

Are you worry about performance for a module like this ?

No, it will not influence performance. The answer is simple. There are so many things like that we can add in 10 minuts, but we have no those minutes. I mean we could do that, but other user need something else. And we could do that too.

But we simply did not do it because we not yet had time to do it.

That sound like funny words mix :)

Powered by Cobalt