[FIX] website_sale, website_sale_options: product_variant_ids in website_sale.modal
To show the website_sale.modal, the product_variant_ids must be in the DOM
because all the prices are computed with the product_variant_ids.
From commit 0ff26cf
opw:650167
This commit is contained in:
parent
e0f4f8a710
commit
cf87d9b5a3
|
@ -21,9 +21,9 @@ $('.oe_website_sale').each(function () {
|
|||
|
||||
$(oe_website_sale).on("change", 'input[name="add_qty"]', function (event) {
|
||||
product_ids = [];
|
||||
var product_dom = $("ul.js_add_cart_variants[data-attribute_value_ids]").first();
|
||||
var product_dom = $(".js_add_cart_variants[data-attribute_value_ids]").first();
|
||||
product_dom.data("attribute_value_ids").forEach(function(entry) {
|
||||
product_ids.push(entry[0]);});
|
||||
product_ids.push(entry);});
|
||||
var qty = $(event.target).closest('form').find('input[name="add_qty"]').val();
|
||||
|
||||
openerp.jsonRpc("/shop/get_unit_price", 'call', {'product_ids': product_ids,'add_qty': parseInt(qty)})
|
||||
|
@ -152,7 +152,7 @@ $('.oe_website_sale').each(function () {
|
|||
});
|
||||
|
||||
$(oe_website_sale).on('change', 'input.js_variant_change, select.js_variant_change, ul[data-attribute_value_ids]', function (ev) {
|
||||
var $ul = $(ev.target).closest('ul.js_add_cart_variants');
|
||||
var $ul = $(ev.target).closest('.js_add_cart_variants');
|
||||
var $parent = $ul.closest('.js_product');
|
||||
var $product_id = $parent.find('input.product_id').first();
|
||||
var $price = $parent.find(".oe_price:first .oe_currency_value");
|
||||
|
@ -223,7 +223,7 @@ $('.oe_website_sale').each(function () {
|
|||
$('input.js_product_change', this).first().trigger('change');
|
||||
});
|
||||
|
||||
$('ul.js_add_cart_variants', oe_website_sale).each(function () {
|
||||
$('.js_add_cart_variants', oe_website_sale).each(function () {
|
||||
$('input.js_variant_change, select.js_variant_change', this).first().trigger('change');
|
||||
});
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@
|
|||
<h1 itemprop="name" t-field="product.name">Product Name</h1>
|
||||
<span itemprop="url" style="display:none;" t-esc="'/shop/product/%s' % slug(product)"/>
|
||||
|
||||
<form t-att-action="keep('/shop/cart/update')" class="js_add_cart_variants" method="POST">
|
||||
<form t-att-action="keep('/shop/cart/update')" class="js_add_cart_variants" t-att-data-attribute_value_ids="product.product_variant_ids.ids" method="POST">
|
||||
|
||||
<div class="js_product">
|
||||
<t t-placeholder="select">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
$(document).ready(function () {
|
||||
if(! $("ul.js_add_cart_variants[data-attribute_value_ids]").length){
|
||||
if(! $(".js_add_cart_variants[data-attribute_value_ids]").length){
|
||||
return;
|
||||
}
|
||||
$('.oe_website_sale #add_to_cart, .oe_website_sale #products_grid .a-submit')
|
||||
|
@ -63,7 +63,7 @@ $(document).ready(function () {
|
|||
});
|
||||
|
||||
$modal.find('input[name="add_qty"]').val(quantity).change();
|
||||
$('ul.js_add_cart_variants').each(function () {
|
||||
$('.js_add_cart_variants').each(function () {
|
||||
$('input.js_variant_change, select.js_variant_change', this).first().trigger('change');
|
||||
});
|
||||
|
||||
|
@ -74,7 +74,7 @@ $(document).ready(function () {
|
|||
var qty = $dom.find('input[name="add_qty"]').val();
|
||||
var product_ids = [product_id];
|
||||
var $products_dom = [];
|
||||
$modal.find("ul.js_add_cart_variants[data-attribute_value_ids]").each(function(){
|
||||
$modal.find(".js_add_cart_variants[data-attribute_value_ids]").each(function(){
|
||||
var $el = $(this);
|
||||
$products_dom.push($el);
|
||||
_.each($el.data("attribute_value_ids"), function (values) {
|
||||
|
|
Loading…
Reference in New Issue