[FIX] website_sale_comparison: "compare" button position/visibility
Show the "compare" button if attributes&variants exist only. In the product's page render the button in the "Specifications" section only. task#2667024 Part-of: odoo/odoo#79651
This commit is contained in:
committed by
Yannick Tivisse
parent
528429e64c
commit
dfd9da8aab
@@ -11,8 +11,8 @@ odoo.define('website_sale_comparison.tour_comparison', function (require) {
|
||||
}, [
|
||||
// test from shop page
|
||||
{
|
||||
content: "add first product 'Three-Seat Sofa' in a comparison list",
|
||||
trigger: '.oe_product_cart:contains("Three-Seat Sofa") .o_add_compare',
|
||||
content: "add first product 'Warranty' in a comparison list",
|
||||
trigger: '.oe_product_cart:contains("Warranty") .o_add_compare',
|
||||
},
|
||||
{
|
||||
content: "check compare button contains one product",
|
||||
@@ -36,7 +36,7 @@ odoo.define('website_sale_comparison.tour_comparison', function (require) {
|
||||
},
|
||||
{
|
||||
content: "check products name are correct in the comparelist",
|
||||
extra_trigger: '.o_product_row:contains("Three-Seat Sofa")',
|
||||
extra_trigger: '.o_product_row:contains("Warranty")',
|
||||
trigger: '.o_product_row:contains("Conference Chair")',
|
||||
run: function () {},
|
||||
},
|
||||
@@ -126,7 +126,7 @@ odoo.define('website_sale_comparison.tour_comparison', function (require) {
|
||||
},
|
||||
{
|
||||
content: "check 4th product is correctly added",
|
||||
trigger: '.o_product_comparison_table:contains("Three-Seat Sofa")',
|
||||
trigger: '.o_product_comparison_table:contains("Warranty")',
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
@@ -140,20 +140,20 @@ odoo.define('website_sale_comparison.tour_comparison', function (require) {
|
||||
},
|
||||
{
|
||||
content: "open compare menu",
|
||||
extra_trigger: 'body:has(.o_product_row:contains("Three-Seat Sofa") .o_remove)',
|
||||
extra_trigger: 'body:has(.o_product_row:contains("Warranty") .o_remove)',
|
||||
trigger: '.o_product_panel_header',
|
||||
},
|
||||
{
|
||||
content: "remove product",
|
||||
trigger: '.o_product_row:contains("Three-Seat Sofa") .o_remove',
|
||||
trigger: '.o_product_row:contains("Warranty") .o_remove',
|
||||
},
|
||||
{
|
||||
content: "click on compare button to reload",
|
||||
trigger: '.o_comparelist_button a',
|
||||
},
|
||||
{
|
||||
content: "check product 'Three-Seat Sofa' is removed",
|
||||
trigger: '#o_comparelist_table:not(:contains("Three-Seat Sofa"))',
|
||||
content: "check product 'Warranty' is removed",
|
||||
trigger: '#o_comparelist_table:not(:contains("Warranty"))',
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,27 +3,12 @@
|
||||
|
||||
<template id="add_to_compare" inherit_id="website_sale.products_item" customize_show="True" name="Comparison List" priority="22">
|
||||
<xpath expr="//div[hasclass('o_wsale_product_btn')]" position="inside">
|
||||
<t t-set="product_variant_id" t-value="product._get_first_possible_variant_id()"/>
|
||||
<button t-if="product_variant_id" type="button" role="button" class="d-none d-md-inline-block btn btn-outline-primary bg-white o_add_compare" title="Compare" aria-label="Compare" t-att-data-product-product-id="product_variant_id" data-action="o_comparelist"><span class="fa fa-exchange"></span></button>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="product_add_to_compare" name='Add to comparison in product page' inherit_id="website_sale.product" priority="8">
|
||||
<xpath expr="//div[@id='product_option_block']" position="inside">
|
||||
<t t-set="categories" t-value="product.valid_product_template_attribute_line_ids._prepare_categories_for_display()"/>
|
||||
<t t-if="not (is_view_active('website_sale_comparison.product_attributes_body') and categories)">
|
||||
<t t-call="website_sale_comparison.add_to_compare_button"/>
|
||||
</t>
|
||||
<t t-set="product_variant_id" t-value="product._get_first_possible_variant_id()"/>
|
||||
<button t-if="product_variant_id and categories" type="button" role="button" class="d-none d-md-inline-block btn btn-outline-primary bg-white o_add_compare" title="Compare" aria-label="Compare" t-att-data-product-product-id="product_variant_id" data-action="o_comparelist"><span class="fa fa-exchange"></span></button>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="add_to_compare_button" name='Add To Compare Button'>
|
||||
<t t-if="is_view_active('website_sale_comparison.add_to_compare')">
|
||||
<t t-set="product_variant" t-value="product_variant or product._create_first_product_variant()"/>
|
||||
<button t-if="product_variant" type="button" role="button" class="d-none d-md-block btn btn-link px-0 pr-3 o_add_compare_dyn order-8" aria-label="Compare" t-att-data-product-product-id="product_variant.id" data-action="o_comparelist"><span class="fa fa-exchange mr-2"></span>Compare</button>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="product_attributes_body" inherit_id="website_sale.product" customize_show="True" name="Product attributes table">
|
||||
<xpath expr="//div[@id='product_attributes_simple']" position="replace"/>
|
||||
<xpath expr="//div[@id='product_full_description']" position="after">
|
||||
@@ -31,9 +16,12 @@
|
||||
<t t-if="categories">
|
||||
<section class="pt32 pb32" id="product_full_spec">
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h3 class="mb32">Specifications</h3>
|
||||
<t t-call="website_sale_comparison.add_to_compare_button"/>
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h3 class="m-0">Specifications</h3>
|
||||
<t t-if="is_view_active('website_sale_comparison.add_to_compare')">
|
||||
<t t-set="product_variant" t-value="product_variant or product._create_first_product_variant()"/>
|
||||
<button t-if="product_variant" type="button" role="button" class="d-none d-md-block btn btn-link px-0 o_add_compare_dyn" aria-label="Compare" t-att-data-product-product-id="product_variant.id" data-action="o_comparelist"><span class="fa fa-exchange mr-2"></span>Compare</button>
|
||||
</t>
|
||||
</div>
|
||||
<div id="product_specifications">
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user