Skip to Content
Menu
This question has been flagged
1 Odpoveď
1031 Zobrazenia

The standard odoo webshop has support for e-commerce categories that are hierarchically organized. In the demo data for example you have

All products > Furnitures > Chairs


When you surf to /shop/category/furnitures-chairs-11


you see this reflected in the breadcrumb on top.

Yet when you select one of the products. For example the Conference chair, you see suddenly the 'Furnitures' item goes missing from the breadcrumb

/shop/conference-chair-16?category=11#attr=5

It shows only

 All Products > Chairs > Conference Chair


This is not what one would expect from a breadcrumb ... 


Any idea how to fix this ?

Avatar
Zrušiť
Autor Best Answer

Hmm that was actually easier than i first thought. Seems like there are 2 places where a breadcrumb is generated and they are not in sync ...

This fixes the breadcrumb behavior for the product page:

    <template id="product" inherit_id="website_sale.product">
        <xpath expr="//li[@t-if='category']" position="replace">
            <t t-if="category and category.parents_and_self">
                <t t-foreach="category.parents_and_self" t-as="cat">
                    <li class="breadcrumb-item">
                        <a t-att-href="keep('/shop/category/%s' % slug(cat), category=0)" t-field="cat.name"/>
                    </li>
                </t>
            </t>
        </xpath>
    </template>


Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
jún 25
1966
3
júl 25
3553
1
máj 25
1673
1
máj 25
1913
4
máj 25
3039