|
@@ -30,38 +30,41 @@ $(document).on('click', '.attribute_creator', function () {
|
|
|
tags: true
|
|
|
});
|
|
|
}
|
|
|
- //*********save attribute by ajax
|
|
|
- $(".saveItemAttribute").on('click',function(event){
|
|
|
- event.preventDefault();
|
|
|
- var loc = window.location;
|
|
|
- var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
|
|
|
- var data = new FormData();
|
|
|
- data.append('_token', $('[name="csrf-token"]').attr('content'));
|
|
|
- $('select.newSelectItem').each(function(){
|
|
|
- let attribute_values = $(this).val();
|
|
|
- for( let i=0; i<attribute_values.length; i++ ){
|
|
|
- data.append( $(this).attr('name'), attribute_values[i]);
|
|
|
+});
|
|
|
|
|
|
+//*********save attribute by ajax
|
|
|
+$("#saveItemAttribute").on('click',function(event){
|
|
|
+ event.preventDefault();
|
|
|
+ var loc = window.location;
|
|
|
+ var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
|
|
|
+ var data = new FormData();
|
|
|
+ data.append('_token', $('[name="csrf-token"]').attr('content'));
|
|
|
+ console.log('2');
|
|
|
+ $('.newSelectItem').each(function(){
|
|
|
+ console.log('3');
|
|
|
+ let attribute_values = $(this).val();
|
|
|
+ for( let i=0; i<attribute_values.length; i++ ){
|
|
|
+ data.append( $(this).attr('name'), attribute_values[i]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ data.append('productID',$('#productID').val());
|
|
|
+ $.ajax({
|
|
|
+ url: base_url + "/panel/attributes_uploads/val_attribute",
|
|
|
+ method: 'POST',
|
|
|
+ data: data,
|
|
|
+ processData: false,
|
|
|
+ contentType: false,
|
|
|
+ success: function(operate) {
|
|
|
+ if (operate.status == 200){
|
|
|
+ swal(operate.msg);
|
|
|
+ }else {
|
|
|
+ swal(operate.msg);
|
|
|
}
|
|
|
- });
|
|
|
- data.append('productID',$('#productID').val());
|
|
|
- $.ajax({
|
|
|
- url: base_url + "/panel/attributes_uploads/val_attribute",
|
|
|
- method: 'POST',
|
|
|
- data: data,
|
|
|
- processData: false,
|
|
|
- contentType: false,
|
|
|
- success: function(operate) {
|
|
|
- if (operate.status == 200){
|
|
|
- swal(operate.msg);
|
|
|
- }else {
|
|
|
- swal(operate.msg);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
});
|
|
|
+
|
|
|
//******add product variable
|
|
|
$(document).on('click', '.variable_creator', function () {
|
|
|
$(".added_variable:last").after($(".added_variable:last").clone());
|