Yes, you've nailed it. Thanks for rephrasing the question.

It seems Product model derives only from Displayable, unlike Category which 
derives from Page, so it won't be  handled with PageMiddleware.
I'd guess for Product it would be prefixed directly by its app_label.

After inserting tracing output in mentioned pages_tags.py,  shop_product 
view receives in context both Shop and Category instances, but the former 
is used.


On Saturday, May 23, 2015 at 3:53:13 AM UTC+2, Chris Trengove wrote:
>
> As I understand it, this happens in PageMiddleware (pages/middleware.py) 
> which is responsible for coming up with a "page" to add to the template 
> context. This happens as well for non-page views, like blog pages and shop 
> products, in which case the "page" that gets added to the context is the 
> root "blog" or "shop" page.
>
> For shop products, I think a useful feature would be to have the context 
> page be the category with the deepest (most specific) "path". So if a 
> product was in "Shop > Mens Wear > Shirts" and "Shop > Mens Wear" (as a 
> featured product), then when viewing the product, the "page" set in the 
> context would be "Shirts", so that the breadcrumbs then showed "Shop > Mens 
> Wear > Shirts" and not (as happens at present) "Shop".
>
> So, the question is how best to achieve this, presumably by modifying 
> PageMiddleware in some way.
>
> On Friday, May 22, 2015 at 11:11:51 PM UTC+10, David Unric wrote:
>>
>> Hello,
>>
>> how can I configure/tweak Mezzanine *cartridge.shop.models.Product* 
>> won't be prefixes with *Shop* in menus and breadcrumbs ?
>>
>> For example I've created product category Pages named "Cars" and 
>> "Acessories" and each product belongs only to one of them.
>> Both categories are rendered as root in page_menu "pages/menus/tree.html" 
>> (bellow Shop), links in category view (including nested ones) correspond to 
>> current category in a categories tree.  So far so good.
>> However when navigate to a specific product, instead of real parent 
>> categories path, page_menu places product directly as a descendant of 
>> *Shop*, which is not correct.
>>
>> It seems the logic is in Mezzanine's pages_tags.py in pages/templatetags, 
>> but having a harder time to completely understand it, incl. where 
>> *menu_pages* in context comes from etc.
>>
>> I do not know if I'am on the right track and would welcome if anybody can 
>> give me an advice how Cartridge products to be linked as descendants of 
>> their primary category instead of a generic Shop ?
>>
>> Thanks.
>>
>

-- 
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.

Reply via email to