list sister categories like subcategories in category_sub...

More
11 years 8 months ago - 11 years 8 months ago #33915 by gcprnet
On my site I have a category where in the top I display all it's subcategories (ouput of category_subcategories_html5.php). Now I want to have the same output on top of my subcategories. How can I get category_subcategories_html5.php to show sister categories instead of subcategories? I tried to play around with $this->categories but this is the wrong level.
In other words how can I change the loop
Code:
foreach ($this->categories as $sub) :
into something like
Code:
foreach ($this->paentcategory->categories as $sub) :
or is this a completely wrong approach?
It would be really great if anyone could point me into the right direction here.
Last edit: 11 years 8 months ago by gcprnet.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #33925 by ggppdk
You could make an SQL query in #__categories table using $this->category->parent_id
Code:
$query = 'SELECT DISTINCT *,' . ' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', sc.id, sc.alias) ELSE sc.id END as slug' . ' FROM #__categories as sc' . ' WHERE sc.parent_id = '. (int)$this->category->parent_id $this->_db->setQuery($query); $pears = $this->_db->loadObjectList();

Or also use this (which will also check ACCESS Level)
Code:
$pears = $this->getModel()->_getSubs($this->category->parent_id);

But note the 2 above suggestions will not give you assigned items and thumbnails

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34181 by gcprnet
Thanks a lot. It works quite well except for the limitation you mentioned about items. Is there a simple way to retrieve the number of assigned items to each sister category?
I want to display an index of sister-categories with the number of items in each sister displayed in brackets behind it. eg:
sister-category(8) other-sister-cat(2) yetanother-sister(9)
just in the way child categories (and the number of items in them) can be displayed in parent categories.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34194 by ggppdk
Currently the methods in category model do not accept a speciic category id, it is possible to update them but now

-- bug-fixes (for v2.0.1),
-- J3.0 support + huge performance improvements for large sites 50,000 articles+ (v2.1)

are the priority

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #34197 by gcprnet
No problen, then my editor will just have to live without the numbers in brackets :-D

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 1.177 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline