Browse Source

Nov 3 : [FIX] Bug Fixed 'call_for_price_website'

pull/295/head
AjmalCybro 2 years ago
parent
commit
b1398e050f
  1. 2
      call_for_price_website/__manifest__.py
  2. 16
      call_for_price_website/static/src/js/variant_mixin.js
  3. 2
      call_for_price_website/views/compare_hide_price_template.xml
  4. 362
      call_for_price_website/views/shop_hide_call_price_template.xml
  5. 14
      call_for_price_website/views/wishlist_hide_price_template.xml

2
call_for_price_website/__manifest__.py

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
{ {
'name': 'Website Call For Price', 'name': 'Website Call For Price',
'version': '16.0.1.0.1', 'version': '16.0.2.0.0',
'category': 'Website', 'category': 'Website',
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',

16
call_for_price_website/static/src/js/variant_mixin.js

@ -49,9 +49,11 @@ odoo.define('call_for_price_website.CustomVariantMixin', function(require) {
addToCart.removeClass('d-inline-flex').addClass('d-none'); addToCart.removeClass('d-inline-flex').addClass('d-none');
contactUsButton.removeClass('d-none').addClass('d-flex'); contactUsButton.removeClass('d-none').addClass('d-flex');
price_call_div.removeClass('d-none').addClass('d-flex'); price_call_div.removeClass('d-none').addClass('d-flex');
this.$el.find('#add_to_cart')[0].style.display = "none"; this.$el.find('#add_to_cart').removeClass('d-block').addClass('d-none');
this.$el.find('#price_of_product')[0].style.display = "none"; this.$el.find('#price_of_product').removeClass('d-block').addClass('d-none');
this.$el.find('#price_of_product')[0].style.display = "none"; this.$el.find('#price_of_product').removeClass('d-block').addClass('d-none');
this.$el.find('.js_add_cart_json').removeClass('d-block').addClass('d-none');
this.$el.find('.quantity').removeClass('d-block').addClass('d-none');
} else { } else {
productPrice.removeClass('d-none').addClass('d-inline-block'); productPrice.removeClass('d-none').addClass('d-inline-block');
quantity.removeClass('d-none').addClass('d-inline-flex'); quantity.removeClass('d-none').addClass('d-inline-flex');
@ -59,9 +61,11 @@ odoo.define('call_for_price_website.CustomVariantMixin', function(require) {
contactUsButton.removeClass('d-flex').addClass('d-none'); contactUsButton.removeClass('d-flex').addClass('d-none');
product_unavailable.removeClass('d-flex').addClass('d-none') product_unavailable.removeClass('d-flex').addClass('d-none')
price_call_div.removeClass('d-flex').addClass('d-none') price_call_div.removeClass('d-flex').addClass('d-none')
this.$el.find('#add_to_cart')[0].style.display = "block"; this.$el.find('#add_to_cart').removeClass('d-none').addClass('d-block');
this.$el.find('#price_of_product')[0].style.display = "block"; this.$el.find('#price_of_product').removeClass('d-none').addClass('d-block');
this.$el.find('#price_of_product')[0].style.display = "block"; this.$el.find('#price_of_product').removeClass('d-none').addClass('d-block');
this.$el.find('.js_add_cart_json').removeClass('d-none').addClass('d-block');
this.$el.find('.quantity').removeClass('d-none').addClass('d-block');
} }
// Call the original onChangeCombination function // Call the original onChangeCombination function
originalOnChangeCombination.apply(this, [ev, $parent, combination]); originalOnChangeCombination.apply(this, [ev, $parent, combination]);

2
call_for_price_website/views/compare_hide_price_template.xml

@ -2,6 +2,7 @@
<odoo> <odoo>
<!-- This template used to hide the price form the comparison page--> <!-- This template used to hide the price form the comparison page-->
<template id="compare_hide_price" inherit_id="website_sale_comparison.product_compare"> <template id="compare_hide_price" inherit_id="website_sale_comparison.product_compare">
<t t-call="website.layout">
<xpath expr="//span[hasclass('o_comparison_price')]" position="replace"> <xpath expr="//span[hasclass('o_comparison_price')]" position="replace">
<t t-if="product.price_call"></t> <t t-if="product.price_call"></t>
</xpath> </xpath>
@ -21,6 +22,7 @@
</form> </form>
</t> </t>
</xpath> </xpath>
</t>
</template> </template>
<!-- This template used to hide price from product comparison tool page--> <!-- This template used to hide price from product comparison tool page-->
<template id="compare_hide_price_product" inherit_id="website_sale_comparison.product_product"> <template id="compare_hide_price_product" inherit_id="website_sale_comparison.product_product">

362
call_for_price_website/views/shop_hide_call_price_template.xml

@ -1,172 +1,218 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<odoo> <odoo>
<!-- Template for hiding product price when 'price_call' is set --> <!-- Template for hiding product price when 'price_call' is set -->
<template id="shop_hide_price_call" inherit_id="website_sale.products_item"> <template id="shop_hide_price_call" inherit_id="website_sale.products_item">
<xpath expr="//div[hasclass('product_price')]" position="replace"> <xpath expr="//div[hasclass('product_price')]" position="replace">
<t t-foreach="product.product_variant_ids" t-as="variant"> <t t-foreach="product.product_variant_ids" t-as="variant">
<t t-if="variant.price_call"> <t t-if="variant.price_call">
<t t-set="has_price_call" t-value="True"/> <t t-set="has_price_call" t-value="True"/>
<t t-break="1"/></t> <t t-break="1"/>
</t> </t>
<t t-if="has_price_call"></t> </t>
<t t-else=""> <t t-if="has_price_call"></t>
<div class="product_price" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer"> <t t-else="">
<t t-if="'base_price' in template_price_vals"> <div class="product_price" itemprop="offers"
<del t-attf-class="text-muted me-1 h6 mb-0" style="white-space: nowrap;"> itemscope="itemscope"
<em class="small" t-esc="template_price_vals['base_price']" 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}"/> t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
</del> </del>
</t> </t>
<span class="h6 mb-0" <span class="h6 mb-0"
t-if="template_price_vals['price_reduce'] or not website.prevent_zero_price_sale" t-if="template_price_vals['price_reduce'] or not website.prevent_zero_price_sale"
t-esc="template_price_vals['price_reduce']" t-esc="template_price_vals['price_reduce']"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/> 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 class="h6 mb-0" t-else=""
<span itemprop="price" style="display:none;" t-esc="template_price_vals['price_reduce']"/> t-field="website.prevent_zero_price_sale_text"/>
<span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name"/> <span itemprop="price" style="display:none;"
</div> t-esc="template_price_vals['price_reduce']"/>
</t> <span itemprop="priceCurrency" style="display:none;"
</xpath> t-esc="website.currency_id.name"/>
</template> </div>
<!-- Template for hiding search details --> </t>
<template id="hide_search" inherit_id="website_sale.search"> </xpath>
<xpath expr="//t[@t-set='display_detail']" position="replace"> </template>
<t t-set="display_detail" t-valuef="false"/> <!-- Template for hiding search details -->
</xpath> <template id="hide_search" inherit_id="website_sale.search">
</template> <xpath expr="//t[@t-set='display_detail']" position="replace">
<!-- Template for product price display --> <t t-set="display_detail" t-valuef="false"/>
<template id="product_price" inherit_id="website_sale.product_price"> </xpath>
<xpath expr="//div[@itemprop='offers']" position="replace"> </template>
<div itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer" t-attf-class="product_price mt-2 mb-3 {{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-block'}}"> <!-- Template for product price display -->
<h3 class="css_editable_mode_hidden" id="price_of_product"> <template id="product_price" inherit_id="website_sale.product_price">
<span class="oe_price" style="white-space: nowrap;" t-esc="combination_info['price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/> <xpath expr="//div[@itemprop='offers']" position="replace">
<span itemprop="price" style="display:none;" t-esc="combination_info['price']"/> <div itemprop="offers" itemscope="itemscope"
<span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name"/> itemtype="http://schema.org/Offer"
<span t-attf-class="text-danger oe_default_price ms-1 h5 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="text-decoration: line-through; white-space: nowrap;" t-attf-class="product_price mt-2 mb-3 {{'d-none' if combination_info['prevent_zero_price_sale'] else 'd-inline-block'}}">
t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" <h3 class="css_editable_mode_hidden" id="price_of_product">
itemprop="listPrice" <span class="oe_price" style="white-space: nowrap;"
/> t-esc="combination_info['price']"
<t t-esc="product_id"/> t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
<t t-if="is_view_active('website_sale.tax_indication')" t-call="website_sale.tax_indication"/> <span itemprop="price" style="display:none;"
<del t-if="product.compare_list_price"> t-esc="combination_info['price']"/>
<bdi dir="inherit"> <span itemprop="priceCurrency" style="display:none;"
<span t-field="product.compare_list_price" t-esc="website.currency_id.name"/>
groups="website_sale.group_product_price_comparison" <span t-attf-class="text-danger oe_default_price ms-1 h5 {{'' if combination_info['has_discounted_price'] else 'd-none'}}"
t-options='{"widget": "monetary", style="text-decoration: line-through; white-space: nowrap;"
t-esc="combination_info['list_price']"
t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"
itemprop="listPrice"
/>
<t t-esc="product_id"/>
<t t-if="is_view_active('website_sale.tax_indication')"
t-call="website_sale.tax_indication"/>
<del t-if="product.compare_list_price">
<bdi dir="inherit">
<span t-field="product.compare_list_price"
groups="website_sale.group_product_price_comparison"
t-options='{"widget": "monetary",
"display_currency": product.currency_id, "display_currency": product.currency_id,
}'/> }'/>
</bdi> </bdi>
</del> </del>
</h3> </h3>
<h3 id="price_of_products" class="css_non_editable_mode_hidden decimal_precision" t-att-data-precision="str(website.currency_id.decimal_places)" style="display:none"> <h3 id="price_of_products"
<span t-field="product.list_price" class="css_non_editable_mode_hidden decimal_precision"
t-options='{"widget": "monetary", t-att-data-precision="str(website.currency_id.decimal_places)"
style="display:none">
<span t-field="product.list_price"
t-options='{"widget": "monetary",
"display_currency": product.currency_id, "display_currency": product.currency_id,
}'/> }'/>
<t t-if="is_view_active('website_sale.tax_indication')" t-call="website_sale.tax_indication"/> <t t-if="is_view_active('website_sale.tax_indication')"
<del t-if="product.compare_list_price"> t-call="website_sale.tax_indication"/>
<bdi dir="inherit"> <del t-if="product.compare_list_price">
<span t-field="product.compare_list_price" <bdi dir="inherit">
groups="website_sale.group_product_price_comparison" <span t-field="product.compare_list_price"
t-options='{"widget": "monetary", groups="website_sale.group_product_price_comparison"
t-options='{"widget": "monetary",
"display_currency": product.currency_id, "display_currency": product.currency_id,
}'/> }'/>
</bdi> </bdi>
</del> </del>
</h3> </h3>
</div> </div>
<div id="product_unavailable" t-attf-class="{{'d-flex' if combination_info['prevent_zero_price_sale'] else 'd-none'}}"> <div id="product_unavailable"
<h3 class="fst-italic" t-field="website.prevent_zero_price_sale_text"/> t-attf-class="{{'d-flex' if combination_info['prevent_zero_price_sale'] else 'd-none'}}">
</div> <h3 class="fst-italic"
<div id="price_call_hide" style="display:none"> t-field="website.prevent_zero_price_sale_text"/>
<div> </div>
<div class="alert alert-success" id="alert_message" <div id="price_call_hide" style="display:none">
style="display:none"> <div>
Thank you for information, we will get back to you asap. <div class="alert alert-success" id="alert_message"
style="display:none">
Thank you for information, we will get back to you
asap.
</div>
<a role="button" class="btn btn-primary"
href="#call_for_price"
data-bs-toggle="modal"
id="button_call_for_price">
Call for Price
</a>
</div>
</div>
</xpath>
</template>
<!-- Template for 'Call for Price' modal -->
<template id="shop_product_hide_price" inherit_id="website_sale.product">
<xpath expr="//div[@id='o_product_terms_and_share']"
position="before">
<div id="call_for_price" class="modal fade">
<div class="modal-dialog modal-content" style="height:auto">
<div class="page">
<h3>
<center>Call For Price</center>
</h3>
</div>
<input type="hidden" name="product_id" id="product_id"
t-att-value="product.id"/>
<hr/>
<center>
<table style="width:500px">
<tr style="height:60px">
<td style="width:100px">
<label for="first_name"
class="control-label">First
Name:*
</label>
</td>
<td>
<input type="text" class="form-control"
name="first_name"
id="first_name"
required="required"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label for="last_name"
class="control-label">Last Name:
</label>
</td>
<td>
<input type="text" class="form-control"
name="last_name"
id="last_name"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label for="email">Email</label>
</td>
<td>
<input type="text" class="form-control"
name="email"
id="email" required="required"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label for="phone">Contact No.*</label>
</td>
<td>
<input type="text" class="form-control"
id="phone" name="phone"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label>Quantity</label>
</td>
<td>
<input type="number"
class="form-control"
name="quantity" id="quantity"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label>Message</label>
</td>
<td>
<input type="text" class="form-control"
name="message" id="message"/>
</td>
</tr>
</table>
<hr/>
<button id="send_btn" type="button"
data-bs-dismiss="modal"
class="btn btn-primary">Send
</button>
<button type="button"
class="btn btn-outline-secondary"
data-bs-dismiss="modal"
id="call_modal_close">
Close
</button>
</center>
</div> </div>
<a role="button" class="btn btn-primary" href="#call_for_price" </div>
data-bs-toggle="modal" </xpath>
id="button_call_for_price"> </template>
Call for Price
</a>
</div>
</div>
</xpath>
</template>
<!-- Template for 'Call for Price' modal -->
<template id="shop_product_hide_price" inherit_id="website_sale.product">
<xpath expr="//div[@id='o_product_terms_and_share']" position="before">
<div id="call_for_price" class="modal fade">
<div class="modal-dialog modal-content" style="height:auto">
<div class="page">
<h3>
<center>Call For Price</center>
</h3>
</div>
<input type="hidden" name="product_id" id="product_id" t-att-value="product.id"/>
<hr/>
<center>
<table style="width:500px">
<tr style="height:60px">
<td style="width:100px">
<label for="first_name" class="control-label">First Name:*</label>
</td>
<td>
<input type="text" class="form-control" name="first_name"
id="first_name" required="required"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label for="last_name" class="control-label">Last Name:</label>
</td>
<td>
<input type="text" class="form-control" name="last_name"
id="last_name"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label for="email">Email </label>
</td>
<td>
<input type="text" class="form-control" name="email"
id="email" required="required"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label for="phone">Contact No.*</label>
</td>
<td>
<input type="text" class="form-control" id="phone" name="phone"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label>Quantity</label>
</td>
<td>
<input type="number" class="form-control" name="quantity" id="quantity"/>
</td>
</tr>
<tr style="height:60px">
<td>
<label>Message</label>
</td>
<td>
<input type="text" class="form-control" name="message" id="message"/>
</td>
</tr>
</table>
<hr/>
<button id="send_btn" type="button" data-bs-dismiss="modal" class="btn btn-primary">Send</button>
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal" id="call_modal_close">
Close
</button>
</center>
</div>
</div>
</xpath>
</template>
</odoo> </odoo>

14
call_for_price_website/views/wishlist_hide_price_template.xml

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- This template used to hide price from wishlist page--> <!-- This template used to hide price from wishlist page-->
<template id="wishlist_hide_price" inherit_id="website_sale_wishlist.product_wishlist"> <template id="wishlist_hide_price"
inherit_id="website_sale_wishlist.product_wishlist">
<xpath expr="//td[hasclass('o_wish_price')]" position="replace"> <xpath expr="//td[hasclass('o_wish_price')]" position="replace">
<t t-if="wish.product_id.price_call"></t> <t t-if="wish.product_id.price_call"></t>
<t t-else=""> <t t-else="">
@ -22,11 +23,14 @@
<t t-if="wish.product_id.price_call"></t> <t t-if="wish.product_id.price_call"></t>
<t t-else=""> <t t-else="">
<td class='text-center td-wish-btn align-middle'> <td class='text-center td-wish-btn align-middle'>
<input name="product_id" t-att-value="wish.product_id.id" type="hidden"/> <input name="product_id"
<a t-if="combination_info['prevent_zero_price_sale']" t-att-href="website.contact_us_button_url" t-att-value="wish.product_id.id" type="hidden"/>
<a t-if="combination_info['prevent_zero_price_sale']"
t-att-href="website.contact_us_button_url"
class="btn btn-primary btn_cta">Contact Us class="btn btn-primary btn_cta">Contact Us
</a> </a>
<button id="add_to_cart_button" t-else="" type="button" role="button" <button id="add_to_cart_button" t-else="" type="button"
role="button"
class="btn btn-secondary btn-block o_wish_add mb4"> class="btn btn-secondary btn-block o_wish_add mb4">
Add Add
<span class='d-none d-md-inline'>to Cart</span> <span class='d-none d-md-inline'>to Cart</span>

Loading…
Cancel
Save