diff --git a/call_for_price_website/README.rst b/call_for_price_website/README.rst index a13711ee4..ae6a4e33a 100644 --- a/call_for_price_website/README.rst +++ b/call_for_price_website/README.rst @@ -16,7 +16,9 @@ Company Credits ------- -Developers: Raneesha M K @cybrosys, Muhsina V @cybrosys, Contact: odoo@cybrosys.com +Developers: Raneesha M K @cybrosys, + Muhsina V @cybrosys, Contact: odoo@cybrosys.com, + Farhana Jahan PT @cybrosys, Contact: odoo@cybrosys.com Contacts -------- diff --git a/call_for_price_website/__manifest__.py b/call_for_price_website/__manifest__.py index 73ff077d1..2be9d9a5c 100644 --- a/call_for_price_website/__manifest__.py +++ b/call_for_price_website/__manifest__.py @@ -39,6 +39,7 @@ 'views/compare_hide_price_template.xml', 'views/call_for_price_views.xml', 'views/product_product_views.xml', + 'views/website_product_template.xml' ], 'assets': { 'web.assets_frontend': [ diff --git a/call_for_price_website/static/src/js/create_call_form.js b/call_for_price_website/static/src/js/create_call_form.js index eb660cb82..06646eaff 100644 --- a/call_for_price_website/static/src/js/create_call_form.js +++ b/call_for_price_website/static/src/js/create_call_form.js @@ -116,7 +116,6 @@ odoo.define('call_for_price_website.create_call_form', function(require) { this.$el.find('#quantity').val(''); this.$el.find('#message').val(''); }, - }); return publicWidget.registry.CallForPrice; -}); \ No newline at end of file +}); diff --git a/call_for_price_website/static/src/js/variant_mixin.js b/call_for_price_website/static/src/js/variant_mixin.js index b7d18a233..e52a5cf95 100644 --- a/call_for_price_website/static/src/js/variant_mixin.js +++ b/call_for_price_website/static/src/js/variant_mixin.js @@ -8,9 +8,10 @@ odoo.define('call_for_price_website.CustomVariantMixin', function(require) { // Import the VariantMixin from website_sale module var VariantMixin = require('website_sale.VariantMixin'); // Store a reference to the original onChangeCombination function - const originalOnChangeCombination = VariantMixin._onChangeCombination; + const oldOnChangeCombination = VariantMixin._onChangeCombination; // Override the onChangeCombination function to implement custom behavior VariantMixin._onChangeCombination = function(ev, $parent, combination) { + const result = oldOnChangeCombination.apply(this, arguments); const $pricePerUom = $parent.find(".o_base_unit_price:first .oe_currency_value"); if ($pricePerUom) { if (combination.is_combination_possible !== false && combination.base_unit_price != 0) { @@ -36,25 +37,31 @@ odoo.define('call_for_price_website.CustomVariantMixin', function(require) { const quantity = $parent.find('.css_quantity'); const product_unavailable = $parent.find('#product_unavailable'); const price_call_div = $parent.find('#price_call_hide'); - if (combination.prevent_zero_price_sale) { productPrice.removeClass('d-inline-block').addClass('d-none'); quantity.removeClass('d-inline-flex').addClass('d-none'); addToCart.removeClass('d-inline-flex').addClass('d-none'); contactUsButton.removeClass('d-none').addClass('d-flex'); - product_unavailable.removeClass('d-none').addClass('d-flex') - } else if (combination.price_call) { - productPrice.removeClass('d-inline-block').addClass('d-none'); + product_unavailable.removeClass('d-none').addClass('d-flex'); + this.$el.find('.product_price_visible').removeClass('d-none').addClass('d-block'); + this.$el.find('.product_price').remove(); + } + if (combination.price_call) { quantity.removeClass('d-inline-flex').addClass('d-none'); addToCart.removeClass('d-inline-flex').addClass('d-none'); contactUsButton.removeClass('d-none').addClass('d-flex'); price_call_div.removeClass('d-none').addClass('d-flex'); + this.$el.find('#contact_us_wrapper').remove(); this.$el.find('#add_to_cart').removeClass('d-block').addClass('d-none'); + this.$el.find('.product_price').removeClass('d-inline-block').addClass('d-none'); this.$el.find('#price_of_product').removeClass('d-block').addClass('d-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 { + this.$el.find('.css_quantity').removeClass('d-block').addClass('d-none'); + this.$el.find('.product_price_visible').removeClass('d-block').addClass('d-none'); + this.$el.find('.product_price').remove(); + } + else { productPrice.removeClass('d-none').addClass('d-inline-block'); quantity.removeClass('d-none').addClass('d-inline-flex'); addToCart.removeClass('d-none').addClass('d-inline-flex'); @@ -66,8 +73,8 @@ odoo.define('call_for_price_website.CustomVariantMixin', function(require) { 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'); + this.$el.find('.product_price_visible').removeClass('d-none').addClass('d-block'); } - // Call the original onChangeCombination function - originalOnChangeCombination.apply(this, [ev, $parent, combination]); + return result }; }); \ No newline at end of file diff --git a/call_for_price_website/views/call_for_price_views.xml b/call_for_price_website/views/call_for_price_views.xml index a91f31a8e..71c25cded 100644 --- a/call_for_price_website/views/call_for_price_views.xml +++ b/call_for_price_website/views/call_for_price_views.xml @@ -51,9 +51,8 @@ call.price tree,form - - \ No newline at end of file + diff --git a/call_for_price_website/views/shop_hide_call_price_template.xml b/call_for_price_website/views/shop_hide_call_price_template.xml index e21121bf0..839cf106a 100644 --- a/call_for_price_website/views/shop_hide_call_price_template.xml +++ b/call_for_price_website/views/shop_hide_call_price_template.xml @@ -42,82 +42,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Thank you for information, we will get back to you - asap. - - - Call for Price - - - - - + + + + + + + + + + + + + + + + + + + + + + All Products + + + + + + + + + + + + + + + + + + Product Name + + + + + + + %s reviews + %s review + + + + + + + + + + + + + + + + + + + + + + + + + + + + This combination does not exist. + + + + + + + + + ADD TO CART + + + + + + + + Contact Us + + + + + + + This product is no longer available. + This product has no valid combination. + + + + + + + : + + , + + + + + + + + + + + + + + + + + + + + + + + Thank you for information, we will get back to you + asap. + + + Call for Price + + + + + + + + + + + + + + + + + + + Call For Price + + + + + + + + + First + Name:* + + + + + + + + + Last Name: + + + + + + + + + Email + + + + + + + + Contact No.* + + + + + + + + Quantity + + + + + + + + Message + + + + + + + + Send + + + Close + + + + + + +
This combination does not exist.
This product is no longer available.
This product has no valid combination.