Build all links based on main category

More
5 years 2 weeks ago #76233 by wiebe
Hi there,

I have been struggling with this for a long time now.
Maybe I have missed something but I fail to understand how I can force all links to the main category instead of the category where they are opened.

The default behaviour is - as I can see it now - all article links displayed in the home category are opened following $item->categoryslug which for some strange reason is 'home' and not the main category as i would consider logical.
I would say an article with main category 'sport' should open in the sport category menu page.

I can see now this issue is solved regarding the cannonical link... but I have not found yet how to get this link through FlexicontentHelperRoute::getItemRoute.

Is there a solution for this... without having to hack myself into the code?

Cheers... can't wait for the pro version and keep up the excellent work.

Wiebe

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

More
5 years 2 weeks ago #76234 by wiebe
This would be my solution now:

foreach ($item->cats as $icat) {
if ($icat->title==$item->maincat_title) {
$catslug = $icat->slug;
}
}
$link_url = $custom_link ? $custom_link : JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $catslug, 0, $item));

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

More
5 years 2 weeks ago - 5 years 2 weeks ago #76235 by ggppdk
Hello

are your items assigned to a secondary category 'HomePage' or similar purpose category ?

then if 'home' is a menu item alias is pointing to the category 'HomePage'

then 'home' menu item alias will be preferred

Maybe this will work
Go to plugins manager and filter by system plugin
Then open advanced route plugin, inside select to make category 'HomePage' "Unrouteable"
- the above means that no homepage will not appear inside URLs (if possible)


-- 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...
Last edit: 5 years 2 weeks ago by ggppdk.

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

More
5 years 2 weeks ago #76245 by wiebe
Great... this really works!

Thank you very much!

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

More
5 years 2 weeks ago #76246 by wiebe
Having said that... this solution does not work for situations where you have mixed links (from category and subcategories) in your category view.
Maybe - for future versions - while there are already fields like $item->maincat_title and $item->maincat_alias, the field $item->maincat_slug should be considered too.
That would make things a lot easier.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.277 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