Updated 18 August 2022
When importing the Bagisto database for the existing project then it’s important to check if you have all privileges or not because in the Bagisto database we are using functions and triggers for the automatic generation of categories’ URL paths.
Sometimes when the user imports the database then sometimes this function i.e. get_url_path_of_category
is not present due to which you will get this error,
To overcome this then make sure you have proper privileges to add functions and then try to import the database.
If you have proper privileges then you can use this SQL command also, just change the definer as per your need,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
DELIMITER $$ CREATE DEFINER=`root`@`localhost` FUNCTION `get_url_path_of_category`( categoryId INT, localeCode VARCHAR(255) ) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC BEGIN DECLARE urlPath VARCHAR(255); IF NOT EXISTS ( SELECT id FROM categories WHERE id = categoryId AND parent_id IS NULL ) THEN SELECT GROUP_CONCAT(parent_translations.slug SEPARATOR '/') INTO urlPath FROM categories AS node, categories AS parent JOIN category_translations AS parent_translations ON parent.id = parent_translations.category_id WHERE node._lft >= 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 category_translations WHERE category_translations.category_id = categoryId); END IF; ELSE SET urlPath = ''; END IF; RETURN urlPath; END$$ DELIMITER ; |
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.