[use unique alias]alias field add article id on alias

More
12 years 4 months ago #39842 by ggppdk
Hello

i checked and Joomla also forces a unique alias

(unique regardless of category too)

instead of article id it adds a incrementing number :

_2
_3
etc

so there is no simple way to allow this without breaking behavior of unique alias


-- 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 review. Thanks!

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

More
12 years 3 months ago #41221 by dkom
Hello, all!

I have updated FlexiContent to v. 2 and all my site links became broken :(

My SEO component builds path in this way:
site.com/category1_alias/categor ... alias.html

So, I have for example 20 articles with alias "index" in 20 different categories. It may not cause any system confilct and must me allowed, I think.

OK, I understand that Joomla's standard it to have unique aliases, but de-facto standard differs from it.
I think no product must broke anything that worked by years on production.

I hope you'll "broke" this feature as you "fixed" it before. :D

P.S.: FlexiContent v. 2 is really good, I was really wondered full back compatibility with previous version in such flexible product (except alias problem).

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

More
12 years 3 months ago #41231 by ggppdk
Hello

i have tested a fix/improvement:
only require unique alias if content items have:
- same main category
- ?? any secondary category is common
- same language

To test fix/improvement, edit:
administrator\components\com_flexicontent\tables\flexicontent_items.php

and replace:
Code:
// Check for unique Alias $query = 'SELECT COUNT(*) FROM #__content AS i ' .' JOIN #__flexicontent_items_ext AS e ON i.id = e.item_id ' .' WHERE i.alias='.$this->_db->Quote($this->alias) .' AND i.id <> '.(int)$this->id .' AND e.lang_parent_id <> '.(int)$type_ext->lang_parent_id;
with:
Code:
// Check for unique Alias $sub_q = 'SELECT catid FROM #__flexicontent_cats_item_relations WHERE itemid='.(int)$this->id; $query = 'SELECT COUNT(*) FROM #__content AS i ' .' JOIN #__flexicontent_items_ext AS e ON i.id = e.item_id ' .' LEFT JOIN #__flexicontent_cats_item_relations AS rel ON i.id = rel.itemid ' .' WHERE i.alias='.$this->_db->Quote($this->alias) .' AND (i.catid='.(int)$this->id.' OR rel.catid IN ('.$sub_q.') )' .' AND e.language = '.$this->_db->Quote($type_ext->language) .' AND i.id <> '.(int)$this->id //.' AND e.lang_parent_id <> '.(int)$type_ext->lang_parent_id ;


-- 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 review. Thanks!

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

More
12 years 3 months ago #41236 by dkom
Unfortunately this patch did not work for me.

I do not use any language settings (language=all), my article has alias="index", but it has only one secondary category ( =primary directory), and it is totally alone in this category.

And I still have alias="index_13" after saving with alias "index" :(

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

More
12 years 3 months ago #41237 by ggppdk
Hello

-- this is the file does the check for duplicate alias, so you can disable it there by setting (don't do it yet, see below):
$duplicate_alias = array();


-- The given patch above will allow duplicate alias for items:
- if items have different language (not your case)
- if items in different category, (your case)

... about SAME category(-ies), you can see in the query, this:
' AND (i.catid='.(int)$this->id ... OR secondart categories

this means that it checks, for duplicate alias only for items INSIDE SAME CATEGORY !!

-- SO you must have another item WITH SAME alias in SAME category ?? !!

Test this change, (check for main category and not secondaries), replace:
Code:
.' AND (i.catid='.(int)$this->id.' OR rel.catid IN ('.$sub_q.') )'
with:
Code:
.' AND i.catid='.(int)$this->id


-- 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 review. Thanks!

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

Moderators: vistamediajoomlacornerggppdk
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
Save