Hi folks, just reporting about how I finally did solved the original question.
Although I like Stephen's idea to directly adjust menu templates and find it very straightforward, in the end it started to feel a bit cumbersome because you would need manually alter all concerned templates (shop/product, menus/breadcrumb, menus/dropdown, menus/tree etc.) to reflect the change. And it goes against logic of mezzanine flow at `Page` handling. It logically leads to propagate demanded `Page` instance straight from the source - `'shop_product'` view in this case. Unfortunately `mezzanine.pages` does not allow you to (optionally) set this as its `PageMiddleware.process_view` ignores current context and rewrites <https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/pages/middleware.py#L76-L80> it with its own - as exactly pointed out by Mathias. There seem to come following solutions: - subclass/patch `PageMiddleware` to respect existing page in context and change relevant view to propagate it - add/patch template context processor to alter page in context as is processed *after* middlewares - insert a page processor for Product as a descendant of Category (not sure about this) I've decided for the latter as it won't involve modifying or monkey-patching mezzanine/cartridge sources, however it seems a bit suboptimal because you need again retrieve model's instance (Product in this case) indirectly like if request.resolver_match and \ request.resolver_match.view_name == 'shop_product': slug = request.resolver_match.kwargs['slug'] product = Product.objects.get(slug=slug) page = product.categories.first().page_ptr # product.main_category.page_ptr context = {"request": request, "page": page, "_current_page": page} page.set_helpers(context) As you may see, the former which propagates page instance from the view functions would be much better. Is there some reason `PageMiddleware` should not respect existing `page` in context and overwrite with its one ? As a side note there are many reasons to select parent category for a product and is quite common in e-commerce sites. I find it very confusing if you navigate a product by browsing parent categories and the path is suddenly lost after entering product's detail. It is true product may belong to several categories but there should be added logic to select the main category like existing default ProductVariation. In addition controller may reflect previous url (how was navigated) and select parent categories by this - seen at SpreeCommerce breadcrumbs menu. -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
