Skip to content

Commit

Permalink
[IMP] website_sale: hide the cart's badge if the product count is 0
Browse files Browse the repository at this point in the history
task-3097005

Part-of: odoo#120302
  • Loading branch information
stefanorigano authored and qsm-odoo committed Oct 8, 2023
1 parent a4377bf commit 010c047
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions addons/website_sale/static/src/js/website_sale_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function updateCartNavBar(data) {
sessionStorage.setItem('website_sale_cart_quantity', data.cart_quantity);
$(".my_cart_quantity")
.parents('li.o_wsale_my_cart').removeClass('d-none').end()
.toggleClass('d-none', data.cart_quantity === 0)
.addClass('o_mycart_zoom_animation').delay(300)
.queue(function () {
$(this)
Expand Down
2 changes: 1 addition & 1 deletion addons/website_sale/views/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href="/shop/cart" t-attf-class="#{_link_class}">
<i t-if="_icon" class="fa fa-shopping-cart"/>
<span t-if="_text">My Cart</span>
<sup class="my_cart_quantity badge text-bg-primary" t-esc="website_sale_cart_quantity" t-att-data-order-id="request.session.get('sale_order_id', '')"/>
<sup t-attf-class="my_cart_quantity badge text-bg-primary #{'d-none' if (website_sale_cart_quantity == 0) else ''}" t-esc="website_sale_cart_quantity" t-att-data-order-id="request.session.get('sale_order_id', '')"/>
</a>
</li>
</t>
Expand Down

0 comments on commit 010c047

Please sign in to comment.