Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
335 Näkymät

Hi everyone,

I'm trying to find a way to dynamically use product attributes—such as the vendor (provider) or any custom fields defined in the backend—and display them on the website product pages without having to manually edit each page.

The goal is to define these fields once in the backend and have them automatically appear on the frontend, ideally in a way that persists even after version upgrades.

So far, I haven't found an easy or upgrade-safe method to achieve this.

Is there a recommended approach or best practice to make this work using Odoo's website module or templating system?

Thanks in advance for your help!

Avatar
Hylkää

Product Attributes assigned to Products are displayed on Product detail pages in eCommerce by default. A single-value Attribute (an Attribute with just one value assigned in the Product Template) is listed beneath the price or add to cart section, one with multiple values assigned in the Product Template is rendered as selectable options. That being said, I'm unsure what exactly you are asking about.

Tekijä

Hi Christoph,

Thanks for the explanation. You're right that product attributes are shown by default beneath the price or as selectable options, depending on how they're configured. What I’m specifically trying to achieve is to have more control over where and how these product details are displayed on the product page.

For example, I want to be able to show certain product attributes—like the vendor (or any custom fields I’ve added in the backend)—in a custom position on the product page, not just beneath the price or in the variant selection.

My question is:

Is there a way to dynamically pull these attributes (or any custom product fields) in the website templates so I can place them exactly where I want using a code snippet (e.g., in QWeb templates or XML views), in a way that is upgrade-safe?

I want to avoid having to hard-code product information or manually update it per product. Ideally, I’d like a generic snippet or template edit that references the backend fields and renders them on the frontend wherever I include the code.

Thanks again for any insights or pointers!

Best,

Hi, 
Also following along with this. I've found it quite hard to be able to customize the positions of information on the website which can be a little frustrating. It looks like we can hard code in SH however updating the version we probably lose it all.

Additionally, when selecting to display additional information I'm finding that a lot of fields do not show up. I made 9 custom fields and of that only 1 was available. Char in type was the field that worked, the others were all selection or float.

Cheers,
Tom

Maybe, this third-party module - https://apps.odoo.com/apps/modules/18.0/product_custom_fields_website_sale - might partially help with your requirements

Tekijä

Thanks for the answer. 

In finally decide to go with the QWeb editor included, where you can inherit web view and modify the XML / HTML code and get product data. You create new "view" of the product, then redirect the shop to these pages. It may create an issue when upgrading version, but it's the only way I found for now to have a total control of the page. 

Paras vastaus

Hi,

Activate Developer Mode to add some of the backend fields to the list of Product Page Extra Fields.


Hope it helps

Avatar
Hylkää