Developer forum

Forum » Development » Overriding the maximum number of items for the Product Catalog

Overriding the maximum number of items for the Product Catalog

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

 

Is there a way to programmatically override the limitation of 500 products shown using the Product Catalog, using a template extender for example? I am pretty sure I've seen this request before but I can't find the post or sample code.

 

I can currently hack my way around it by inserting a value of 10000 in the drop-down using Firebug, but that's a bit hard to explain to customers ;-)

 

I need this functionality in order to render a Google Merchant compliant RSS feed that lists many (around 8,000) products at once.


Thanks in advance.

 

Imar

 


Replies

 
Morten Bengtson
Reply
This post has been marked as an answer

I have previously used another hack. I'm not sure if it still works in DW 8.2, but you could give it a try...

 

Implement a class that inherits from Dynamicweb.Extensibility.Provider.ProductListCollectionProvider, override the FetchCollection method and change page size on the catalog settings that are passed as parameter.

 

Something like this...

using Dynamicweb.eCommerce.Frontend;
using Dynamicweb.Extensibility.Provider;
	
public class PageSizeHackProvider : ProductListCollectionProvider
{
	public override ProductCollection FetchCollection(Renderer renderer, string groups)
	{
		renderer.ParagraphSettings.PageSize = 9999;
		return null;
	}
}	

 

I only used this method to control page size before it was possible to specify PageSize in the query string.

 

BR

Morten

 

Votes for this answer: 1
 
Morten Bengtson
Reply

It looks like Google Merchant requires that you serve your feed with .xml extension. Maybe it would just be easier to make a daily export of all products to an XML file using Data Integration? I'm sure that you could do some URL rewriting, but still.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Great, thanks for that. Exactly what I was looking for. Will try it out soon.

 

Exporting to XML is an option too. I like that idea very much. However, I want to give the client control over the actual feeds. With a bit of custom code that sets the content type to XML and a Direct Path that creates the XML extension, my client can now create dynamic pages of type "RSS" based on a Smart Search. But I'll definitely reevaluate exporting to XML.

 

Thanks,

 

Imar

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Two questions as follow up on using Data Integration for the RSS feed:

 

1. Is there a way to use a Smart Search as the source of the export job? If not, that would be a nice enhancement. In this case, the client has specific requirements to include and exclude specific products. Smart Searches are an excellent way to accomplish that, and I would like to be able to use Smart Searches as a source. Maybe there should be a Smart Search Provider?

 

2. Is there any sample XSLT (in /Files or elsewhere) available to demo the export of products and the like? If not, it might be a good idea to create a bunch of files to show the general concept and include those in the product.

 

Imar

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I solved it with Morten's code, and the following features:

 

1. Smart search for custom selection of products

2. Custom Page / master template to enable clean output with only XML.

3. A notification subscriber that checks if the current request ends in .xml and is an RSS page (as identified by a content manager in the Navigation tag field under Options)

4. A custom ProductListCollectionProvider that sets the PageSize to 9999 of it's an RSS page (again, using the Navigation tag field on the page).

5. Custom Direct Paths that map XML extensions (that Google wants) to my own Dynamicweb pages.

 

It would be nice if there was more direct support for stuff like this, but it's good to see you can extend your way into it.... ;-)

 

Imar

 

You must be logged in to post in the forum