admin-currency-selector.js
1 year ago
admin-currency-selector.min.js
1 year ago
bacs-accounts-currencies.js
5 years ago
bacs-accounts-currencies.min.js
5 years ago
cart_widget.js
1 month ago
cart_widget.min.js
1 month ago
currency-switcher-settings.js
1 year ago
currency-switcher-settings.min.js
1 year ago
dialogs.js
5 years ago
dialogs.min.js
5 years ago
exchange-rates.js
3 years ago
exchange-rates.min.js
3 years ago
files.js
5 years ago
files.min.js
5 years ago
languages_notice.js
5 years ago
languages_notice.min.js
5 years ago
lock_fields.js
1 year ago
lock_fields.min.js
1 year ago
multi-currency.js
5 years ago
multi-currency.min.js
5 years ago
pointer.js
1 year ago
pointer.min.js
1 year ago
prices.js
5 years ago
prices.min.js
5 years ago
products-screen-option.js
5 years ago
products-screen-option.min.js
5 years ago
scripts.js
1 year ago
scripts.min.js
1 year ago
taxonomy_translation.js
1 year ago
taxonomy_translation.min.js
1 year ago
tooltip_init.js
5 years ago
tooltip_init.min.js
5 years ago
trnsl_interface_dialog_warning.js
5 years ago
trnsl_interface_dialog_warning.min.js
5 years ago
troubleshooting.js
1 year ago
troubleshooting.min.js
1 year ago
wcml-attributes.js
5 years ago
wcml-attributes.min.js
5 years ago
wcml-messages.js
5 years ago
wcml-messages.min.js
5 years ago
wcml-multi-currency.js
1 month ago
wcml-multi-currency.min.js
1 month ago
wcml-setup.js
3 years ago
wcml-setup.min.js
3 years ago
wcml-translation-editor.js
1 week ago
wcml-translation-editor.min.js
1 week ago
widgets.js
5 years ago
widgets.min.js
5 years ago
wpml_tm.js
5 years ago
wpml_tm.min.js
5 years ago
lock_fields.js
238 lines
| 1 | jQuery(function($){ |
| 2 | var i; |
| 3 | var ids = [ |
| 4 | '_virtual', |
| 5 | '_downloadable', |
| 6 | 'product-type', |
| 7 | '_backorders', |
| 8 | '_manage_stock', |
| 9 | '_stock', |
| 10 | '_low_stock_amount', |
| 11 | '_stock_status', |
| 12 | '_sold_individually', |
| 13 | 'comment_status', |
| 14 | '_tax_status', |
| 15 | '_tax_class', |
| 16 | 'parent_id', |
| 17 | 'crosssell_ids', |
| 18 | 'upsell_ids', |
| 19 | 'grouped_products', |
| 20 | 'product_shipping_class' |
| 21 | ]; |
| 22 | |
| 23 | if( unlock_fields.file_paths == 1 ){ |
| 24 | ids.push('_download_type'); |
| 25 | } |
| 26 | ids = ids.concat( non_standard_fields.ids ); |
| 27 | |
| 28 | $('.wcml_prod_hidden_notice').prependTo('#woocommerce-product-data'); |
| 29 | |
| 30 | for (i = 0; i < ids.length; i++) { |
| 31 | $el = $('#'+ids[i]); |
| 32 | if (!$el.length) { |
| 33 | $el = $('*[name='+ids[i]+']'); |
| 34 | } |
| 35 | $el.prop('disabled', true); |
| 36 | $el.after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 37 | } |
| 38 | |
| 39 | var buttons = [ |
| 40 | 'add_variation', |
| 41 | 'link_all_variations', |
| 42 | 'attribute_taxonomy', |
| 43 | 'save_attributes', |
| 44 | 'add_new_attribute', |
| 45 | 'product_attributes .remove_row', |
| 46 | 'add_attribute', |
| 47 | 'add_custom_attribute', |
| 48 | 'select_all_attributes', |
| 49 | 'select_no_attributes', |
| 50 | 'wc-attribute-search', |
| 51 | 'edit-visibility' |
| 52 | ]; |
| 53 | buttons = buttons.concat( non_standard_fields.classes ); |
| 54 | |
| 55 | if( unlock_fields.file_paths == 1 ){ |
| 56 | buttons.push('downloadable_files .upload_file_button'); |
| 57 | buttons.push('downloadable_files .insert'); |
| 58 | buttons.push('downloadable_files .delete'); |
| 59 | |
| 60 | $('.downloadable_files .upload_file_button,.downloadable_files .insert,.downloadable_files .delete') |
| 61 | .on('click', function(){ return false; }); |
| 62 | } |
| 63 | |
| 64 | for (i = 0; i < buttons.length; i++) { |
| 65 | $('.'+buttons[i]).prop('disabled',true); |
| 66 | $('.'+buttons[i]).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 67 | } |
| 68 | |
| 69 | $('#visibility .edit-visibility span').on('click', function() { return false; }); |
| 70 | |
| 71 | $('.remove_variation').each(function(){ |
| 72 | $(this).prop('disabled', true); |
| 73 | $(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show().css('float','right')); |
| 74 | }); |
| 75 | |
| 76 | var inpt_names = [ |
| 77 | '_width', |
| 78 | '_height', |
| 79 | '_sku', |
| 80 | '_global_unique_id', |
| 81 | '_length', |
| 82 | '_weight', |
| 83 | 'product_length', |
| 84 | '_regular_price', |
| 85 | '_sale_price', |
| 86 | '_sale_price_dates_from', |
| 87 | '_sale_price_dates_to' |
| 88 | ]; |
| 89 | |
| 90 | if( unlock_fields.file_paths == 1 ){ |
| 91 | inpt_names.push('_download_limit'); |
| 92 | inpt_names.push('_download_expiry'); |
| 93 | inpt_names.push('_wc_file_names[]'); |
| 94 | inpt_names.push('_wc_file_urls[]'); |
| 95 | } |
| 96 | inpt_names = inpt_names.concat( non_standard_fields.input_names ); |
| 97 | |
| 98 | if( unlock_fields.menu_order == 1 ){ |
| 99 | inpt_names.push('menu_order'); |
| 100 | } |
| 101 | |
| 102 | for (i = 0; i < inpt_names.length; i++) { |
| 103 | $('input[name="'+inpt_names[i]+'"]').prop('readonly', true); |
| 104 | |
| 105 | $('.dimensions_field span.wrap').css('float','left'); |
| 106 | if( inpt_names[i] == '_width' || inpt_names[i] == '_height' || inpt_names[i] == '_length' ){ |
| 107 | $('input[name="'+inpt_names[i]+'"]').css('margin-right',0); |
| 108 | $('input[name="'+inpt_names[i]+'"]').css('float','none'); |
| 109 | $('input[name="'+inpt_names[i]+'"]').css('width','29%'); |
| 110 | |
| 111 | } |
| 112 | |
| 113 | if( inpt_names[i] == '_sale_price_dates_to' ){ |
| 114 | $('input[name="'+inpt_names[i]+'"]').after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').css('float','left').show()); |
| 115 | }else{ |
| 116 | $('input[name="'+inpt_names[i]+'"]').after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 117 | } |
| 118 | |
| 119 | |
| 120 | } |
| 121 | |
| 122 | $('#product_attributes td textarea,#product_attributes input[type="text"]').each(function(){ |
| 123 | $(this).prop('readonly', true); |
| 124 | $(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 125 | }); |
| 126 | |
| 127 | |
| 128 | $( |
| 129 | '#product_attributes input[type="checkbox"],' + |
| 130 | '#_featured,' + |
| 131 | '#product_attributes select.attribute_values' |
| 132 | ).each(function () { |
| 133 | $(this).prop('disabled', true); |
| 134 | $(this).after($('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 135 | }); |
| 136 | |
| 137 | $('form#post input[type="submit"]').click(function(){ |
| 138 | for (i = 0; i < ids.length; i++) { |
| 139 | $('#'+ids[i]).prop('disabled', false); |
| 140 | } |
| 141 | $('.woocommerce_variation select,#variable_product_options .toolbar select,.woocommerce_variation input[type="checkbox"],#product_attributes input[type="checkbox"]').each(function(){ |
| 142 | $(this).prop('disabled', false); |
| 143 | }); |
| 144 | }); |
| 145 | |
| 146 | }); |
| 147 | |
| 148 | var wcml_lock_variation_fields = function( file_path_sync ){ |
| 149 | |
| 150 | var check_attr = jQuery('.woocommerce_variation>h3 select').prop('disabled'); |
| 151 | |
| 152 | if (typeof check_attr !== typeof undefined && check_attr !== false) { |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | jQuery('.woocommerce_variation>h3 select, #variable_product_options .toolbar select, .show_if_variation_manage_stock select').each(function(){ |
| 157 | |
| 158 | jQuery(this).prop('disabled', true); |
| 159 | jQuery(this).parent().append('<input type="hidden" name="'+jQuery(this).attr('name')+'" value="'+jQuery(this).val()+'" />'); |
| 160 | jQuery(this).after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 161 | }); |
| 162 | |
| 163 | var i = 0; |
| 164 | var inpt_names = [ |
| 165 | '_width', |
| 166 | '_height', |
| 167 | '_sku', |
| 168 | '_global_unique_id', |
| 169 | '_length', |
| 170 | '_weight', |
| 171 | 'product_length', |
| 172 | '_regular_price', |
| 173 | '_sale_price', |
| 174 | '_sale_price_dates_from', |
| 175 | '_sale_price_dates_to', |
| 176 | '_stock', |
| 177 | '_low_stock_amount', |
| 178 | '_download_limit', |
| 179 | '_download_expiry' |
| 180 | ]; |
| 181 | |
| 182 | for (i = 0; i < inpt_names.length; i++) { |
| 183 | |
| 184 | //variation fields |
| 185 | jQuery('input[name^="variable'+inpt_names[i]+'"]').each(function(){ |
| 186 | jQuery(this).prop('readonly', true); |
| 187 | jQuery(this).after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 188 | }); |
| 189 | } |
| 190 | |
| 191 | //variation fields |
| 192 | var var_checkboxes = ['_enabled','_is_downloadable','_is_virtual','_manage_stock']; |
| 193 | for (i = 0; i < var_checkboxes.length; i++) { |
| 194 | jQuery('input[name^="variable'+var_checkboxes[i]+'"]').each(function(){ |
| 195 | jQuery(this).prop('disabled', true); |
| 196 | if( jQuery(this).prop('checked') ){ |
| 197 | jQuery(this).parent().append('<input type="hidden" name="'+jQuery(this).attr('name')+'" value="'+jQuery(this).val()+'" />'); |
| 198 | } |
| 199 | jQuery(this).after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 200 | }); |
| 201 | } |
| 202 | |
| 203 | var var_selectboxes = ['_stock_status','_shipping_class','_tax_class']; |
| 204 | for (i = 0; i < var_selectboxes.length; i++) { |
| 205 | jQuery('select[name^="variable'+var_selectboxes[i]+'"]').each(function(){ |
| 206 | jQuery(this).prop('disabled', true); |
| 207 | jQuery(this).parent().append('<input type="hidden" name="'+jQuery(this).attr('name')+'" value="'+jQuery(this).val()+'" />'); |
| 208 | jQuery(this).after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show()); |
| 209 | }); |
| 210 | } |
| 211 | |
| 212 | if( file_path_sync ){ |
| 213 | |
| 214 | for (var key in file_path_sync) { |
| 215 | |
| 216 | if( file_path_sync[ key ] == 1){ |
| 217 | |
| 218 | jQuery('input[name^="_wc_variation_file_names['+key+']"]').each(function(){ |
| 219 | jQuery(this).prop('readonly', true); |
| 220 | }); |
| 221 | |
| 222 | jQuery('input[name^="_wc_variation_file_urls['+key+']"]').each(function(){ |
| 223 | jQuery(this).prop('readonly', true); |
| 224 | jQuery(this).closest('tr').find('.upload_file_button').prop('disabled', true); |
| 225 | jQuery(this).closest('tr').find('.delete').prop('disabled', true); |
| 226 | jQuery(this).closest('tr').find('.delete').after(jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show().css('float','right')); |
| 227 | }); |
| 228 | |
| 229 | jQuery('input[name^="_wc_variation_file_urls['+key+']"]').closest('table').find('.insert').prop('disabled', true); |
| 230 | jQuery('input[name^="_wc_variation_file_urls['+key+']"]').closest('table').find('.insert').after( jQuery('.wcml_lock_img').clone().removeClass('wcml_lock_img').show().css('float','left') ); |
| 231 | |
| 232 | } |
| 233 | |
| 234 | } |
| 235 | |
| 236 | } |
| 237 | |
| 238 | } |