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
2 months ago
cart_widget.min.js
2 months 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
2 months ago
wcml-multi-currency.min.js
2 months ago
wcml-setup.js
3 years ago
wcml-setup.min.js
3 years ago
wcml-translation-editor.js
2 weeks ago
wcml-translation-editor.min.js
2 weeks 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
prices.js
197 lines
| 1 | jQuery(function($){ |
| 2 | |
| 3 | maybe_show_wcml_shedule_link(); |
| 4 | |
| 5 | $(document).on('click','.woocommerce_variations h3', function( e ){ |
| 6 | maybe_show_wcml_shedule_link(); |
| 7 | }); |
| 8 | |
| 9 | $(document).on('change','.wcml_custom_prices_input', function(){ |
| 10 | if($(this).val() == 1){ |
| 11 | $(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').hide(); |
| 12 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').show(); |
| 13 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').show(); |
| 14 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').hide(); |
| 15 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_auto_block_hide').hide(); |
| 16 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_auto_block_show').show(); |
| 17 | $(this).parent().find('.block_actions').hide(); |
| 18 | }else{ |
| 19 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').hide(); |
| 20 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').hide(); |
| 21 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').hide(); |
| 22 | $(this).parent().find('.block_actions').show(); |
| 23 | } |
| 24 | }); |
| 25 | |
| 26 | $(document).on('click','.wcml_custom_prices_auto_block_show', function( e ){ |
| 27 | e.preventDefault(); |
| 28 | if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 0){ |
| 29 | if(!$(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').is(':visible')){ |
| 30 | $(this).hide(); |
| 31 | $(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').show(); |
| 32 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_auto_block_hide').show(); |
| 33 | } |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | $(document).on('click','.wcml_custom_prices_auto_block_hide', function( e ){ |
| 38 | e.preventDefault(); |
| 39 | if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 0){ |
| 40 | if($(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').is(':visible')){ |
| 41 | $(this).hide(); |
| 42 | $(this).closest('.wcml_custom_prices_block').find('.wcml_automaticaly_prices_block').hide(); |
| 43 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_auto_block_show').show(); |
| 44 | } |
| 45 | } |
| 46 | }); |
| 47 | |
| 48 | $(document).on('click','.wcml_custom_prices_manually_block_hide', function( e ){ |
| 49 | e.preventDefault(); |
| 50 | |
| 51 | if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 1){ |
| 52 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').hide(); |
| 53 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').hide(); |
| 54 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').show(); |
| 55 | } |
| 56 | }); |
| 57 | |
| 58 | $(document).on('click','.wcml_custom_prices_manually_block_show', function( e ){ |
| 59 | e.preventDefault(); |
| 60 | if($(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_input:checked').val() == 1){ |
| 61 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block').show(); |
| 62 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_hide').show(); |
| 63 | $(this).closest('.wcml_custom_prices_block').find('.wcml_custom_prices_manually_block_show').hide(); |
| 64 | } |
| 65 | }); |
| 66 | |
| 67 | $(document).on('change','#_regular_price', function(){ |
| 68 | var val = $(this).val(); |
| 69 | $(this).closest('div').find('input[name="_readonly_regular_price"]').each(function(){ |
| 70 | $(this).val(val*$(this).attr('rel')); |
| 71 | }); |
| 72 | }); |
| 73 | |
| 74 | $(document).on('change','#_sale_price', function(){ |
| 75 | var val = $(this).val(); |
| 76 | $(this).closest('div').find('input[name="_readonly_sale_price"]').each(function(){ |
| 77 | $(this).val(val*$(this).attr('rel')); |
| 78 | }); |
| 79 | }); |
| 80 | |
| 81 | $(document).on('change','input[name^="variable_regular_price"]', function(){ |
| 82 | var val = $(this).val(); |
| 83 | $(this).closest('table').find('input[name="_readonly_regular_price"]').each(function(){ |
| 84 | $(this).val(val*$(this).attr('rel')); |
| 85 | }); |
| 86 | }); |
| 87 | |
| 88 | $(document).on('change','input[name^="variable_sale_price"]', function(){ |
| 89 | var val = $(this).val(); |
| 90 | $(this).closest('table').find('input[name="_readonly_sale_price"]').each(function(){ |
| 91 | $(this).val(val*$(this).attr('rel')); |
| 92 | }); |
| 93 | }); |
| 94 | |
| 95 | $(document).on('change','input.wcml_input_price', function(){ |
| 96 | if($(this).val() > 0){ |
| 97 | $(this).closest('.currency_blck').find('.wcml_no_price_message').hide(); |
| 98 | } |
| 99 | }); |
| 100 | |
| 101 | $(document).on('change','.wcml_schedule_input', function(){ |
| 102 | if($(this).val() == 1){ |
| 103 | datepick(); |
| 104 | $(this).closest('div').find('.wcml_schedule_dates').show(); |
| 105 | $(this).closest('div').find('.wcml_schedule_manually_block_show').hide(); |
| 106 | $(this).closest('div').find('.wcml_schedule_manually_block_hide').show(); |
| 107 | $(this).parent().find('.block_actions').show(); |
| 108 | }else{ |
| 109 | $(this).closest('div').find('.wcml_schedule_dates').hide(); |
| 110 | $(this).closest('div').find('.wcml_schedule_manually_block_show').show(); |
| 111 | $(this).closest('div').find('.wcml_schedule_manually_block_hide').hide(); |
| 112 | $(this).parent().find('.block_actions').hide(); |
| 113 | } |
| 114 | }); |
| 115 | |
| 116 | $(document).on('click','.wcml_schedule_manually_block_hide', function( e ){ |
| 117 | e.preventDefault(); |
| 118 | if($(this).closest('div').find('.wcml_schedule_input:checked').val() == 1){ |
| 119 | $(this).closest('div').find('.wcml_schedule_dates').hide(); |
| 120 | $(this).closest('div').find('.wcml_schedule_manually_block_show').show(); |
| 121 | $(this).closest('div').find('.wcml_schedule_manually_block_hide').hide(); |
| 122 | } |
| 123 | }); |
| 124 | |
| 125 | $(document).on('click','.wcml_schedule_manually_block_show', function( e ){ |
| 126 | e.preventDefault(); |
| 127 | if($(this).closest('div').find('.wcml_schedule_input:checked').val() == 1){ |
| 128 | datepick(); |
| 129 | $(this).closest('div').find('.wcml_schedule_dates').show(); |
| 130 | $(this).closest('div').find('.wcml_schedule_manually_block_show').hide(); |
| 131 | $(this).closest('div').find('.wcml_schedule_manually_block_hide').show(); |
| 132 | } |
| 133 | }); |
| 134 | |
| 135 | |
| 136 | $(document).on('keyup','.wcml_sale_price', function(){ |
| 137 | if( parseInt($(this).val()) > parseInt($(this).closest('div').find('.wcml_regular_price').val()) ){ |
| 138 | if( $(this).closest('p').find('.wcml_price_error').size() == 0 ) |
| 139 | $(this).after($('.wcml_price_error').clone().show()); |
| 140 | }else{ |
| 141 | $(this).closest('p').find('.wcml_price_error').remove(); |
| 142 | } |
| 143 | }); |
| 144 | |
| 145 | $(document).on('change','.wcml_sale_price', function(){ |
| 146 | if( parseInt($(this).val()) > parseInt($(this).closest('div').find('.wcml_regular_price').val()) ){ |
| 147 | $(this).val($(this).closest('div').find('.wcml_regular_price').val()); |
| 148 | $(this).closest('p').find('.wcml_price_error').remove(); |
| 149 | } |
| 150 | }); |
| 151 | |
| 152 | function maybe_show_wcml_shedule_link(){ |
| 153 | $('.wcml_schedule_input').each(function(){ |
| 154 | if($(this).is(':checked') && $(this).val() == 1){ |
| 155 | $(this).parent().find('.block_actions').show(); |
| 156 | } |
| 157 | }); |
| 158 | } |
| 159 | |
| 160 | function datepick(){ |
| 161 | var date_img = ''; |
| 162 | if(typeof woocommerce_admin_meta_boxes != 'undefined'){ |
| 163 | date_img = woocommerce_admin_meta_boxes.calendar_image; |
| 164 | }else{ |
| 165 | date_img = woocommerce_writepanel_params.calendar_image; |
| 166 | } |
| 167 | |
| 168 | $( ".wcml_schedule_dates input" ).datepicker({ |
| 169 | defaultDate: "", |
| 170 | dateFormat: "yy-mm-dd", |
| 171 | numberOfMonths: 1, |
| 172 | showButtonPanel: true, |
| 173 | showOn: "button", |
| 174 | buttonImage: date_img, |
| 175 | buttonImageOnly: true, |
| 176 | onSelect: function( selectedDate ) { |
| 177 | |
| 178 | var instance = $( this ).data( "datepicker" ), |
| 179 | date = $.datepicker.parseDate( |
| 180 | instance.settings.dateFormat || |
| 181 | $.datepicker._defaults.dateFormat, |
| 182 | selectedDate, instance.settings ); |
| 183 | |
| 184 | if($(this).is('.custom_sale_price_dates_from')){ |
| 185 | $(this).closest('div').find('.custom_sale_price_dates_to').datepicker( "option", "minDate", date ); |
| 186 | }else{ |
| 187 | $(this).closest('div').find('.custom_sale_price_dates_from').datepicker( "option", "maxDate", date ); |
| 188 | } |
| 189 | |
| 190 | } |
| 191 | }); |
| 192 | } |
| 193 | |
| 194 | |
| 195 | }); |
| 196 | |
| 197 |