Forum
Forum
DevBlog
Forum management
Threads started by me
Threads I participate in
Get started
Dynamicweb 9
Dynamicweb 10
Swift
Templating
Community
Downloads
Login
Service Desk
Order
Sections
Get started
Dynamicweb 9
Dynamicweb 10
Swift
Templating
Community
Downloads
Forum
DevBlog
Forum management
Threads started by me
Threads I participate in
Developer forum
×
E-mail notifications
E-mail
I'd like to be informed of the updates
Don't bother me with any emails
Forum
»
Development
»
Custom sort
Custom sort
E-mail notifications
Reply
Posted on 01/12/2009 09:39:23
When looping products how do I write the sorting.?
Is there a dw controle for this?
foreach (Product p in g.Products)
{
sb.Append(p.Name);
}
Replies
Posted on 01/12/2009 09:50:57
Reply
Hi
A Product doesn't have a sorting in itself, but only to a group, because a product can be sorted differently in each of it's groups.
Therefore sorting is stored in the relation between a group and a product. We have an API class to handle this.
The code to change the sorting will look something like this:
ProductGroupRelation rel1 = new ProductGroupRelation(myProduct1.ID, myGroup.ID);
rel1.Sorting = 2;
rel1.Save(rel1.ProductID, rel1.GroupID);
ProductGroupRelation rel2 = new ProductGroupRelation(myProduct2.ID, myGroup.ID);
rel2.Sorting = 1;
rel2.Save(rel2.ProductID, rel2.GroupID);
This code will sort myProduct2 before myProduct1 in the group myGroup.
- Lasse
You must be logged in to post in the forum
Login
Username
Password
Forgot your password?