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
    • Diskusi
    • 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

Weird issue with the last product image changing in odoo

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
javascripthtmlodooV13
5 Replies
3549 Tampilan
Avatar
Raitis

I have this code in javascript to change the product image on mouse over. It is working fine, but only for two first products. Last one is being ignored.

```

var list = document.querySelectorAll('span[data-oe-id] img');


for(let i=0; i<list.length; i++){

    let image = list[i];

    let src = image.src;


    image.addEventListener("mouseover",function(event){

     console.log(src);

     image.src="https://media1.giphy.com/media/PfFtibPKBbQrK/giphy.gif?cid=ecf05e47b668e5062e9a561e681f23705e106d8d495b3915&rid=giphy.gif";

    });

    image.addEventListener("mouseout",function(event){

      image.src=src;

    });

}


Here is the video example of issue - https://mega.nz/file/aRUziACJ#bwTlV1wWd_P3kyqYARikyJC-o8hVszJikE_NDaM-jkw


I can't see why it is ignoring the last product, because it has the same HTML code structure as first two products


Resulting HTML code in the shop. My script is - mainimg.js (Yea. I know that js is loaded 3 times, just couldn't find way to load it once): https://pastebin.com/KPFuGnWA



Speaking about my templates code, there's nothing special, just an xpath for card and oe_product_cart classes

1
Avatar
Buang
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Jawaban Terbai

I am not sure but I think the issue is in the for loop or list variable and it is not reaching to last product.

Please check if list variable contains all the products and also the for loop is going through all of the products.

Except these 2 points, I don't see any issue in your code.



2
Avatar
Buang
Avatar
Raitis
Penulis Jawaban Terbai

@Sudhir Arya Thank you for your answer, I tried to do list.length + 1 , but it didn't help


Edit: Strange thing about nodes. https://prnt.sc/sf6jn8
In node(1) there's website logo. Node(2) website logo + product 1. Node(3) website logo + product 1 + product 2


0
Avatar
Buang
Sudhir Arya (ERP Harbor Consulting Services)

Console the list variable and check if it has all the products or not

Sudhir Arya (ERP Harbor Consulting Services)

I think "span[data-oe-id] img" will not simply work. You will have to add something unique for the product images only and us it in the JS as query selector.

Raitis
Penulis

Edit#2: I have edited my js code to be more unique to the products, so it will not pick up the website_logo. but issue persists. Third product image remains unchanged on mouseover.

New js code:

var list = document.querySelectorAll('span[data-oe-id].d-flex.h-100 img');

for(let i=0; i<3; i++){

let image = list[i];

let src = image.src;

image.addEventListener("mouseover",function(event){

image.src="https://media1.giphy.com/media/PfFtibPKBbQrK/giphy.gif?cid=ecf05e47b668e5062e9a561e681f23705e106d8d495b3915&rid=giphy.gif";

});

image.addEventListener("mouseout",function(event){

image.src=src;

});

}

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
How to set DateTime widget in a utc format?
javascript odooV13
Avatar
0
Mar 22
6771
How to create a progress bar with HTML and javascript???
javascript html
Avatar
0
Mar 15
1078
Add context for default create button
javascript python context odooV13
Avatar
0
Mei 20
7798
Javascript Lib to access Odoo Objects and login in odoo for a only js/html/css application.
javascript html html5 odoo
Avatar
0
Des 15
7352
How to execute custom js function when data loaded in Odoo 8.x
javascript jquery html js
Avatar
0
Mei 15
5002
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