Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
170 Представления

Is it possible, and if so how, to add a text label to the product reference price on the product and category pages?


When I add a product reference price I do get a strikethrough price on my website for the specific product. However under EU regulations I have to explain what the base price is. For example is it the MSRP, a previous price or something else. With the current product reference price I'm only getting the price value with a strike through.


I'm using Odoo v18 with Theme Prime.

Аватар
Отменить
Автор Лучший ответ

Hi,

Thanks. That worked.

Using Odoo Studio I was able to add a new field to the product form in the backend to add the new text field for the price description.

Then it was a bit of a search where to edit te price template to get it to show on the website. After enabling developer mode I had to go to: Settings -> Technical (top menu) -> Views (under User Interface). Then edit the template with the key "website_sale.product_price". 

Аватар
Отменить
Лучший ответ

Hi,


Yes, it’s possible to add a text label to the product reference price in Odoo 18, but it requires customizing the QWeb templates used for the website. By default, Odoo only displays the reference price as a strikethrough value without any explanation, which doesn’t meet the EU requirement to indicate the type of reference (e.g., MSRP, previous price).


Try the following steps


1-Create a custom field on product.template or product.product to store the reference price label, e.g., x_reference_price_label.


2-Activate Developer Mode → Go to Website → Configuration → Templates.


3-Inherit the product template (like website_sale.product) and modify the section that renders the reference price. For example, you can wrap the reference price with your new label:


<t t-if="product.lst_price">

    <span class="reference-price" t-att-title="product.x_reference_price_label">

        <t t-esc="product.lst_price"/>

    </span>

    <span class="reference-price-label" t-esc="product.x_reference_price_label"/>

</t>


4-Update the website and ensure the label appears under the strikethrough price.


This method lets you display both the reference price and a descriptive label explaining what it represents, making it compliant with EU regulations.


Hope it helps

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
дек. 23
2596
1
окт. 23
2758
4
окт. 23
5435
2
окт. 24
3457
1
апр. 23
2347