Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Weird issue with the last product image changing in odoo

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
javascripthtmlodooV13
5 Răspunsuri
3556 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Sudhir Arya (ERP Harbor Consulting Services)
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Raitis
Autor Cel mai bun răspuns

@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
Imagine profil
Abandonează
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
Autor

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;

});

}

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to set DateTime widget in a utc format?
javascript odooV13
Imagine profil
0
mar. 22
6783
How to create a progress bar with HTML and javascript???
javascript html
Imagine profil
0
mar. 15
1079
Add context for default create button
javascript python context odooV13
Imagine profil
0
mai 20
7805
Javascript Lib to access Odoo Objects and login in odoo for a only js/html/css application.
javascript html html5 odoo
Imagine profil
0
dec. 15
7353
How to execute custom js function when data loaded in Odoo 8.x
javascript jquery html js
Imagine profil
0
mai 15
5007
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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