Sitecore Proxy Filter

Let me just preface this with the fact that this idea/solution was really just a proof of concept. Additionally, the next major release of Sitecore (MASSIVE… yes, i’m pretty sure it has to be all caps) will have a much more flexible way to deal with virtual items.

But until then…

Proxy Items in Sitecore would be really useful if there was more flexibility as to which Items are “proxied”. With the current design, there are only a few options regarding which items to shadow: 1 item, all the children of a target item, or all descendants under a target item. That’s great and all, but it would be more useful (at least for the cases I need it) if you could somehow specify a subset of items under a target item. With this need in mind, I pieced together ProxyFilter.

 

I added the ProxyFilter section to the Proxy template with a field called “Query”. In this field, you enter a sitecore query you would like used to filter the virtual items that the proxy points to. This all works by extending the “SqlServerProxyDataProvider” class… along with a small extension to “ItemProvider”.  I’m not going to go into the code here unless someone actually wants it because as I said above, this was more a proof of concept and it will most likely become unnessary with Sitecore’s MASSIVE release.

ProxyFilter in action… On the left, is the set of virtual items you get setting up a regular Proxy item. On the right, is the filtered subset of virtual items created as a result of the ProxyFilter settings in the screenshot above.

 

One issue I did notice was that the ProxyProvider contains a ProxyCache object which among other things stores VirtualIds. But it seems to store them indefinitely. The reason this is bad is that when I update the Proxy item.. say to point to a different source item, it doesn’t update the virtual items until the cache is cleared.

And there you have it… ProxyFilter.

Advertisement

About Paul Martin

I enjoy rock climbing, playing guitar, writing code...
This entry was posted in Proxy Items, Sitecore. Bookmark the permalink.

5 Responses to Sitecore Proxy Filter

  1. Derek Hunziker says:

    Hello Paul. Thanks for sharing your solution. I am very interested in how you extended SqlServerProxyDataProvider and the ItemProvider. Can you provide an example of how to do that? Many Thanks!

  2. Pingback: Sitecore Proxy Filter POC Implementation | Paul's Sitecore Musings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s