From ecefa679b224ce0e4a5a7e91ce28936321132d9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Souk=C3=A9ina=20Bojabza?= <sobo@odoo.com>
Date: Mon, 17 Apr 2023 13:47:23 +0000
Subject: [PATCH] [FIX] website_sale: fix cart popover on hover for all header
 templates

Before this commit, when hovering the shopping cart in the "Boxed" and
"Centered Logo" header templates, the cart popover was not appearing.

This happened because the `websiteSaleCartLink` public widget was never
started with these templates and so, hovering the cart had no effect.
This is due to this widget selector which targeted a cart link located
inside an element with id `#top_menu`, which is not the case in these
templates where the cart link is located outside of it.

This commit fixes this widget selector, in order for the cart link to be
reachable in all header templates.

opw-3267114

closes odoo/odoo#118822

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
---
 addons/website_sale/static/src/js/website_sale.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index e453bfa0cd96..fa96392c5b7c 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -8,7 +8,8 @@ var _t = core._t;
 var timeout;
 
 publicWidget.registry.websiteSaleCartLink = publicWidget.Widget.extend({
-    selector: '#top_menu a[href$="/shop/cart"]',
+    // TODO in master: remove the second selector.
+    selector: '#top a[href$="/shop/cart"], #top_menu a[href$="/shop/cart"]',
     events: {
         'mouseenter': '_onMouseEnter',
         'mouseleave': '_onMouseLeave',
-- 
GitLab