Child pages
  • "ParentPath" field usage in SQL without table alias [5.2.1]
Skip to end of metadata
Go to start of metadata

In the categories_config.php calculated field "CurrentSort" is used without table alias. This may be a problem if customization requires additional join. For example, join on same Categories table to get access to some parent category field values. In this case we get following SQL error "1052: Column 'ParentPath' in field list is ambiguous".

categories_config.php
'CalculatedFields' => Array (
    '' => Array (
        'CurrentSort' => "REPLACE(ParentPath, CONCAT('|', ".'%1$s'.".CategoryId, '|'), '')",

I suggest use before ParentPath same prefix '%1$s' as before CategoryId field.

Related Tasks