Fix errors on new product creation
This commit is contained in:
parent
6a0be7f0ba
commit
4c9d754d02
|
|
@ -13,7 +13,6 @@ layout = "seller-master"
|
|||
<div class="intro-y col-span-12 flex flex-wrap sm:flex-nowrap items-center mt-2">
|
||||
<a href="/seller/product/add" class="btn btn-primary shadow-md mr-2">{{'add.prod.title'|_}}</a>
|
||||
|
||||
<div class="hidden md:block mx-auto text-slate-500">Showing 1 to 10 of 150 entries</div>
|
||||
<div class="w-full sm:w-auto mt-3 sm:mt-0 sm:ml-auto md:ml-0">
|
||||
<div class="w-56 relative text-slate-500">
|
||||
<input type="text" class="form-control w-56 box pr-10" placeholder="Search...">
|
||||
|
|
|
|||
|
|
@ -192,56 +192,57 @@
|
|||
|
||||
// $("input[name='images[files][]']").val(product.images[0].original_image_url);
|
||||
// $("select[name='status']").val(product.status);
|
||||
$("#product_status").html(`
|
||||
<option value="1" `+ (product.status == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
|
||||
<option value="0" `+ (product.status == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
|
||||
if (product) {
|
||||
$("#product_status").html(`
|
||||
<option value="1" ` + (product.status == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
|
||||
<option value="0" ` + (product.status == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
|
||||
`);
|
||||
$("#product_featured").html(`
|
||||
<option value="1" `+ (product.featured == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
|
||||
<option value="0" `+ (product.featured == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
|
||||
$("#product_featured").html(`
|
||||
<option value="1" ` + (product.featured == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
|
||||
<option value="0" ` + (product.featured == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
|
||||
`);
|
||||
$("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(`
|
||||
<option selected value="`+category.id+`">`+ category.name +`</option>
|
||||
let category = product.categories[0];
|
||||
if (category) {
|
||||
$('#product_categories').append(`
|
||||
<option selected value="` + category.id + `">` + category.name + `</option>
|
||||
`);
|
||||
}
|
||||
|
||||
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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue