Hello Experts,
I am on beginner level in Kentico, I am developing page application with Kentico CMS version 8.2.
I need help to implement following logic:
Explanation: I want to add specific no of folders as child page under the new product page type at the time of new product insert.
Like:
/ (root)
- Products (added page type cms.MenuItem)
- ProductXYZ (added page type cms.product)
- Folder_A
- Folder_B
- Folder_C
- Folder_D
In above all the child folder under the ProductXYZ need to create automatically just after ProductXYZ insert.
I have explored for this and got that need to create global event handler and register it.
form this url: https://docs.kentico.com/display/K82/Handling+global+events
Above link explained how to create global event handler and register it:
private class CustomDocumentEventsAttribute : CMSLoaderAttribute
{
public override void Init()
{
// Assigns custom handlers to events
DocumentEvents.Insert.After += Document_Insert_After;
DocumentEvents.InsertLink.Before += Document_InsertLink_Before;
}
private void Document_Insert_After(object sender, DocumentEventArgs e)
{
// Add custom actions here
}
With this I understood that I need to put code under the method Document_Insert_After, but I am new with Kentico and don't have experience with Kentico API and code.
Please help me what code should I write to get currently created product node and add new child folder under that.
Example code will help me a lot.
Thanks in advance.