Hi everyone,
It seems that the function and in api.json do not work. I assume that this function should check whether there are subcategories and, if this is the case, prevent the parent category from being deleted. However, this is not the case. If you delete a main category with subcategories, the subcategories remain in the table but no longer appear in categories/manage, as the parent_category_id no longer exists. is not displayed. Has anyone ever had the same problem?
Category Builder from Marketplace - beforeHook_make_sure_delete_allowed
2 years ago
2 years ago
#1
2 years ago
#2
Hello,
First, There is alot of info in the docs.
https://trongate.io/docs/information/before-hooks-and-after-hooks--general-overview
Second, I believe this might be because of who is logged in requesting the delte.
Dan
First, There is alot of info in the docs.
https://trongate.io/docs/information/before-hooks-and-after-hooks--general-overview
Second, I believe this might be because of who is logged in requesting the delte.
Dan
2 years ago
#3
Hi,
It could be a problem with the category builder module - that you got from the Module Market. I'll look into this, just as soon as I can find a minute.
Expect a response / fix within twenty-four hours.
DC
It could be a problem with the category builder module - that you got from the Module Market. I'll look into this, just as soon as I can find a minute.
Expect a response / fix within twenty-four hours.
DC
2 years ago
#4
Hi michidesign,
I refrained from participating in this thread as DC said he was going to check it out but it's been a while and I know he's got a lot on his plate right now, so thought I'd take a quick look at it. and are the same method. If you look at the code in this method you will notice it is trying to get the 'id' from "$input['params']['id']".which is empty since the api.json file doesn't declare params as trueI'm not sure if this is a legacy thing or a bug since 'Api.php' and 'Standard_endpoints.php' was updated after this module was uploaded to 'The Module Market'. Regardless, to get around this we can look at segment(4) of the URL, which is the id of the selected category to delete.
Please try this code and let me know if it works for you:I also refined the message to clarify why the deletion was cancelled.
Merry Christmas to everyone!
Cheers,
Si
I refrained from participating in this thread as DC said he was going to check it out but it's been a while and I know he's got a lot on his plate right now, so thought I'd take a quick look at it. and are the same method. If you look at the code in this method you will notice it is trying to get the 'id' from "$input['params']['id']".which is empty since the api.json file doesn't declare params as trueI'm not sure if this is a legacy thing or a bug since 'Api.php' and 'Standard_endpoints.php' was updated after this module was uploaded to 'The Module Market'. Regardless, to get around this we can look at segment(4) of the URL, which is the id of the selected category to delete.
Please try this code and let me know if it works for you:I also refined the message to clarify why the deletion was cancelled.
Merry Christmas to everyone!
Cheers,
Si
2 years ago
#5
** UPDATE ** - on second thoughts, another way to fix this issue and fix the delete_one() method in Standard_endpoints.php is to set just before the 'before_hook' is calledThis way there is no need to change anything in the categories module.
** Another Update **
I have now pushed this fix to GitHub, so when you create a new app via the Desktop app the Category Builder will just work.
** Another Update **
I have now pushed this fix to GitHub, so when you create a new app via the Desktop app the Category Builder will just work.