@@ -755,12 +755,6 @@ jQuery(function($) {
755755
756756
757757 var img_icon = '<img width="60" src="' + fileurl + '" style="width: 34px;">' ;
758- var url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url">' ;
759-
760- if ( meta . type !== 'image' ) {
761- var img_icon = '<img width="60" src="' + meta . icon + '" style="width: 34px;">' ;
762- url_field = '' ;
763- }
764758
765759 var price_metatype = 'price' ;
766760 var stock_metatype = 'stock' ;
@@ -777,6 +771,7 @@ jQuery(function($) {
777771 else if ( meta_type == 'images' ) {
778772 var class_name = 'data-options ui-sortable-handle' ;
779773 var condidtion_attr = 'image_options' ;
774+ price_metatype = 'meta_id' ;
780775 }
781776 else if ( meta_type == 'conditional_meta' ) {
782777 meta_type = 'images' ;
@@ -790,6 +785,13 @@ jQuery(function($) {
790785 var condidtion_attr = '' ;
791786 }
792787
788+ let url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url" value="">' ;
789+
790+ if ( meta . type !== 'image' ) {
791+ img_icon = '<img width="60" src="' + meta . icon + '" style="width: 34px;">' ;
792+ url_field = '' ;
793+ }
794+
793795 if ( fileurl ) {
794796 var image_box = '' ;
795797 image_box += '<li class="' + class_name + '" data-condition-type="' + condidtion_attr + '">' ;
@@ -802,7 +804,7 @@ jQuery(function($) {
802804 image_box += '<input type="hidden" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][link]" value="' + fileurl + '" data-opt-index="' + option_index + '" data-metatype="link">' ;
803805 image_box += '<input type="hidden" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][id]" value="' + fileid + '" data-opt-index="' + option_index + '" data-metatype="id">' ;
804806 image_box += '<input type="text" placeholder="Title" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][title]" class="form-control ppom-image-option-title" data-opt-index="' + option_index + '" data-metatype="title" value="' + file_title + '">' ;
805- image_box += '<input class="form-control" type="text" placeholder="' + price_placeholder + '" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][' + price_metatype + ']" class="form-control" data-opt-index="' + option_index + '" data-metatype="' + price_metatype + '">' ;
807+ image_box += '<input class="form-control" type="text" placeholder="' + price_placeholder + '" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][' + price_metatype + ']" class="form-control" data-opt-index="' + option_index + '" data-metatype="' + price_metatype + '" value="" >' ;
806808
807809 if ( meta_type != 'audio' ) {
808810 image_box += '<input class="form-control" type="text" placeholder="' + stock_placeholder + '" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][' + stock_metatype + ']" class="form-control" data-opt-index="' + option_index + '" data-metatype="' + stock_metatype + '">' ;
@@ -843,12 +845,6 @@ jQuery(function($) {
843845 var fileurl = attachment . url ;
844846 var fileid = attachment . id ;
845847 var img_icon = '<img width="60" src="' + fileurl + '" style="width: 34px;">' ;
846- var url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url">' ;
847-
848- if ( attachment . type !== 'image' ) {
849- var img_icon = '<img width="60" src="' + attachment . icon + '" style="width: 34px;">' ;
850- url_field = '' ;
851- }
852848
853849 var price_metatype = 'price' ;
854850 var stock_metatype = 'stock' ;
@@ -865,6 +861,7 @@ jQuery(function($) {
865861 else if ( meta_type == 'images' ) {
866862 var class_name = 'data-options ui-sortable-handle' ;
867863 var condidtion_attr = 'image_options' ;
864+ price_metatype = 'meta_id' ;
868865 }
869866 else if ( meta_type == 'conditional_meta' ) {
870867 meta_type = 'images' ;
@@ -878,6 +875,13 @@ jQuery(function($) {
878875 var condidtion_attr = '' ;
879876 }
880877
878+ let url_field = '<input placeholder="url" type="text" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][url]" class="form-control" data-opt-index="' + option_index + '" data-metatype="url" value="">' ;
879+
880+ if ( attachment . type !== 'image' ) {
881+ img_icon = '<img width="60" src="' + attachment . icon + '" style="width: 34px;">' ;
882+ url_field = '' ;
883+ }
884+
881885 if ( fileurl ) {
882886 var image_box = '' ;
883887 image_box += '<li class="' + class_name + '" data-condition-type="' + condidtion_attr + '">' ;
@@ -890,7 +894,7 @@ jQuery(function($) {
890894 image_box += '<input type="hidden" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][link]" value="' + fileurl + '" data-opt-index="' + option_index + '" data-metatype="link">' ;
891895 image_box += '<input type="hidden" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][id]" value="' + fileid + '" data-opt-index="' + option_index + '" data-metatype="id">' ;
892896 image_box += '<input type="text" placeholder="Title" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][title]" class="form-control ppom-image-option-title" data-opt-index="' + option_index + '" data-metatype="title">' ;
893- image_box += '<input class="form-control" type="text" placeholder="' + price_placeholder + '" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][' + price_metatype + ']" class="form-control" data-opt-index="' + option_index + '" data-metatype="' + price_metatype + '">' ;
897+ image_box += '<input class="form-control" type="text" placeholder="' + price_placeholder + '" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][' + price_metatype + ']" class="form-control" data-opt-index="' + option_index + '" data-metatype="' + price_metatype + '" value="" >' ;
894898 image_box += '<input class="form-control" type="text" placeholder="' + stock_placeholder + '" name="ppom[' + field_index + '][' + meta_type + '][' + option_index + '][' + stock_metatype + ']" class="form-control" data-opt-index="' + option_index + '" data-metatype="' + stock_metatype + '">' ;
895899 image_box += url_field ;
896900 image_box += '<button class="btn btn-danger ppom-pre-upload-delete" style="height: 35px;"><i class="fa fa-times" aria-hidden="true"></i></button>' ;
0 commit comments