Posted on 12/02/2013 11:27:47
Hi Rob,
I don't think it's feasible. Mostly because the concept of a previous or next product doesn't exist in just the context of a product. If you want to do some sort of navigation then you have to have a context in which the product can exist with unique next and previous products.
As a context, you could use the product list that the user clicked on to get to the product detail page, but that won't always work--especially if the user enters the product detail page directly, like bookmarking the product. In this situation the context doesn't exist and the navigation will not work.
If you can live with only having the navigation if the user came from the list, then you can build the context yourself by creating a notification subscriber for ProductList.BeforePaging and save the product collection in a session variable (or similar). Then create a ProductListTemplateExtender in which you render your navigation based on the current product and it's placement in the collection from earlier. NB. there is a potentially large memory overhead in saving the entire product list for all visitors!
There is an edge case with this one if you're using the optimized product retrieval on your product catalog because it only fetches the products that are displayed on the given paging of the list. Therefore, you might want to turn that feature off.
As you can probably gather, this is not straight forward and there are some considerations to be made. However, I hope you got the inspiration you sought :)
- Jeppe