class-wc-settings-rest-api.php
5 years ago
html-admin-page-shipping-classes.php
1 month ago
html-admin-page-shipping-providers.php
1 month ago
html-admin-page-shipping-zone-methods.php
1 month ago
html-admin-page-shipping-zones-instance.php
8 years ago
html-admin-page-shipping-zones.php
1 month ago
html-keys-edit.php
1 month ago
html-settings-tax.php
1 year ago
html-webhooks-edit.php
1 month ago
settings-tax.php
2 months ago
html-admin-page-shipping-classes.php
167 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Shipping classes admin |
| 4 | * |
| 5 | * @package WooCommerce\Admin\Shipping |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | ?> |
| 13 | |
| 14 | <h2 class="wc-shipping-zones-heading"> |
| 15 | <span><?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?></span> |
| 16 | <a class="page-title-action wc-shipping-class-add-new" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a> |
| 17 | </h2> |
| 18 | |
| 19 | <p class="wc-shipping-zone-help-text"> |
| 20 | <?php esc_html_e( 'Use shipping classes to customize the shipping rates for different groups of products, such as heavy items that require higher postage fees.', 'woocommerce' ); ?> <a target="_blank" href="https://woocommerce.com/document/product-shipping-classes/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a> |
| 21 | </p> |
| 22 | |
| 23 | <table class="wc-shipping-classes widefat"> |
| 24 | <thead> |
| 25 | <tr> |
| 26 | <?php foreach ( $shipping_class_columns as $class => $heading ) : ?> |
| 27 | <th class="<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $heading ); ?></th> |
| 28 | <?php endforeach; ?> |
| 29 | <th /> |
| 30 | </tr> |
| 31 | </thead> |
| 32 | <tbody class="wc-shipping-class-rows wc-shipping-tables-tbody"></tbody> |
| 33 | </table> |
| 34 | |
| 35 | <script type="text/html" id="tmpl-wc-shipping-class-row-blank"> |
| 36 | <tr> |
| 37 | <td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) + 1 ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td> |
| 38 | </tr> |
| 39 | </script> |
| 40 | |
| 41 | <!-- 1. Placeholder becomes the "label" in view class div --> |
| 42 | <!-- 1. Add labelFor or some kind of attribute for semantic HTML--> |
| 43 | |
| 44 | <script type="text/html" id="tmpl-wc-shipping-class-configure"> |
| 45 | <div class="wc-backbone-modal wc-shipping-class-modal"> |
| 46 | <div class="wc-backbone-modal-content" data-id="{{ data.term_id }}"> |
| 47 | <section class="wc-backbone-modal-main" role="main"> |
| 48 | <header class="wc-backbone-modal-header"> |
| 49 | <h1><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></h1> |
| 50 | <button class="modal-close modal-close-link dashicons dashicons-no-alt"> |
| 51 | <span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span> |
| 52 | </button> |
| 53 | </header> |
| 54 | <article> |
| 55 | <form action="" method="post"> |
| 56 | <input type="hidden" name="term_id" value="{{{ data.term_id }}}" /> |
| 57 | <?php |
| 58 | foreach ( $shipping_class_columns as $class => $heading ) { |
| 59 | echo '<div class="wc-shipping-class-modal-input ' . esc_attr( $class ) . '">'; |
| 60 | switch ( $class ) { |
| 61 | case 'wc-shipping-class-name': |
| 62 | ?> |
| 63 | <div class="view"> |
| 64 | <?php echo esc_html( $heading ); ?> * |
| 65 | </div> |
| 66 | <div class="edit"> |
| 67 | <input type="text" name="name" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'e.g. Heavy', 'woocommerce' ); ?>" /> |
| 68 | </div> |
| 69 | <div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Give your shipping class a name for easy identification', 'woocommerce' ); ?></div> |
| 70 | <?php |
| 71 | break; |
| 72 | case 'wc-shipping-class-slug': |
| 73 | ?> |
| 74 | <div class="view"> |
| 75 | <?php echo esc_html( $heading ); ?> |
| 76 | </div> |
| 77 | <div class="edit"> |
| 78 | <input type="text" name="slug" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'e.g. heavy-packages', 'woocommerce' ); ?>" /> |
| 79 | </div> |
| 80 | <div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Slug (unique identifier) can be left blank and auto-generated, or you can enter one', 'woocommerce' ); ?></div> |
| 81 | <?php |
| 82 | break; |
| 83 | case 'wc-shipping-class-description': |
| 84 | ?> |
| 85 | <div class="view"> |
| 86 | <?php echo esc_html( $heading ); ?> * |
| 87 | </div> |
| 88 | <div class="edit"> |
| 89 | <input type="text" name="description" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'e.g. For heavy items requiring higher postage', 'woocommerce' ); ?>" /> |
| 90 | </div> |
| 91 | <?php |
| 92 | break; |
| 93 | case 'wc-shipping-class-count': |
| 94 | break; |
| 95 | default: |
| 96 | ?> |
| 97 | <div class="view wc-shipping-class-hide-sibling-view"> |
| 98 | <?php echo esc_html( $heading ); ?> |
| 99 | </div> |
| 100 | <?php |
| 101 | // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment |
| 102 | do_action( 'woocommerce_shipping_classes_column_' . $class ); |
| 103 | break; |
| 104 | } |
| 105 | echo '</div>'; |
| 106 | } |
| 107 | ?> |
| 108 | </form> |
| 109 | </article> |
| 110 | <footer> |
| 111 | <div class="wc-backbone-modal-buttons"> |
| 112 | <button id="btn-ok" disabled class="button button-primary button-large disabled"> |
| 113 | <div class="wc-backbone-modal-action-{{ data.action === 'create' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div> |
| 114 | <div class="wc-backbone-modal-action-{{ data.action === 'edit' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div> |
| 115 | </button> |
| 116 | </div> |
| 117 | </footer> |
| 118 | </section> |
| 119 | </div> |
| 120 | </div> |
| 121 | <div class="wc-backbone-modal-backdrop modal-close"></div> |
| 122 | </script> |
| 123 | |
| 124 | <script type="text/html" id="tmpl-wc-shipping-class-row"> |
| 125 | <tr data-id="{{ data.term_id }}"> |
| 126 | <?php |
| 127 | foreach ( $shipping_class_columns as $class => $heading ) { |
| 128 | echo '<td class="' . esc_attr( $class ) . '">'; |
| 129 | switch ( $class ) { |
| 130 | case 'wc-shipping-class-name': |
| 131 | ?> |
| 132 | <div class="view"> |
| 133 | {{ data.name }} |
| 134 | </div> |
| 135 | <?php |
| 136 | break; |
| 137 | case 'wc-shipping-class-slug': |
| 138 | ?> |
| 139 | <div class="view">{{ data.slug }}</div> |
| 140 | <?php |
| 141 | break; |
| 142 | case 'wc-shipping-class-description': |
| 143 | ?> |
| 144 | <div class="view">{{ data.description }}</div> |
| 145 | <?php |
| 146 | break; |
| 147 | case 'wc-shipping-class-count': |
| 148 | ?> |
| 149 | <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=product&product_shipping_class=' ) ); ?>{{data.slug}}">{{ data.count }}</a> |
| 150 | <?php |
| 151 | break; |
| 152 | default: |
| 153 | // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment |
| 154 | do_action( 'woocommerce_shipping_classes_column_' . $class ); |
| 155 | break; |
| 156 | } |
| 157 | echo '</td>'; |
| 158 | } |
| 159 | ?> |
| 160 | <td class="wc-shipping-zone-actions"> |
| 161 | <div> |
| 162 | <a class="wc-shipping-class-edit wc-shipping-zone-action-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a> |
| 163 | </div> |
| 164 | </td> |
| 165 | </tr> |
| 166 | </script> |
| 167 |