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
1789 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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>

Awatar
Odrzuć
Autor

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

Powiązane posty Odpowiedzi Widoki Czynność
0
mar 21
2271
0
lut 20
2556
2
mar 15
7301
2
sie 25
1374
2
lip 25
3066