Blog Sections Open

Allowing Duplicate Aliases Only Across Different Parents

Duplicate aliases can be useful in catalog structures, but only if the system still blocks collisions inside one parent branch.

The donor patch addressed a real catalog need: allow the same alias to appear under different parents, but still prevent two siblings from producing the exact same final URL.

Automatic Alias Guard

if ($modx->db->getValue("SELECT COUNT(id) FROM " . $tbl_site_content . " WHERE id<>'$id' AND parent=$parent AND alias='$alias'") != 0) {
    $cnt = 1;
    $tempAlias = $alias;
    while ($modx->db->getValue("SELECT COUNT(id) FROM " . $tbl_site_content . " WHERE id<>'$id' AND parent=$parent AND alias='$tempAlias'") != 0) {
        $tempAlias = $alias . $cnt;
        $cnt++;
    }
    $alias = $tempAlias;
}

Manual Alias Guard

The second half of the donor solution validated manually entered aliases under the same parent and stopped the save with a manager alert when a sibling conflict existed.

Why This Matters

  • Catalog branches often need repeating product aliases under different sections.
  • Sibling collisions still create duplicate URLs and broken routing.
  • The right scope for alias uniqueness is often parent + alias, not the entire tree.

If you rely on duplicate aliases, test both automatic and manually entered alias flows. Fixing only one path leaves editors with inconsistent behavior.

Newer post

Allowing Duplicate Aliases Only Across Different Parents

Duplicate aliases are useful when two different branches share the same product naming, but they still need to stay unique within the same parent.

Older post

Restoring KCfinder After Manager Paths Change

If KCfinder stops opening after a move or manager path change, check paths, connector URLs, and folder permissions together — fixing only one of them usually is not enough.