Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivoustarvikkeet
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Tutoriaalit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

How do I add a field (internal reference) to products page on webiste?

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
onlinesaasecommercewebsite_sale
4 Vastaukset
12174 Näkymät
Avatar
Pierre de Giorgio

I'm trying to figure out how to add a field, in this case "internal reference" to my ecommerce products.

I would like to have it in the product tiles under the product name.  I would also like to have it show up next to the product name in the shopping cart lines.

I'm using Odoo online.

I was able to add it to the html for the product detail page by simply adding the following to the html code.

<span t-field="product.default_code"/>

I'm not sure where to go to edit it on the main products page and in the shopping cart description.

I'm guessing I need to edit the respective views but I'm not sure which.  Any help is greatly appreciated.    


1
Avatar
Hylkää
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Paras vastaus

Hi,

Hi, While changing the product variant a javascript function (_onChangeCombination) is running behind to get the product detail of the variant. You can overide the function to change the default product code according to the attribute change.
First add the following code in the html view (<template id="product">) inside the div

<div class="js_product js_main_product">
<span t-attf-class="default_code" t-field="product.default_code"/>
</div>

then inherit the javascript function (_onChangeCombination) and find the html element.

var $default_code = $parent.find(".default_code");

provide the value for the variable.

$default_code.text(combination.default_code);

You can pass the default_code from the python fuction _get_combination_info()

'default_code': product.default_code

Regards

1
Avatar
Hylkää
Pierre de Giorgio
Tekijä

Thanks so much for the response. So am I able to do this since I'm using Odoo online? I'm not sure where to inherit the javascript function and pass the defualt_code from the python function. Could you elaborate more on this please.

Aung Ko Ko Lin

Is this the correct way?
<div class="js_product js_main_product">
<span t-attf-class="default_code" t-field="product.default_code"/>
</div>

I also extend the JS you mentioned and I found my JS is called but the value is not changed when we change variant.

Avatar
Pierre de Giorgio
Tekijä Paras vastaus

Ok, I figured it out.  Here is what I did in case it helps anyone else.

On the shopping cart, edit HTML, from the dropdown select Shopping Cart Lines.

<div>
    <t t-call="website_sale.cart_line_product_link">
        <strong t-field="line.product_id.product_tmpl_id"/>
    </t>
</div>

I changed the field in bold so that it now shows [internal reference] Product Name

On the product detail view:

<h1 itemprop="name" t-field="product.name">Product Name</h1>
<span t-field="product.default_code"/>

I added the line in bold so that the internal reference is now displayed underneath the product name.

On the main product page (table view):

<div class="oe_product_cart" t-att-data-publish="product.website_published and 'on' or 'off'">
    <t t-set="product_image_big" t-value="td_product['x']+td_product['y'] &gt; 2"/>
        <t t-call="website_sale.products_item"/>
</div>
<div style="margin-left:10px">
    <t t-if="product.default_code">
        <t t-set="int_ref" t-value="'pn: '+product.default_code" />
            <p t-esc="int_ref" class="text-muted"/>
        </t>
</div>

I added the code in bold. This is the best I could do here.  This will display the Internal Reference at the bottom of each tile.  I would have prefered to show it under the Product Name, but was not able to figure that out.  If anyone has any ideas here that would be great.  I just added the "pn: " to simply prefix the default code with.

2
Avatar
Hylkää
Pierre de Giorgio
Tekijä

So although this works, on the product detail view, if you use products with variants it does not show properly. I can see that the images for the variants are fetched, but the variant_id is not passed to the qweb view.

I tried to use product_variant.default_code but it will only show the initial internal reference. When you change a variant option, the default_code is not updated.

Does anyone know how to get the default_code for the variant?

Avatar
Piotr Słomkowski
Paras vastaus

Simplest way without coding:

On backend: Website -> Configuration (on top menu) -> Websites -> YourWebsiteName -> Product Page Extra Fields (Tab) ->Add Line (Internal Reference).

Go to product page and there is displayed Internal Reference.

Thats all ;)

2
Avatar
Hylkää
Avatar
VS
Paras vastaus

Hi Pierre

Were you able to find a solution to your default_code value with variants?

1
Avatar
Hylkää
Pierre de Giorgio
Tekijä

Unfortunately no. We have Odoo Online (SaaS) version, so we don't necessarily have full access to the source code as suggested below.

Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
Add shop and wishlist buttons on new website theme module
ecommerce website_sale
Avatar
0
helmik. 22
2887
Odoo 12 - How to Add Field at template
ecommerce website_sale
Avatar
Avatar
2
heinäk. 19
7141
Why is there no longer a free website?
online saas
Avatar
0
maalisk. 15
5852
Can we completely disable new user registration on V17 online version?
online ecommerce v17
Avatar
Avatar
Avatar
Avatar
4
toukok. 25
3920
Display product fields on the product page in Ecommerce
product online ecommerce
Avatar
Avatar
2
heinäk. 24
4191
Yhteisö
  • Tutoriaalit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now