Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1035 Widoki

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 ?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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>


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
cze 25
1975
3
lip 25
3566
1
maj 25
1688
1
maj 25
1920
4
maj 25
3039