Skip to Content
Menu
This question has been flagged
1 Reply
1744 Views

Hello there :)

according to German law, products sold by area for example, must have the base price displayed next to the price for the Product. We sell products by square meter (m²). Therefore we have to show the Price per m² next to the final price.

Example: 

Metal Sheet
Size: 2 by 3 m
Price: 66 €
Base Price: 11 € / m²

[ADD TO CART]

I am trying to edit the view "product_price" or "website_sale.product" but I do not know where to find the right data. 

Can anyone give me a hint, please?

---

We use Odoo 14 Enterprise, btw.

Avatar
Discard
Best Answer

You can inherit the products_item template to base price in shop page for all product items:

<template id="products_base_price" inherit_id="website_sale.products_item">
<xpath expr="//*[hasclass('product_price')]" position="after">
<div class="product_price mb-1" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">
<span>Base price:</span>
<span itemprop="base_price" style="" t-esc="product.standard_price"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
</div>
</xpath>
</template>

And you inherit the product_price to add base price in product page as below:

<template id="product_price" inherit_id="website_sale.product_price">
<xpath expr="//h4[hasclass('css_non_editable_mode_hidden','decimal_precision')]" position="after">
<div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" class="product_price mb-1">
<h4 class="css_editable_mode_hidden">
<span>Base price:</span>
<span itemprop="base_price" style="" t-esc="product.standard_price"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
</h4>
</div>
</xpath>
</template>

Avatar
Discard
Author

Thank you so much, Waleed Mohsen! This works and I can build on it. Again, thank you so much :D

That's sound good! You are welcome

Related Posts Replies Views Activity
0
Mar 21
2191
0
Feb 20
2501
2
Mar 15
7237
2
Jul 25
1264
2
Jul 25
2952