diff --git a/packages/Sarga/Admin/Console/Commands/UpdateCategoryFunction.php b/packages/Sarga/Admin/Console/Commands/UpdateCategoryFunction.php new file mode 100644 index 000000000..7e48349a6 --- /dev/null +++ b/packages/Sarga/Admin/Console/Commands/UpdateCategoryFunction.php @@ -0,0 +1,83 @@ += parent._lft + AND node._rgt <= parent._rgt + AND node.id = categoryId + AND node.parent_id IS NOT NULL + AND parent.parent_id IS NOT NULL + AND parent_translations.locale = localeCode + GROUP BY + node.id; + + IF urlPath IS NULL + THEN + SET urlPath = (SELECT slug FROM ${dbPrefix}category_translations WHERE ${dbPrefix}category_translations.category_id = categoryId); + END IF; + ELSE + SET urlPath = ''; + END IF; + + RETURN urlPath; + END; +SQL; + + DB::unprepared($functionSQL); + } +} \ No newline at end of file