I'm pretty new to umbraco and i'm developing a little webshop in it. I store my products under folder node like this.
Products a AProduct1 Aroduct2 b BProduct1
But now my question is how can i create a product on the main node(Products) so it is automatically stored under the correct node letter. So a Bicycle goes under the letter B and car under C. I assume you can use a sort of documenttype event (prepost)? Can i just create a class library? How can i reference to that type of document?
Create a content tree like the members section
I'm pretty new to umbraco and i'm developing a little webshop in it. I store my products under folder node like this.
Products
a
AProduct1
Aroduct2
b
BProduct1
But now my question is how can i create a product on the main node(Products) so it is automatically stored under the correct node letter. So a Bicycle goes under the letter B and car under C. I assume you can use a sort of documenttype event (prepost)? Can i just create a class library? How can i reference to that type of document?
Tim wrote a package awhile back to do what your looking for, if I understand your post right. Haven't tried it yet but give it a look.
Download here : http://our.umbraco.org/projects/alphabetfolder
Some more info here: http://www.nibble.be/?p=30
-Chris
Thanks Chris!
I just found a solution on the forums. This is what i have so far:
public class ProductActionHandler : IActionHandler
{
#region IActionHandler Members
public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, umbraco.interfaces.IAction action)
{
if (documentObject.ContentType.Alias == "Product")
{
try
{
Node currentNode = new Node(documentObject.Parent.Id);
foreach (Node node in currentNode.Children)
{
if (node.Name == "b")
{
documentObject.Move(node.Id);
}
}
}
catch (Exception)
{
return false;
}
return true;
}
else
{
return false;
}
}
public umbraco.interfaces.IAction[] ReturnActions()
{
return new umbraco.interfaces.IAction[] { new umbraco.BusinessLogic.Actions.ActionNew() };
//http://our.umbraco.org/forum/developers/api-questions/4680-Implementing-an-action-handler-in-Umbraco-4---ActionNew()-is-obsolete
}
But i just found out that the code is for V3 and not for v4
http://our.umbraco.org/forum/developers/api-questions/4680-Implementing-an-action-handler-in-Umbraco-4---ActionNew()-is-obsolete
I post my final solution here.
Here my solution:
is working on a reply...