From c2782891da56bdc92bf0165da5889906e5fb35ff Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 8 Jan 2024 11:18:24 +0500 Subject: [PATCH] cat get_url_path_of_category command --- .../Commands/UpdateCategoryFunction.php | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 packages/Sarga/Admin/Console/Commands/UpdateCategoryFunction.php 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