Login!
Lost password?
 

MODx Bug/Feature Tracker and Feature Requests

Welcome to the MODx CMS Tracker. Please choose the appropriate project from the drop down menu and provide as much information as possible regarding your server environment and browser. Thanks!

FS#940 — MODx adds number to pathalias even when 'Allow duplicate aliases' set to 'yes'

Attached to Project — MODx
Opened by Erik Pols (erikp) - Tuesday, 04 September 2007, 04:43AM
Last edited by Garry Nutting (garryn) - Wednesday, 21 November 2007, 09:43PM
Task Type Bug Report
Category Core Distribution
Status Closed
Assigned To Jason Coward (opengeek)
Operating System All
Severity High
Priority Normal
Reported Version 0.9.6
Due in Version 0.9.6.2
Due Date Undecided
Percent Complete 100%

Details

I have 'Allow duplicate aliases' and 'Use friendly alias path' both set to yes. Although MODx indeed allows duplicate aliases, the alias that is automatically generated when saving a new document, gets an added '1' to the alias when the alias already exists. I can manually change that of course but in a multilingual site it's pretty annoying.

for example if I have
-> Software
-->Product
->More Softward
-->Product

then the second 'Product' gets the alias 'product1'. I'll try to find a bugfix and post it later
This task depends upon

This task blocks these from closing
Closed by  Ryan Thrash (rthrash)
Wednesday, 23 January 2008, 07:38PM
Reason for closing:  Fixed
Comment by Erik Pols (erikp) - Wednesday, 05 September 2007, 06:27AM
The fix is pretty easy and straightforward:

in save_content.processor.php, line 61, this code:

// check if ..
$alias .= $cnt;

should be wrapped in an if-statement like this:

if(!$allow_duplicate_alias){
// check if alias already exists. if yes then append $cnt to alias
$cnt = $modx->db->getValue("SELECT count(*) FROM " . $modx->getFullTableName("site_content") . " WHERE id<>'$id' AND alias='$alias'");
if ($cnt > 0)
$alias .= $cnt;
}

Comment by Jason Coward (opengeek) - Sunday, 23 September 2007, 02:04PM
  • Field changed: Status (Unconfirmed → Implementing)
  • Field changed: Due in Version (Undecided → 0.9.6.1)
  • Field changed: Due Date (Undecided → Undecided)
  • Task assigned to Jason Coward (opengeek)
Thanks for the report and the contributed solution. I will implement this for 0.9.6.1 release.

Comment by Garry Nutting (garryn) - Monday, 19 November 2007, 07:49PM
Jason, did this get implemented for 0.9.6.1?

Comment by Jason Coward (opengeek) - Monday, 19 November 2007, 09:22PM
No garry, I missed it; damn!

Comment by Garry Nutting (garryn) - Wednesday, 21 November 2007, 09:43PM
  • Field changed: Status (Implementing → Requires testing)
  • Field changed: Due in Version (0.9.6.1 → 0.9.6.2)
  • Field changed: Percent Complete (0% → 100%)
No worries - just committed on your behalf as SVN rev 3170.