How do I display the internal reference number on the E-Commerce website?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
If you want to add it to product card in shop page you need to override products_item template in website_sale module and If you want to add it to the product page you need to override product template in website_sale module.
Example to add internal reference in product page before description sale field:
<template inherit_id='website_sale.product' id="product_internal reference" name="Product Internal Reference">
<xpath expr="//p[@t-field='product.description_sale']" position="before">
<p t-field="product.default_code" class="text-muted my-2" placeholder="A short description that will also appear on documents." />
</xpath>
</template>
When we add this to the template, we get this error:
`Element '<xpath expr="//p[@t-field='product.description_sale']">' cannot be located in parent view`
What is the Odoo version you are using?
Odoo.sh 15 Enterprise Edition
How you add it to the template?
Try to add the below at the end of the templates.xml, this will show internal reference in shop page for all products and it will add toggle button in customize to active/inactive it:
<template id="products_internal_reference" inherit_id="website_sale.products_item" active="True" customize_show="True" name="Product Internal Reference">
<xpath expr="//*[hasclass('product_price')]" position="before">
<h6 class="o_wsale_products_item_title mb-1">
<a class="text-primary text-decoration-none" itemprop="default_code" t-att-href="product_href" t-att-content="product.default_code" t-field="product.default_code" />
</h6>
</xpath>
</template>
Does this work for odoo 16
I added the code below to templates.xml in the website_sale module
<template inherit_id='website_sale.products' id="product_internal_reference" name="Product Internal Reference">
<xpath expr="//div[='product.name']" position="inside">
<p t-field="product.default_code" class="text-muted my-2" placeholder="A short description that will also appear on documents." />
<t>template</t>
</xpath>
</template>
Why do you need this? may I have an use case?
I use Ecommerce as an internal shop for our employees. They know the part numbers.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 10 23
|
2506 | ||
|
2
thg 10 24
|
3167 | ||
|
1
thg 4 23
|
2066 | ||
|
1
thg 3 22
|
2626 | ||
|
2
thg 6 20
|
3723 |