Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
1045 Tampilan

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
Buang
Penulis Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Sep 25
1956
1
Jun 25
1985
3
Jul 25
3571
1
Mei 25
1695
4
Mei 25
3044