Building a Page Provider

Vote:
 

Hi,

I am currently in the startup of a project where the client wants to show an existing product catalogue. I will syncronize the products from XML into my own database (product- and category-table). I need to create a tree with Categories, subcategories and products. There's always the possibility to create pages in EPiServer for this but I think I want to use a Custom PageProvider for this.

Using EPiServer pages for datastorage have always felt like a workaround.

So, Allan have done exactly that with northwind. http://labs.episerver.com/en/Blogs/Allan/Dates/112230/8/Building-your-own-Page-Provider-Northwind/ The thing I don't like in his solution is the part with adding 100 to determin which pagetype should be used. 

Has anyone have solved this in a smart way, while creating a pageprovider that should serves multiple pagetypes??

#32327
Aug 31, 2009 16:51
Vote:
 

I think the main propblem that he's solving by adding to the ID's is that each page ID must be unique to your page provider while in the database the ID is unique per table row. That is if you have two tables, Categories and Products and both have a row with ID 42 and someone requests page 42 from your page provider it's hard to figure out if a category or product should be returned.

One workaround is to ensure that the ID's are unique for a group of tables, perhaps by creating a separate EntityID table or something like that.

#32328
Aug 31, 2009 17:17
Vote:
 

Yep, I understand the problem and I have thought of an separate table. In my case it's doable, but what about others that cannot modify the data they want to show with a page provider? 

 Another thing I want to ask about is  Friendly URL. Is it possible for me to have a "/Category/Product/" url? I haven't seen it being mentioned in the documentation.

#32329
Edited, Aug 31, 2009 17:52
Vote:
 

The "adding 100" was a very old hack. I have long ago published a new and "cleaner" way of doing it with the MappedPageProvider. The Mapped Page Provider does exactly what you are looking for - mapping external data with ID, Guid and urls in EPiServer so you don't have to worry about it.

Look at:  http://labs.episerver.com/en/Blogs/Allan/Dates/2009/4/Revisited-Northwind-Page-Provider/ and http://labs.episerver.com/en/Blogs/Allan/Dates/2009/1/Mapped-Page-Provider/

#32330
Sep 01, 2009 1:01
Vote:
 

Hi Allan,

 Is there a new version of the mapped page provider built against R2 SP2, or ideally can you provide the source code so I can build it myself ??

Please contact me on chris.white@ioko.com.

 Many thanks in advance,

 Chris

#32922
Sep 24, 2009 13:05
Vote:
 

Hi All

I'm building a page provider along the same lines , and it is displaying categories as pages and under category pages its child products .

But how about if products belong to multiple categories, how this can be handled to display a single product (of- course same ID) under two different categories.

For second category can we create a short-cut or fetch data from feature . Any suggestions ?

Many Thanks

 

#47189
Jan 18, 2011 17:38
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.