Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How to get selected product variant object in product page (website)?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
variantpagewebsitewebsite_saleQweb
2 Replies
10697 Tampilan
Avatar
Tani Maria and Sons Co.

I have overriden the product.packagings table to move from product.template to product.product where it should be (check \Github issue #8237).

Now I want to display packaging info on the website for each variant (aka product.product).

I insert a very crude qweb to test:

<table>

    <tbody>

         <t t-foreach="product.product_variant_ids[0].packaging_ids" t-as="packaging_id">

               <tr>

                    <td>​<span t-field="packaging_id.ean"/></td>

                    <td>​<span t-field="packaging_id.qty"/></td>

               </tr>

         </t>

      </tbody>

</table>


It works but (as expected) fetches values for the first variant found. I want the table to change according to the variant selected from the combination of variant values.

The problem here is that I didn't find the selected variant_id as it is built dynamically in javascript (by evaluating attribute value selections).

  • Is there a way to get the variant_id (product_id in website_sale.js) exposed as a variable in qweb so that I can use:

<t t-foreach="variant_id.packaging_ids" t-as="packaging_id">

  • How can I auto-update the table when the variant changes?

 


Using Odoo Community V8 on OpenSuse 42.2

3
Avatar
Buang
Pierre de Giorgio

I know this has been a long time, but I’m trying to do something similar and have asked the question but no one has answered. Were you ever able to solve this? If so could you share your solution with me?

Your help is greatly appreciated.

Avatar
Odonity - Smart Solutions for Smarter Business
Jawaban Terbai

https://apps.odoo.com/apps/modules/18.0/website_product_variant_dynamic_fields_odonity

0
Avatar
Buang
Avatar
Natan
Jawaban Terbai

Remove the [0] from your loop to get information for all your variants.

If you only want to display information for the selected variant, there are two ways of doing so:


1) For beginning developers.

Use some jQuery to read the 'value' attribute from the input element '.product_id'. This updates automatically when the selection changes. 

Add 't-attf-class="{{packaging_id.id}}" ' to the table row. 

Hide all table rows, and then show the one which has the right class.

You do this both on page load, and on 'product_id' attribute change.


2) For more advanced developers.

Extend the product configurator script.

The product configurator fetches the combination when the selection changes and updates the DOM. Just include the table cells in the stuff that it updates.


P.S. I included a sample code for this earlier, but the forum is buggy so it didn't save.

0
Avatar
Buang
Eric Mattingley

Kind sir, could you please return and reinstate your example code for method 1? (Also do you have to do anything to enable Jquery in the Qweb editor or is it enabled by default?)

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Clean up Website Quotations Diselesaikan
website website_sale
Avatar
Avatar
Avatar
2
Sep 24
5145
Google Places Autocomplete
google website website_sale
Avatar
Avatar
Avatar
2
Okt 25
3820
Website Product Description
website website_sale odoo16EE
Avatar
Avatar
1
Agu 25
1205
Can i remove the added extra price bubble for each variant in the ecommerce website?
variant ecommerce website
Avatar
Avatar
1
Nov 24
12888
Product Block on odoo website, hide the variant product
product variant website
Avatar
Avatar
2
Okt 24
1484
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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