diff --git a/themes/nurgul/pages/seller/products.htm b/themes/nurgul/pages/seller/products.htm index 206d476..ebc9e9a 100755 --- a/themes/nurgul/pages/seller/products.htm +++ b/themes/nurgul/pages/seller/products.htm @@ -13,7 +13,6 @@ layout = "seller-master"
{{'add.prod.title'|_}} -
diff --git a/themes/nurgul/partials/seller/prod-update.htm b/themes/nurgul/partials/seller/prod-update.htm index 4f48404..c4dac97 100644 --- a/themes/nurgul/partials/seller/prod-update.htm +++ b/themes/nurgul/partials/seller/prod-update.htm @@ -192,56 +192,57 @@ // $("input[name='images[files][]']").val(product.images[0].original_image_url); // $("select[name='status']").val(product.status); - $("#product_status").html(` - - + if (product) { + $("#product_status").html(` + + `); - $("#product_featured").html(` - - + $("#product_featured").html(` + + `); + $("div.product_featured select").val(product.featured); - $("div.product_featured select").val(product.featured); + // $("#product_featured select").val(product.featured).change(); + // $('#product_featured option[value='+product.featured+']').attr('selected','selected'); + $("input[name='name']").val(product.name); + $("input[name='sku']").val(product.sku); + $("textarea[name='short_description']").val(product.short_description); + $("textarea[name='description']").val(product.description); + $("input[name='name']").val(product.name); + $("input[name='product_number']").val(product.product_number); + $("input[name='price']").val(product.price); + $("input[name='special_price']").val(Number(product.special_price)); + $("input[name='qty']").val(product.qty); - // $("#product_featured select").val(product.featured).change(); - // $('#product_featured option[value='+product.featured+']').attr('selected','selected'); - $("input[name='name']").val(product.name); - $("input[name='sku']").val(product.sku); - $("textarea[name='short_description']").val(product.short_description); - $("textarea[name='description']").val(product.description); - $("input[name='name']").val(product.name); - $("input[name='product_number']").val(product.product_number); - $("input[name='price']").val(product.price); - $("input[name='special_price']").val(Number(product.special_price)); - $("input[name='qty']").val(product.qty); - - let category = product.categories[0]; - if(category){ - $('#product_categories').append(` - + let category = product.categories[0]; + if (category) { + $('#product_categories').append(` + `); + } + + product.images.forEach(image => { + let mockFile = {name: image.original_image_url, size: 12345}; + myDropzone.options.addedfile.call(myDropzone, mockFile); + myDropzone.options.thumbnail.call(myDropzone, mockFile, image.original_image_url); + myDropzone.emit("complete", mockFile); + + let blob = null + let xhrr = new XMLHttpRequest() + xhrr.open("GET", image.original_image_url) + xhrr.responseType = "blob" + xhrr.onload = function () { + blob = xhrr.response + let file = new File([blob], image.original_image_url); + container.items.add(file); + document.querySelector('#prodImgs2').files = container.files; + + } + xhrr.send() + }) } vendorCats(); - - product.images.forEach(image => { - let mockFile = { name: image.original_image_url, size: 12345 }; - myDropzone.options.addedfile.call(myDropzone, mockFile); - myDropzone.options.thumbnail.call(myDropzone, mockFile, image.original_image_url); - myDropzone.emit("complete", mockFile); - - let blob = null - let xhrr = new XMLHttpRequest() - xhrr.open("GET", image.original_image_url) - xhrr.responseType = "blob" - xhrr.onload = function () { - blob = xhrr.response - let file = new File([blob], image.original_image_url); - container.items.add(file); - document.querySelector('#prodImgs2').files = container.files; - - } - xhrr.send() - }) }, error: function (xhr, textStatus, errorThrown) { console.log('Error in Operation');