[FIX] website_sale: image doesn't change when the user select a product (for product variant list). website_sale_options: image dones't change in modal with the selection

This commit is contained in:
Denis Ledoux 2014-10-20 18:40:06 +02:00
parent 285ba3d801
commit bfb61cd5e9
2 changed files with 8 additions and 2 deletions

View File

@ -94,6 +94,9 @@ $('.oe_website_sale').each(function () {
var $parent = $(this).closest('.js_product');
$parent.find(".oe_default_price:first .oe_currency_value").html( price_to_str(+$(this).data('lst_price')) );
$parent.find(".oe_price:first .oe_currency_value").html(price_to_str(+$(this).data('price')) );
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img, img.product_detail_img');
$img.attr("src", "/website/image/product.product/" + $(this).val() + "/image");
});
$(oe_website_sale).on('change', 'input.js_variant_change, select.js_variant_change', function (ev) {
@ -126,7 +129,7 @@ $('.oe_website_sale').each(function () {
}
if (product_id) {
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img');
var $img = $(this).closest('tr.js_product, .oe_website_sale').find('span[data-oe-model^="product."][data-oe-type="image"] img, img.product_detail_img');
$img.attr("src", "/website/image/product.product/" + product_id + "/image");
$img.parent().attr('data-oe-model', 'product.product').attr('data-oe-id', product_id)
.data('oe-model', 'product.product').data('oe-id', product_id);

View File

@ -5,15 +5,18 @@ $(document).ready(function () {
.click(function (event) {
var $form = $(this).closest('form');
var quantity = parseFloat($form.find('input[name="add_qty"]').val() || 1);
var product_id = parseInt($form.find('input[type="hidden"][name="product_id"], input[type="radio"][name="product_id"]:checked').first().val(),10);
event.preventDefault();
openerp.jsonRpc("/shop/modal", 'call', {
'product_id': parseInt($form.find('input[name="product_id"]').val(),10),
'product_id': product_id,
kwargs: {
context: openerp.website.get_context()
},
}).then(function (modal) {
var $modal = $(modal);
$modal.find('img:first').attr("src", "/website/image/product.product/" + product_id + "/image");
$modal.appendTo($form)
.modal()
.on('hidden.bs.modal', function () {