Browse Source

Nov 10 : [FIX] Bug Fixed 'website_hide_button'

pull/295/head
RisvanaCybro 2 years ago
parent
commit
96bb28fa17
  1. 15
      website_hide_button/README.rst
  2. 19
      website_hide_button/__manifest__.py
  3. 14
      website_hide_button/controllers/website_sale.py
  4. 4
      website_hide_button/doc/RELEASE_NOTES.md
  5. BIN
      website_hide_button/static/description/assets/modules/l2.png
  6. BIN
      website_hide_button/static/description/assets/modules/l3.png
  7. BIN
      website_hide_button/static/description/assets/modules/l4.png
  8. BIN
      website_hide_button/static/description/assets/modules/l5.png
  9. BIN
      website_hide_button/static/description/assets/modules/l6.png
  10. BIN
      website_hide_button/static/description/banner.jpg
  11. 92
      website_hide_button/static/description/index.html
  12. 291
      website_hide_button/views/product_template.xml
  13. 15
      website_hide_button/views/product_templates.xml
  14. 36
      website_hide_button/views/shop_template.xml
  15. 9
      website_hide_button/views/shop_templates.xml

15
website_hide_button/README.rst

@ -1,22 +1,27 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
"Website Hide Button"
=======================
Hide Price, Add To Cart and Quantity for guest users
"Hide Price, Add To Cart And Quantity Button In Website"
=========================================================
Hide Price, Add To Cart button and Quantity for guest users in Website.
Configuration
=============
* No additional configurations needed
License
-------
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3)
(https://www.gnu.org/licenses/agpl-3.0-standalone.html)
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
Developer: Unnimaya C O @cybrosys, Contact: odoo@cybrosys.com
Developer: (V16) Unnimaya C O, Contact: odoo@cybrosys.com
Contacts
--------

19
website_hide_button/__manifest__.py

@ -20,21 +20,24 @@
#
###############################################################################
{
'name': "Website Hide Button",
'name': "Hide Price, Add To Cart And Quantity Button In Website",
'version': '16.0.1.0.0',
'category': 'Website/Website',
'summary': 'Hide Price, Add To Cart and Quantity for guest users',
'description': 'This app helps to hide Price, Add to Cart and Quantity buttons for guest users',
'category': 'Website',
'summary': """Hide Price, Add To Cart and Quantity button for guest
users""",
'description': """Login user can see Price of the Product in shop page and
Price of the Product, Quantity and Add To Cart button. But these
features will be hidden for guest users.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'images': ['static/description/banner.jpg'],
'website': 'https://www.cybrosys.com',
'depends': ['base', 'website_sale'],
'depends': ['website_sale'],
'data': [
'views/product_template.xml',
'views/shop_template.xml',
'views/product_templates.xml',
'views/shop_templates.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,
'auto_install': False,

14
website_hide_button/controllers/website_sale.py

@ -19,6 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from odoo import http
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
@ -26,13 +27,18 @@ from odoo.addons.website_sale.controllers.main import WebsiteSale
class WebsiteSaleInherit(WebsiteSale):
"""class to hide price, add to cart and quantity"""
@http.route([
'''/shop''',
'''/shop/page/<int:page>''',
'''/shop/category/<model("product.public.category"):category>''',
'''/shop/category/<model("product.public.category"):category>/
page/<int:page>'''
], type='http', auth="public", website=True)
def shop(self, page=0, category=None, search='', min_price=0.0,
max_price=0.0, ppg=False, **post):
"""Method for finding log in user or not in shop page """
res = super(WebsiteSaleInherit, self).shop(page=0, category=None,
search='', min_price=0.0,
max_price=0.0, ppg=False,
**post)
res = super().shop(page=0, category=None, search='', min_price=0.0,
max_price=0.0, ppg=False, **post)
res.qcontext.update({
'login_user': False if request.session.uid is None else True
})

4
website_hide_button/doc/RELEASE_NOTES.md

@ -1,7 +1,7 @@
## Module <website_hide_button>
#### 01.04.2023
#### 13.10.2023
#### Version 16.0.1.0.0
#### ADD
- Initial commit for Website Hide Button
- Initial commit for Hide Price, Add To Cart And Quantity Button In Website

BIN
website_hide_button/static/description/assets/modules/l2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 105 KiB

BIN
website_hide_button/static/description/assets/modules/l3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 88 KiB

BIN
website_hide_button/static/description/assets/modules/l4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 140 KiB

BIN
website_hide_button/static/description/assets/modules/l5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 137 KiB

BIN
website_hide_button/static/description/assets/modules/l6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 132 KiB

BIN
website_hide_button/static/description/banner.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 117 KiB

92
website_hide_button/static/description/index.html

@ -1,7 +1,6 @@
<div style="background-color: #714B67; min-height: 600px; width: 100%; padding: 15px; position: relative;">
<!-- TITLE BAR -->
<div
style="border-bottom: 1px solid #875A7B; padding: 15px; display: flex; justify-content: space-between; align-items: center;">
<div style="border-bottom: 1px solid #875A7B; padding: 15px; display: flex; justify-content: space-between; align-items: center;">
<img src="assets/misc/cybrosys-logo.png" width="42" height="42"
style="width: 42px; height: 42px;"/>
<div>
@ -16,19 +15,17 @@
</div>
</div>
<!-- END OF TITLE BAR -->
<!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Website Hide Button</h1>
Hide Price, Add To Cart And Quantity Button In Website</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">
This App Allows only Login users to view the Price, Add To Cart and Quantity Buttons.
This App Allows Only Login Users to View the Price, Add To Cart
Button and Quantity from Website.
</p>
<!-- END OF APP HERO -->
<img src="assets/screenshots/hero.gif"
style="width: 75%; height: auto; position: absolute; margin-left: auto; margin-right: auto; top: 45%; left: 12%; right: auto;"/>
</div>
<!-- NAVIGATION SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px; margin-top: 300px;">
@ -89,7 +86,6 @@
</div>
</div>
<!-- END OF NAVIGATION SECTION -->
<!-- OVERVIEW SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="overview">
@ -105,13 +101,11 @@
<div class="row"
style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;">
<div class="col-sm-12 py-4">
Login user can see Price of the Product in shop page and Price of the Product, Quantity and Add to cart buttons in
Product view in both Community and Enterprise Editions. But these features will be hidden for guest users.
Login user can see Price of the Product, Quantity and Add To Cart
button. But these features will be hidden for guest users.
</div>
</div>
<!-- END OF OVERVIEW SECTION -->
<!-- FEATURES SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="features">
@ -130,23 +124,14 @@
<div class="d-flex align-items-center"
style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Available in Community and Enterprise</span>
<span
style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Hide Price, Add to cart buttons and Quantity of
the product from Guest users. That will be only visible
to login users.</span>
</div>
<div class="d-flex align-items-center"
style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Hide Price, Add to cart Buttons and Quantity of the product from Guest Users</span>
</div>
<div class="d-flex align-items-center"
style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">The Login User can see Price and Add to Cart Buttons and Quantity of the product from Guest Users</span>
</div>
</div>
</div>
<!-- END OF FEATURES SECTION -->
<!-- SCREENSHOTS SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;"
@ -162,34 +147,36 @@
</div>
<div class="row">
<div class="col-sm-12">
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Login user can see the product price in shop page</h3>
<img src="assets/screenshots/Screenshot1.png" class="img-thumbnail"/>
Login user can see the product price in Shop page</h3>
<img src="assets/screenshots/Screenshot1.png"
class="img-thumbnail"/>
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Login user can see Product price, Add to cart and Quantity buttons in Product page.
Login user can see Product Price, ADD TO CART button and
Quantity
in Product page.
</h3>
<img src="assets/screenshots/Screenshot2.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Product price is not visible to Guest user in shop page.</h3>
Product Price is not visible to Guest user in Shop page.</h3>
<img src="assets/screenshots/Screenshot3.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Product price, Add to cart and Quantity buttons are hided for Guest users in Product page
Product Price, ADD TO CART button and Quantity are hided
for
Guest users in Product page
</h3>
<img src="assets/screenshots/Screenshot4.png" class="img-thumbnail">
</div>
</div>
</div>
<!-- END OF SCREENSHOTS SECTION -->
<!-- RELATED PRODUCTS -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
@ -222,7 +209,7 @@
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/woo_commerce/"
<a href="https://apps.odoo.com/apps/modules/16.0/odoo_website_helpdesk/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
@ -233,7 +220,7 @@
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/shopify_odoo_connector/"
<a href="https://apps.odoo.com/apps/modules/16.0/odoo_website_helpdesk_dashboard/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
@ -247,7 +234,7 @@
style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/odoo_dynamic_dashboard/"
<a href="https://apps.odoo.com/apps/modules/16.0/website_pdf_preview_snippet/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
@ -258,7 +245,7 @@
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/custom_gantt_view/"
<a href="https://apps.odoo.com/apps/modules/16.0/website_portal_events/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
@ -269,7 +256,7 @@
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/16.0/pos_credit_limit/"
<a href="https://apps.odoo.com/apps/modules/16.0/website_pre_loader_style/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
@ -296,9 +283,7 @@
</div>
</div>
<!-- END OF RELATED PRODUCTS -->
<!-- OUR SERVICES -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
@ -310,7 +295,6 @@
Our Services
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
@ -324,7 +308,6 @@
Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -336,7 +319,6 @@
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -348,8 +330,6 @@
Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -362,7 +342,6 @@
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -374,7 +353,6 @@
Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -386,8 +364,6 @@
Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -399,7 +375,6 @@
Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -411,7 +386,6 @@
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -424,13 +398,9 @@
Licensing Consultancy</h6>
</div>
</div>
</div>
<!--END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
@ -443,7 +413,6 @@
Industries
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-3">
@ -460,7 +429,6 @@
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -475,7 +443,6 @@
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -489,7 +456,6 @@
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -504,7 +470,6 @@
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -519,7 +484,6 @@
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -533,7 +497,6 @@
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -547,7 +510,6 @@
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
@ -564,9 +526,7 @@
</div>
</div>
</div>
<!-- END OF OUR INDUSTRIES -->
<!-- SUPPORT -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
@ -625,4 +585,4 @@
</div>
</div>
</div>
<!-- END OF SUPPORT -->
<!-- END OF SUPPORT -->

291
website_hide_button/views/product_template.xml

@ -1,291 +0,0 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<odoo>
<template id="product_view" inherit_id="website_sale.product">
<xpath expr="//div[@id='wrap']" position="replace">
<t t-if="login_user== False">
<!-- Product View of login user-->
<div itemscope="itemscope" itemtype="http://schema.org/Product" id="wrap" class="js_sale o_wsale_product_page">
<div class="oe_structure oe_empty oe_structure_not_nearest" id="oe_structure_website_sale_product_1" data-editor-message="DROP BUILDING BLOCKS HERE TO MAKE THEM AVAILABLE ACROSS ALL PRODUCTS"/>
<section t-attf-class="container py-4 oe_website_sale #{'discount' if combination_info['has_discounted_price'] else ''}" id="product_detail"
t-att-data-view-track="view_track and '1' or '0'"
t-att-data-product-tracking-info="json.dumps(request.env['product.template'].get_google_analytics_data(combination_info))">
<div class="row align-items-center">
<div class="col-lg-6 d-flex align-items-center">
<div class="d-flex justify-content-between w-100">
<t t-call="website_sale.search">
<t t-set="search" t-value="False"/>
<t t-set="_form_classes" t-valuef="mb-2 mb-lg-0"/>
<t t-set="_classes" t-value="'me-sm-2'"/>
</t>
<t t-set="website_sale_pricelists" t-value="website.get_pricelist_available(show_visible=True)" />
<t t-set="hasPricelistDropdown" t-value="website_sale_pricelists and len(website_sale_pricelists)&gt;1"/>
<t t-call="website_sale.pricelist_list">
<t t-set="_classes" t-valuef="d-lg-inline ms-2"/>
</t>
</div>
</div>
<div class="col-lg-6 d-flex align-items-center">
<ol class="breadcrumb p-0 mb-2 m-lg-0">
<li class="breadcrumb-item o_not_editable">
<a t-att-href="keep(category=0)">All Products</a>
</li>
<li t-if="category" class="breadcrumb-item">
<a t-att-href="keep('/shop/category/%s' % slug(category), category=0)" t-field="category.name" />
</li>
<li class="breadcrumb-item active">
<span t-field="product.name" />
</li>
</ol>
</div>
</div>
<div class="row" id="product_detail_main" data-name="Product Page"
t-att-data-image_width="website.product_page_image_width"
t-att-data-image_layout="website.product_page_image_layout">
<t t-set="image_cols" t-value="website._get_product_page_proportions()"/>
<div t-attf-class="col-lg-#{image_cols[0]} mt-lg-4 o_wsale_product_images position-relative" t-if="website.product_page_image_width != 'none'">
<t t-call="website_sale.shop_product_images"/>
</div>
<div t-attf-class="col-lg-#{image_cols[1]} mt-md-4" id="product_details">
<t t-set="base_url" t-value="product.get_base_url()"/>
<h1 itemprop="name" t-field="product.name">Product Name</h1>
<span itemprop="url" style="display:none;" t-esc="base_url + product.website_url"/>
<span itemprop="image" style="display:none;" t-esc="base_url + website.image_url(product, 'image_1920')" />
<t t-if="is_view_active('website_sale.product_comment')">
<a href="#o_product_page_reviews" class="o_product_page_reviews_link text-decoration-none">
<t t-call="portal_rating.rating_widget_stars_static">
<t t-set="rating_avg" t-value="product.rating_avg"/>
<t t-set="trans_text_plural">%s reviews</t>
<t t-set="trans_text_singular">%s review</t>
<t t-set="rating_count" t-value="(trans_text_plural if product.rating_count > 1 else trans_text_singular) % product.rating_count"/>
</t>
</a>
</t>
<p t-field="product.description_sale" class="text-muted my-2" placeholder="A short description that will also appear on documents." />
<form t-if="product._is_add_to_cart_possible()" action="/shop/cart/update" method="POST">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="js_product js_main_product mb-3">
<t t-placeholder="select">
<input type="hidden" class="product_id" name="product_id" t-att-value="product_variant.id" />
<input type="hidden" class="product_template_id" name="product_template_id" t-att-value="product.id" />
<input t-if="product.public_categ_ids.ids" type="hidden" class="product_category_id" name="product_category_id" t-att-value="product.public_categ_ids.ids[0]" />
<input t-if="product.product_tag_ids.ids" type="hidden" class="product_tag_id" name="product_tag_id" t-att-value="product.product_tag_ids.ids[0]" />
<t t-if="combination" t-call="sale.variants">
<t t-set="ul_class" t-valuef="flex-column" />
<t t-set="parent_combination" t-value="None" />
</t>
<t t-else="">
<ul class="d-none js_add_cart_variants mb-0" t-att-data-attribute_exclusions="{'exclusions: []'}"/>
</t>
</t>
<p t-if="True" class="css_not_available_msg alert alert-warning">This combination does not exist.</p>
<div id="o_wsale_cta_wrapper" class="d-flex flex-wrap align-items-center">
<t t-set="hasQuantities" t-value="false"/>
<t t-set="hasBuyNow" t-value="false"/>
<t t-set="ctaSizeBig" t-value="not hasQuantities or not hasBuyNow"/>
<div id="product_option_block" class="d-flex flex-wrap w-100"/>
</div>
<div id="contact_us_wrapper"
t-attf-class="{{'d-flex' if combination_info['prevent_zero_price_sale'] else 'd-none'}} oe_structure oe_structure_solo #{_div_classes}">
<section class="s_text_block" data-snippet="s_text_block" data-name="Text">
<div class="container">
<a t-att-href="website.contact_us_button_url"
class="btn btn-primary btn_cta">Contact Us
</a>
</div>
</section>
</div>
</div>
</form>
<p t-elif="not product.active" class="alert alert-warning">This product is no longer available.</p>
<p t-else="" class="alert alert-warning">This product has no valid combination.</p>
<div id="product_attributes_simple">
<t t-set="single_value_attributes" t-value="product.valid_product_template_attribute_line_ids._prepare_single_value_for_display()"/>
<table t-attf-class="table table-sm text-muted {{'' if single_value_attributes else 'd-none'}}">
<t t-foreach="single_value_attributes" t-as="attribute">
<tr>
<td>
<span t-field="attribute.name"/>:
<t t-foreach="single_value_attributes[attribute]" t-as="ptal">
<span t-field="ptal.product_template_value_ids._only_active().name"/><t t-if="not ptal_last">, </t>
</t>
</td>
</tr>
</t>
</table>
</div>
<div id="o_product_terms_and_share" class="d-flex justify-content-between flex-column flex-md-row align-items-md-end mb-3">
</div>
</div>
</div>
</section>
<div itemprop="description" t-field="product.website_description" class="oe_structure oe_empty mt16" id="product_full_description"/>
<div class="oe_structure oe_empty oe_structure_not_nearest mt16" id="oe_structure_website_sale_product_2" data-editor-message="DROP BUILDING BLOCKS HERE TO MAKE THEM AVAILABLE ACROSS ALL PRODUCTS"/>
</div>
</t>
<t t-else="">
<!-- Product View of Guest user-->
<div itemscope="itemscope" itemtype="http://schema.org/Product" id="wrap" class="js_sale o_wsale_product_page">
<div class="oe_structure oe_empty oe_structure_not_nearest" id="oe_structure_website_sale_product_1" data-editor-message="DROP BUILDING BLOCKS HERE TO MAKE THEM AVAILABLE ACROSS ALL PRODUCTS"/>
<section t-attf-class="container py-4 oe_website_sale #{'discount' if combination_info['has_discounted_price'] else ''}" id="product_detail"
t-att-data-view-track="view_track and '1' or '0'"
t-att-data-product-tracking-info="json.dumps(request.env['product.template'].get_google_analytics_data(combination_info))">
<div class="row align-items-center">
<div class="col-lg-6 d-flex align-items-center">
<div class="d-flex justify-content-between w-100">
<t t-call="website_sale.search">
<t t-set="search" t-value="False"/>
<t t-set="_form_classes" t-valuef="mb-2 mb-lg-0"/>
<t t-set="_classes" t-value="'me-sm-2'"/>
</t>
<t t-set="website_sale_pricelists" t-value="website.get_pricelist_available(show_visible=True)" />
<t t-set="hasPricelistDropdown" t-value="website_sale_pricelists and len(website_sale_pricelists)&gt;1"/>
<t t-call="website_sale.pricelist_list">
<t t-set="_classes" t-valuef="d-lg-inline ms-2"/>
</t>
</div>
</div>
<div class="col-lg-6 d-flex align-items-center">
<ol class="breadcrumb p-0 mb-2 m-lg-0">
<li class="breadcrumb-item o_not_editable">
<a t-att-href="keep(category=0)">All Products</a>
</li>
<li t-if="category" class="breadcrumb-item">
<a t-att-href="keep('/shop/category/%s' % slug(category), category=0)" t-field="category.name" />
</li>
<li class="breadcrumb-item active">
<span t-field="product.name" />
</li>
</ol>
</div>
</div>
<div class="row" id="product_detail_main" data-name="Product Page"
t-att-data-image_width="website.product_page_image_width"
t-att-data-image_layout="website.product_page_image_layout">
<t t-set="image_cols" t-value="website._get_product_page_proportions()"/>
<div t-attf-class="col-lg-#{image_cols[0]} mt-lg-4 o_wsale_product_images position-relative" t-if="website.product_page_image_width != 'none'">
<t t-call="website_sale.shop_product_images"/>
</div>
<div t-attf-class="col-lg-#{image_cols[1]} mt-md-4" id="product_details">
<t t-set="base_url" t-value="product.get_base_url()"/>
<h1 itemprop="name" t-field="product.name">Product Name</h1>
<span itemprop="url" style="display:none;" t-esc="base_url + product.website_url"/>
<span itemprop="image" style="display:none;" t-esc="base_url + website.image_url(product, 'image_1920')" />
<t t-if="is_view_active('website_sale.product_comment')">
<a href="#o_product_page_reviews" class="o_product_page_reviews_link text-decoration-none">
<t t-call="portal_rating.rating_widget_stars_static">
<t t-set="rating_avg" t-value="product.rating_avg"/>
<t t-set="trans_text_plural">%s reviews</t>
<t t-set="trans_text_singular">%s review</t>
<t t-set="rating_count" t-value="(trans_text_plural if product.rating_count > 1 else trans_text_singular) % product.rating_count"/>
</t>
</a>
</t>
<p t-field="product.description_sale" class="text-muted my-2" placeholder="A short description that will also appear on documents." />
<form t-if="product._is_add_to_cart_possible()" action="/shop/cart/update" method="POST">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
<div class="js_product js_main_product mb-3">
<div>
<t t-call="website_sale.product_price"/>
<small t-if="combination_info['base_unit_price']"
class="ms-1 text-muted o_base_unit_price_wrapper d-none" groups="website_sale.group_show_uom_price">
<t t-call='website_sale.base_unit_price'/>
</small>
</div>
<t t-placeholder="select">
<input type="hidden" class="product_id" name="product_id" t-att-value="product_variant.id" />
<input type="hidden" class="product_template_id" name="product_template_id" t-att-value="product.id" />
<input t-if="product.public_categ_ids.ids" type="hidden" class="product_category_id" name="product_category_id" t-att-value="product.public_categ_ids.ids[0]" />
<input t-if="product.product_tag_ids.ids" type="hidden" class="product_tag_id" name="product_tag_id" t-att-value="product.product_tag_ids.ids[0]" />
<t t-if="combination" t-call="sale.variants">
<t t-set="ul_class" t-valuef="flex-column" />
<t t-set="parent_combination" t-value="None" />
</t>
<t t-else="">
<ul class="d-none js_add_cart_variants mb-0" t-att-data-attribute_exclusions="{'exclusions: []'}"/>
</t>
</t>
<p t-if="True" class="css_not_available_msg alert alert-warning">This combination does not exist.</p>
<div id="o_wsale_cta_wrapper" class="d-flex flex-wrap align-items-center">
<t t-set="hasQuantities" t-value="false"/>
<t t-set="hasBuyNow" t-value="false"/>
<t t-set="ctaSizeBig" t-value="not hasQuantities or not hasBuyNow"/>
<div id="add_to_cart_wrap" t-attf-class="{{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-flex'}} align-items-center mb-2 me-auto">
<a role="button" id="add_to_cart" t-attf-class="btn btn-primary js_check_product a-submit flex-grow-1 #{'btn-lg' if ctaSizeBig else ''}" href="#">
<i class="fa fa-shopping-cart me-2"/>
<span style="font-weight: bold">ADD TO CART</span>
</a>
</div>
<div id="product_option_block" class="d-flex flex-wrap w-100"/>
</div>
<div id="contact_us_wrapper"
t-attf-class="{{'d-flex' if combination_info['prevent_zero_price_sale'] else 'd-none'}} oe_structure oe_structure_solo #{_div_classes}">
<section class="s_text_block" data-snippet="s_text_block" data-name="Text">
<div class="container">
<a t-att-href="website.contact_us_button_url"
class="btn btn-primary btn_cta">Contact Us
</a>
</div>
</section>
</div>
</div>
</form>
<p t-elif="not product.active" class="alert alert-warning">This product is no longer available.</p>
<p t-else="" class="alert alert-warning">This product has no valid combination.</p>
<div id="product_attributes_simple">
<t t-set="single_value_attributes" t-value="product.valid_product_template_attribute_line_ids._prepare_single_value_for_display()"/>
<table t-attf-class="table table-sm text-muted {{'' if single_value_attributes else 'd-none'}}">
<t t-foreach="single_value_attributes" t-as="attribute">
<tr>
<td>
<span t-field="attribute.name"/>:
<t t-foreach="single_value_attributes[attribute]" t-as="ptal">
<span t-field="ptal.product_template_value_ids._only_active().name"/><t t-if="not ptal_last">, </t>
</t>
</td>
</tr>
</t>
</table>
</div>
<div id="o_product_terms_and_share" class="d-flex justify-content-between flex-column flex-md-row align-items-md-end mb-3">
</div>
</div>
</div>
</section>
<div itemprop="description" t-field="product.website_description" class="oe_structure oe_empty mt16" id="product_full_description"/>
<div class="oe_structure oe_empty oe_structure_not_nearest mt16" id="oe_structure_website_sale_product_2" data-editor-message="DROP BUILDING BLOCKS HERE TO MAKE THEM AVAILABLE ACROSS ALL PRODUCTS"/>
</div>
</t>
</xpath>
</template>
<template id="product_quantity" inherit_id="website_sale.product" name="Select Quantity">
<xpath expr="//t[@t-set='hasQuantities']" position="attributes">
<!-- Product quantity view of Login user-->
<t t-if="login_user!= False">
<attribute name="t-value" remove="false" add="true" separator=" "/>
</t>
</xpath>
<xpath expr="//div[@id='add_to_cart_wrap']" position="before">
<div t-attf-class="css_quantity input-group {{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-flex'}} me-2 mb-2 align-middle #{'input-group-lg' if ctaSizeBig else ''}"
contenteditable="false">
<!-- Add to cart button of Login user-->
<t t-if="login_user!= False">
<a t-attf-href="#" class="btn btn-link js_add_cart_json" aria-label="Remove one" title="Remove one">
<i class="fa fa-minus"/>
</a>
<input type="text" class="form-control quantity text-center" data-min="1" name="add_qty"
t-att-value="add_qty or 1"/>
<a t-attf-href="#" class="btn btn-link float_left js_add_cart_json" aria-label="Add one"
title="Add one">
<i class="fa fa-plus"/>
</a>
</t>
</div>
</xpath>
</template>
</odoo>

15
website_hide_button/views/product_templates.xml

@ -0,0 +1,15 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<odoo>
<!-- 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>
</xpath>
</template>
<!-- Hide Product price for guest users -->
<template id="product_price" inherit_id="website_sale.product_price">
<xpath expr="//div[@itemprop='offers']" position="attributes">
<attribute name="t-if">login_user == True</attribute>
</xpath>
</template>
</odoo>

36
website_hide_button/views/shop_template.xml

@ -1,36 +0,0 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<odoo>
<template id="product_item_view" inherit_id="website_sale.products_item">
<xpath expr="//div[hasclass('product_price')]" position="replace">
<!-- Shop View of Login User-->
<t t-if="login_user== True">
<div class="product_price" itemprop="offers"
itemscope="itemscope" itemtype="http://schema.org/Offer">
<t t-if="'base_price' in template_price_vals">
<del t-attf-class="text-muted me-1 h6 mb-0"
style="white-space: nowrap;">
<em class="small"
t-esc="template_price_vals['base_price']"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
</del>
</t>
<span class="h6 mb-0"
t-if="template_price_vals['price_reduce'] or not website.prevent_zero_price_sale"
t-esc="template_price_vals['price_reduce']"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
<span class="h6 mb-0" t-else=""
t-field="website.prevent_zero_price_sale_text"/>
<span itemprop="price" style="display:none;"
t-esc="template_price_vals['price_reduce']"/>
<span itemprop="priceCurrency" style="display:none;"
t-esc="website.currency_id.name"/>
</div>
</t>
<t t-else="">
<!-- Product View of Guest User-->
<div class="product_price" itemprop="offers"
itemscope="itemscope" itemtype="http://schema.org/Offer"/>
</t>
</xpath>
</template>
</odoo>

9
website_hide_button/views/shop_templates.xml

@ -0,0 +1,9 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<odoo>
<!-- Hide product price for Guest users -->
<template id="products_item" inherit_id="website_sale.products_item">
<xpath expr="//div[hasclass('product_price')]" position="attributes">
<attribute name="t-if">login_user == True</attribute>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save