Developer forum

Forum » Development » Products - publication period

Products - publication period

Nuno Aguiar
Reply
Hi,

We have a client that's having a hard time working with the eCom Campaigns and would like us to implement From and To dates directly in the products, like News, for example.

What's the best way to develop this? The ProductListTemplateExtender seems too far in the process.

Nuno


Replies

 
Morten Bengtson
Reply
Hi Nuno,
 
One way to do this is to add two custom date fields to products and then implement a ProductListCollectionProvider...
public class PublishedProductsProvider : Dynamicweb.Extensibility.Provider.ProductListCollectionProvider
{
        public override ProductCollection FetchCollection(Renderer renderer, string groups)
        {
// return a collection of products that are "published" (DateTime.Now is between from and to date specified in two custom product fields)
        }
}
I'm not sure if this is the best solution though.

/Morten
 
Nuno Aguiar
Reply
Hi Morten,

At least it's a way. thanks

Nuno

 
Marco Santos
Reply
Hello.

I am looking into a way of getting the product list ordered by whatever is set in the module paragraph. I have tried


            foreach (Product product in Product.getProducts(groups, true))
            {
                //perform some tasks
            }


but the returned collection is empty when I include the useOrderBy parameter. Any ideias on why and how can I overcome this?

Thanks.

Marco

 
Nuno Aguiar
Reply
 Hi Morten,

Unfortunatelly we cannot order the products with this solution. Or is there something wrong we are doing? We need to maintain the order settings in the paragraph.

Nuno

 

You must be logged in to post in the forum