[IMP] website_sale: add an option to always show cart

Before this commit the cart was hidden when it was empty. Now we have
added a new option to display it any time.

Part of https://github.com/odoo/odoo/pull/49142
task-2229551
This commit is contained in:
Benjamin Vray
2020-06-30 14:19:17 +00:00
committed by qsm-odoo
parent 82cc411fc5
commit 257de793ca
2 changed files with 16 additions and 1 deletions
+8
View File
@@ -95,6 +95,14 @@
<we-button data-change-sequence="bottom">Push to bottom</we-button>
</div>
</div>
<div data-selector="#wrapwrap > header"
data-no-check="true"
groups="website.group_website_designer">
<we-checkbox string="Always Show Cart"
data-customize-website-views="website_sale.hide_cart_if_empty|"
data-no-preview="true"
data-reload="/"/>
</div>
</xpath>
</template>
+8 -1
View File
@@ -75,8 +75,9 @@
<template id="header" inherit_id="website.layout" name="Header Shop My Cart Link">
<xpath expr="//header//ul[@id='top_menu']/li" position="before">
<t t-set="website_sale_order" t-value="website.sale_get_order()" />
<t t-set="show_cart" t-value="true"/>
<li class="nav-item divider d-none"/> <!-- Make sure the cart and related menus are not folded (see autohideMenu) -->
<li t-attf-class="nav-item o_wsale_my_cart #{'' if website_sale_order and website_sale_order.cart_quantity else 'd-none'}">
<li t-attf-class="nav-item o_wsale_my_cart #{not show_cart and 'd-none'}">
<a href="/shop/cart" class="nav-link">
<i class="fa fa-shopping-cart"></i>
My Cart <sup t-attf-class="my_cart_quantity badge badge-primary" t-esc="website_sale_order and website_sale_order.cart_quantity or ''" t-att-data-order-id="website_sale_order and website_sale_order.id or ''"/>
@@ -85,6 +86,12 @@
</xpath>
</template>
<template id="hide_cart_if_empty" inherit_id="website_sale.header" name="Hide Cart If Empty">
<xpath expr="//t[@t-set='show_cart']" position="after">
<t t-set="show_cart" t-value="show_cart and website_sale_order and website_sale_order.cart_quantity" />
</xpath>
</template>
<!-- Products Search Bar input-group template -->
<template id="website_sale_products_search_box" inherit_id="website.website_search_box" primary="True">
<xpath expr="//input[@name='search']" position="attributes">