Unique alias checker?

More
11 years 11 months ago #37252 by rubenreyes
Hello

When working with SEF components like AceSEF, we find situations where duplicate URLs are created because items in Flexicontent have the same alias.

I was wondering if there is a way (or if you can add to your future features list) to have a javascript function that performs the following:

- Generate and show the alias of the item based on the title in the browser (no wait for item to be saved)
- Check that the item alias is unique at least in the categories where the item is located (consequently, maybe this check would need to be triggered if the categories change)
- If the alias is already in use, add a suffix or numeral to the alias

Thank you!

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

More
11 years 11 months ago #37263 by ggppdk
Replied by ggppdk on topic Unique alias checker?
Hello,
we could append the item id when a duplicate alias is detected
Test this:

in file:
administrator/components/com_flexicontent/tables/flexicontent_items.php
find lines about 372-375:
Code:
// insert into #__flexicontent_items_ext table $type_ext->$frn_key = $this->id; $ret = $this->_db->insertObject( $this->_tbl_join, $type_ext, $this->_frn_key ); }

and after them add:
Code:
$query = 'SELECT COUNT(*) FROM #__content WHERE alias='.$this->_db->Quote($this->alias).' AND id <> '.(int)$this->id; $this->_db->setQuery($query); $duplicate_aliases = (boolean) $this->_db->loadResult(); if ($duplicate_aliases) { $query = 'UPDATE #__content SET alias='.$this->_db->Quote($this->alias.'_'.$this->id).' WHERE id='.(int)$this->id; $this->_db->setQuery($query); $this->_db->query(); }


-- 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.532 seconds
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