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

More
11 years 1 month 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...

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

More
11 years 1 month 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
11 years 1 month 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...

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

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