Browse Source

Oct 08: [FIX] Bug Fixed 'website_hide_button'

pull/347/head
Cybrosys Technologies 7 months ago
parent
commit
b2cb0ce4da
  1. 2
      website_hide_button/__manifest__.py
  2. 13
      website_hide_button/controllers/website_sale.py
  3. 4
      website_hide_button/doc/RELEASE_NOTES.md
  4. 10
      website_hide_button/views/product_templates.xml

2
website_hide_button/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': "Hide Price, Add To Cart And Quantity Button In Website",
'version': '17.0.2.0.0',
'version': '17.0.2.0.1',
'category': 'Website',
'summary': """Hide Price, Add To Cart and Quantity button for guest
users""",

13
website_hide_button/controllers/website_sale.py

@ -40,10 +40,9 @@ class WebsiteSaleInherit(WebsiteSale):
res = super().shop(page, category, search, min_price,
max_price, ppg, **post)
res.qcontext.update({
'login_user': True if not request.env.user._is_public() or (
request.env.user._is_public() and not request.env[
'login_user': True if request.env.user._is_public() and request.env[
'ir.config_parameter'].sudo().get_param(
'website_hide_button.hide_cart')) else False,
'website_hide_button.hide_cart') else False
})
return res
@ -53,10 +52,10 @@ class WebsiteSaleInherit(WebsiteSale):
category,
search,
**kwargs)
res['login_user'] = True if not request.env.user._is_public() or (
request.env.user._is_public() and not request.env[
'ir.config_parameter'].sudo().get_param(
'website_hide_button.hide_cart')) else False
res['login_user'] = True if request.env.user._is_public() and \
request.env[
'ir.config_parameter'].sudo().get_param(
'website_hide_button.hide_cart') else False
return res
@http.route()

4
website_hide_button/doc/RELEASE_NOTES.md

@ -11,3 +11,7 @@
- Bug Fix-Added an option in the general settings of the Website module to enable 'Hide Cart for Guests' and 'Hide Product Prices from Guests'.
#### 08.10.2024
#### Version 17.0.2.0.1
##### UPDT
- Bug Fix - Hide the visibility add to cart and price

10
website_hide_button/views/product_templates.xml

@ -2,11 +2,11 @@
<odoo>
<!-- Hide Add To Cart Button and quantity selector for public users -->
<template id="product_hide" inherit_id="website_sale.product">
<xpath expr="//a[@id='add_to_cart']" position="before">
<xpath expr="//div[@id='o_product_terms_and_share']" position="before">
<div class="alert alert-info"
t-if="request.env.user._is_public() and request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_cart')">
t-if="login_user">
<i class="fa fa-info-circle"/>
<span>Please Log in to see price and buy options.</span>
<span>Please Log in to see buy options.</span>
</div>
</xpath>
<xpath expr="//a[@id='add_to_cart']" position="attributes">
@ -20,7 +20,7 @@
<!-- Hide Add To Cart button for guest users -->
<template id="product" inherit_id="website_sale.product">
<xpath expr="//div[@id='o_wsale_cta_wrapper']" position="attributes">
<attribute name="t-if">login_user == True</attribute>
<attribute name="t-if">login_user == False</attribute>
</xpath>
</template>
<!-- Hide Product price in price_widget -->
@ -28,7 +28,7 @@
<xpath expr="//div[@itemprop='offers']" position="attributes">
<attribute name="t-if">not request.env.user._is_public() or
(request.env.user._is_public() and not
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_pricet'))
request.env['ir.config_parameter'].sudo().get_param('website_hide_button.hide_price'))
</attribute>
</xpath>
</template>

Loading…
Cancel
Save