Skip to content

Commit

Permalink
[FIX]website_sale_hide_price: improve button visibility logic
Browse files Browse the repository at this point in the history
Replaced view inheritance with Python logic in _website_show_quick_add
to fix an issue where the "Add to Cart" button visibility was
incorrectly overridden by this module. This update restores the
expected behavior by ensuring the inherited logic determines button
visibility.
  • Loading branch information
LuisAlejandroS committed Nov 21, 2024
1 parent f1d2003 commit cc3b092
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions website_sale_hide_price/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ def _search_render_results(self, fetch_fields, mapping, icon, limit):
}
)
return results_data

def _website_show_quick_add(self):
website_show_price = (
self.env["website"].get_current_website().website_show_price
)
return (
website_show_price and not self.website_hide_price
) and super()._website_show_quick_add()
8 changes: 0 additions & 8 deletions website_sale_hide_price/views/website_sale_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@
</attribute>
</xpath>
</template>
<!-- Hide add to cart button if "Add to cart" option is enabled and not website_show_price -->
<template id="products_add_to_cart" inherit_id="website_sale.products_add_to_cart">
<xpath expr="//a[hasclass('a-submit')]" position="attributes">
<attribute name="t-if">
website.website_show_price and not product.website_hide_price
</attribute>
</xpath>
</template>
<template id="website_search_box" inherit_id="website.website_search_box">
<xpath expr="//input[@name='search']" position="attributes">
<attribute
Expand Down

0 comments on commit cc3b092

Please sign in to comment.