html-column-shipping-message.php
1 week ago
html-custom-services.php
1 week ago
html-menu-icon.php
1 week ago
html-shipping-method-scripts.php
1 week ago
html-shipping-method-settings.php
1 week ago
html-shipping-settings-advanced.php
1 week ago
html-shipping-settings-info-description.php
1 week ago
html-shipping-method-settings.php
231 lines
| 1 | <?php if ( ! defined( 'ABSPATH' ) ) { |
| 2 | exit; |
| 3 | } ?> |
| 4 | <tr valign="top"> |
| 5 | <td class="forminp" style="padding-left:0;padding-right:0;"> |
| 6 | <fieldset> |
| 7 | <legend class="screen-reader-text"><span><?php echo wp_kses_post( $data['title'] ); ?></span></legend> |
| 8 | |
| 9 | <table class="flexible_shipping_methods wc_shipping widefat wp-list-table" cellspacing="0"> |
| 10 | <thead> |
| 11 | <tr> |
| 12 | <th class="sort"> </th> |
| 13 | <th class="title"><?php esc_html_e( 'Title', 'flexible-shipping' ); ?></th> |
| 14 | <th class="status"><?php esc_html_e( 'Enabled', 'flexible-shipping' ); ?></th> |
| 15 | <th class="visibility"><?php esc_html_e( 'Visibility', 'flexible-shipping' ); ?></th> |
| 16 | <th class="default"><?php esc_html_e( 'Default', 'flexible-shipping' ); ?></th> |
| 17 | <th class="integration"><?php esc_html_e( 'Integration', 'flexible-shipping' ); ?></th> |
| 18 | <th class="select check-column"><input type="checkbox" class="tips checkbox-select-all" |
| 19 | value="1" |
| 20 | data-tip="<?php esc_attr_e( 'Select all', 'flexible-shipping' ); ?>"/> |
| 21 | </th> |
| 22 | </tr> |
| 23 | </thead> |
| 24 | <tbody> |
| 25 | <?php if ( isset( $shipping_method_order ) && is_array( $shipping_method_order ) ) : ?> |
| 26 | <?php foreach ( $shipping_method_order as $shipping_method_id ) : ?> |
| 27 | <?php $shipping_method = $shipping_methods[ $shipping_method_id ]; ?> |
| 28 | <?php $tr_class = ''; ?> |
| 29 | <?php |
| 30 | if ( isset( $_GET['added'] ) && sanitize_key( $_GET['added'] ) == $shipping_method_id ) { |
| 31 | $tr_class = 'highlight'; |
| 32 | } |
| 33 | if ( isset( $_GET['updated'] ) && sanitize_key( $_GET['updated'] ) == $shipping_method_id ) { |
| 34 | $tr_class = 'highlight'; |
| 35 | } |
| 36 | ?> |
| 37 | <tr id="method_<?php echo esc_attr( $shipping_method_id ); ?>" class="<?php echo esc_attr( $tr_class ); ?>"> |
| 38 | <td width="1%" class="sort"> |
| 39 | <input type="hidden" |
| 40 | name="method_order[<?php echo esc_attr( $shipping_method['id'] ); ?>]" |
| 41 | value="<?php echo esc_attr( $shipping_method['id'] ); ?>"/> |
| 42 | </td> |
| 43 | <td class="title"> |
| 44 | <a data-qa-id="shipping-method-<?php echo esc_attr( $shipping_method['method_title'] ); ?>" |
| 45 | href="<?php echo esc_url( add_query_arg( 'method_id', $shipping_method_id, add_query_arg( 'action', 'edit' ) ) ); ?>"> |
| 46 | <strong><?php echo esc_html( $shipping_method['method_title'] ); ?></strong> |
| 47 | </a> |
| 48 | <?php if ( isset( $shipping_method['method_description'] ) && $shipping_method['method_description'] != '' ) : ?> |
| 49 | (<?php echo esc_html( $shipping_method['method_description'] ); ?>) |
| 50 | <?php endif; ?> |
| 51 | </td> |
| 52 | <td width="1%" class="status"> |
| 53 | <?php if ( isset( $shipping_method['method_enabled'] ) && 'yes' === $shipping_method['method_enabled'] ) : ?> |
| 54 | <span class="status-enabled tips" |
| 55 | data-tip="<?php esc_attr_e( 'yes', 'flexible-shipping' ); ?>"><?php esc_html_e( 'yes', 'flexible-shipping' ); ?></span> |
| 56 | <?php else : ?> |
| 57 | <span class="na">-</span> |
| 58 | <?php endif; ?> |
| 59 | </td> |
| 60 | <td width="1%" class="default visibility"> |
| 61 | <?php if ( isset( $shipping_method['method_visibility'] ) && 'yes' === $shipping_method['method_visibility'] ) : ?> |
| 62 | <span class="status-enabled tips" |
| 63 | data-tip="<?php esc_attr_e( 'Show only for logged in users', 'flexible-shipping' ); ?>"><?php esc_html_e( 'yes', 'flexible-shipping' ); ?></span> |
| 64 | <?php else : ?> |
| 65 | <span class="na tips" |
| 66 | data-tip="<?php esc_attr_e( 'Show for all users', 'flexible-shipping' ); ?>">-</span> |
| 67 | <?php endif; ?> |
| 68 | </td> |
| 69 | <td width="1%" class="default"> |
| 70 | <?php if ( 'yes' === $shipping_method['method_default'] ) : ?> |
| 71 | <span class="status-enabled tips" |
| 72 | data-tip="<?php esc_attr_e( 'yes', 'flexible-shipping' ); ?>"><?php esc_html_e( 'yes', 'flexible-shipping' ); ?></span> |
| 73 | <?php else : ?> |
| 74 | <span class="na">-</span> |
| 75 | <?php endif; ?> |
| 76 | </td> |
| 77 | <?php echo wp_kses_post( apply_filters( 'flexible_shipping_method_integration_col', '<td width="1%" class="integration default">-</td>', $shipping_method ) ); ?> |
| 78 | <td width="1%" class="select check-column" nowrap> |
| 79 | <input type="checkbox" class="tips checkbox-select" |
| 80 | value="<?php echo esc_attr( $shipping_method['id'] ); ?>" |
| 81 | data-tip="<?php echo esc_html( $shipping_method['method_title'] ); ?>"/> |
| 82 | </td> |
| 83 | </tr> |
| 84 | <?php endforeach; ?> |
| 85 | <?php endif; ?> |
| 86 | </tbody> |
| 87 | <tfoot> |
| 88 | <tr> |
| 89 | <th> </th> |
| 90 | <th colspan="8"><span |
| 91 | class="description"><?php esc_html_e( 'Drag and drop the above shipment methods to control their display order. Confirm by clicking Save changes button below.', 'flexible-shipping' ); ?></span> |
| 92 | </th> |
| 93 | </tr> |
| 94 | <tr> |
| 95 | <th> </th> |
| 96 | <th colspan="8"> |
| 97 | <button id="flexible_shipping_remove_selected" class="button" |
| 98 | disabled><?php esc_html_e( 'Remove selected', 'flexible-shipping' ); ?></button> |
| 99 | <div class="flexilble_shipping_export_import"> |
| 100 | <input id="flexible_shipping_import_file" type="file" name="import_file" |
| 101 | style="display:none;" accept=".csv,.json"/> |
| 102 | <input id="flexible_shipping_import_action" type="hidden" name="import_action" |
| 103 | value="0"/> |
| 104 | <button id="flexible_shipping_import_cancel" class="button" |
| 105 | style="display:none;"><?php esc_html_e( 'Cancel import', 'flexible-shipping' ); ?></button> |
| 106 | <input id="flexible_shipping_do_import" style="display:none;" |
| 107 | class="button button-primary" |
| 108 | data-instance-id="<?php echo esc_attr( isset( $_GET['instance_id'] ) ? sanitize_key( $_GET['instance_id'] ) : '1' ); ?>" |
| 109 | data-nonce="<?php echo esc_attr( wp_create_nonce( 'flexible_shipping' ) ); ?>" type="submit" |
| 110 | value="<?php esc_attr_e( 'Import', 'flexible-shipping' ); ?>"/> |
| 111 | <button id="flexible_shipping_import" class="button" |
| 112 | data-instance-id="<?php isset( $_GET['instance_id'] ) ? sanitize_key( $_GET['instance_id'] ) : '1'; ?>" |
| 113 | data-nonce="<?php echo esc_attr( wp_create_nonce( 'flexible_shipping' ) ); ?>"><?php esc_html_e( 'Import', 'flexible-shipping' ); ?></button> |
| 114 | <?php do_action( 'flexible_shipping_actions_row' ); ?> |
| 115 | </div> |
| 116 | <div style="clear:both;"></div> |
| 117 | </th> |
| 118 | </tr> |
| 119 | </tfoot> |
| 120 | </table> |
| 121 | |
| 122 | <?php echo wp_kses_post( $this->get_description_html( $data ) ); ?> |
| 123 | </fieldset> |
| 124 | </td> |
| 125 | </tr> |
| 126 | <script type="text/javascript"> |
| 127 | <?php |
| 128 | if ( version_compare( WC()->version, '2.6.0', '>=' ) ) : |
| 129 | $zone = WC_Shipping_Zones::get_zone_by( 'instance_id', sanitize_key( $_GET['instance_id'] ) ); |
| 130 | $shipping_method_woo = WC_Shipping_Zones::get_shipping_method( sanitize_key( $_GET['instance_id'] ) ); |
| 131 | $content = '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping' ) . '">' . __( 'Shipping Zones', 'flexible-shipping' ) . '</a> > '; |
| 132 | $content .= '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=' . absint( $zone->get_id() ) ) . '">' . esc_html( $zone->get_zone_name() ) . '</a> >'; |
| 133 | $content .= esc_html( $shipping_method_woo->get_title() ); |
| 134 | ?> |
| 135 | jQuery('#mainform h2').first().replaceWith('<h2>' + '<?php echo wp_kses_post( $content ); ?>' + '</h2>'); |
| 136 | |
| 137 | <?php |
| 138 | global $wp; |
| 139 | $current_url = 'admin.php?page=wc-settings&tab=shipping&instance_id=' . sanitize_key( $_GET['instance_id'] ); |
| 140 | ?> |
| 141 | |
| 142 | jQuery('#mainform').attr('action', '<?php echo esc_url( $current_url ); ?>'); |
| 143 | <?php |
| 144 | endif; |
| 145 | ?> |
| 146 | |
| 147 | jQuery("input.checkbox-select-all").click(function () { |
| 148 | if (jQuery(this).is(':checked')) { |
| 149 | jQuery('input.checkbox-select').prop('checked', true); |
| 150 | } else { |
| 151 | jQuery('input.checkbox-select').prop('checked', false); |
| 152 | } |
| 153 | }) |
| 154 | |
| 155 | /** |
| 156 | * Enable Bulk Action Buttons when at least one Shipping Method is selected |
| 157 | * |
| 158 | */ |
| 159 | jQuery('.flexible_shipping_methods input[type="checkbox"]').click(function () { |
| 160 | jQuery('#flexible_shipping_export_selected, #flexible_shipping_remove_selected').attr('disabled', !jQuery('.flexible_shipping_methods td input[type="checkbox"]').is(':checked')); |
| 161 | }); |
| 162 | |
| 163 | jQuery('#flexible_shipping_remove_selected').click(function () { |
| 164 | var empty_url = '<?php echo add_query_arg( 'methods_id', '', add_query_arg( 'action', 'delete', admin_url( 'admin.php?page=wc-settings&tab=shipping&instance_id=' . sanitize_key( $_GET['instance_id'] ) ) ) ); // phpcs:ignore ?>'; |
| 165 | var url = empty_url; |
| 166 | var first = true; |
| 167 | jQuery('input.checkbox-select').each(function () { |
| 168 | if (jQuery(this).is(':checked')) { |
| 169 | if (!first) { |
| 170 | url = url + ','; |
| 171 | } else { |
| 172 | url = url + '='; |
| 173 | } |
| 174 | url = url + jQuery(this).val(); |
| 175 | first = false; |
| 176 | } |
| 177 | }) |
| 178 | if (first) { |
| 179 | alert('<?php esc_attr_e( 'Please select shipment methods to remove', 'flexible-shipping' ); ?>'); |
| 180 | return false; |
| 181 | } |
| 182 | if (url !== empty_url) { |
| 183 | jQuery('#flexible_shipping_remove_selected').prop('disabled', true); |
| 184 | jQuery('.woocommerce-save-button').prop('disabled', true); |
| 185 | |
| 186 | window.location.href = url; |
| 187 | } |
| 188 | return false; |
| 189 | }) |
| 190 | |
| 191 | jQuery('#flexible_shipping_import').click(function () { |
| 192 | jQuery(this).hide(); |
| 193 | jQuery('#flexible_shipping_do_import').show(); |
| 194 | jQuery('#flexible_shipping_import_file').show(); |
| 195 | jQuery('#flexible_shipping_import_cancel').show(); |
| 196 | jQuery('input[name=save]').prop('disabled', true); |
| 197 | return false; |
| 198 | }) |
| 199 | |
| 200 | jQuery('#flexible_shipping_import_cancel').click(function () { |
| 201 | jQuery(this).hide(); |
| 202 | jQuery('#flexible_shipping_do_import').hide(); |
| 203 | jQuery('#flexible_shipping_import_file').hide(); |
| 204 | jQuery('#flexible_shipping_import_cancel').hide(); |
| 205 | jQuery('#flexible_shipping_import').show(); |
| 206 | jQuery('input[name=save]').prop('disabled', false); |
| 207 | return false; |
| 208 | }) |
| 209 | |
| 210 | jQuery('#flexible_shipping_do_import').click(function () { |
| 211 | if (jQuery('#flexible_shipping_import_file').val() == '') { |
| 212 | alert('<?php esc_attr_e( 'Select file to import', 'flexible-shipping' ); ?>'); |
| 213 | return false; |
| 214 | } |
| 215 | jQuery('#flexible_shipping_import_action').val('1'); |
| 216 | jQuery('input[name=save]').prop('disabled', false); |
| 217 | jQuery('.woocommerce-save-button').click(); |
| 218 | return false; |
| 219 | }) |
| 220 | |
| 221 | <?php |
| 222 | if ( isset( $_POST['import_action'] ) && sanitize_key( $_POST['import_action'] ) == '1' ) { // phpcs:ignore |
| 223 | ?> |
| 224 | jQuery('.updated.inline:lt(1)').hide(); |
| 225 | jQuery('.updated.inline:lt(2)').hide(); |
| 226 | <?php |
| 227 | } |
| 228 | ?> |
| 229 | </script> |
| 230 | <?php |
| 231 |