add-new-product-button.php
1 month ago
confirm-bulk-delete.php
2 years ago
edit.php
3 years ago
import-results.php
1 month ago
index.php
1 month ago
import-results.php
218 lines
| 1 | <style> |
| 2 | #wpwrap { |
| 3 | --sc-color-primary-500: #00824C; |
| 4 | --sc-focus-ring-color-primary: #00824C; |
| 5 | --sc-color-primary-text: #fff; |
| 6 | background: var(--sc-color-brand-main-background); |
| 7 | } |
| 8 | |
| 9 | /* Prevent flash of unstyled content while web components hydrate. */ |
| 10 | sc-card:not(:defined), |
| 11 | sc-flex:not(:defined), |
| 12 | sc-icon:not(:defined), |
| 13 | sc-heading:not(:defined), |
| 14 | sc-text:not(:defined), |
| 15 | sc-button:not(:defined), |
| 16 | sc-breadcrumbs:not(:defined) { |
| 17 | opacity: 0; |
| 18 | } |
| 19 | |
| 20 | sc-card:defined, |
| 21 | sc-flex:defined, |
| 22 | sc-icon:defined, |
| 23 | sc-heading:defined, |
| 24 | sc-text:defined, |
| 25 | sc-button:defined, |
| 26 | sc-breadcrumbs:defined { |
| 27 | opacity: 1; |
| 28 | transition: opacity 0.15s ease-in; |
| 29 | } |
| 30 | |
| 31 | .wrap .import-results-container { |
| 32 | width: 100%; |
| 33 | padding-top: 3em; |
| 34 | } |
| 35 | |
| 36 | .wrap .import-results-container sc-card { |
| 37 | width: 100%; |
| 38 | max-width: 700px; |
| 39 | } |
| 40 | |
| 41 | .import-results-icon { |
| 42 | font-size: 24px; |
| 43 | color: var(--sc-color-primary-500); |
| 44 | } |
| 45 | |
| 46 | .import-results-summary { |
| 47 | font-size: 14px; |
| 48 | line-height: 1.6; |
| 49 | margin:0; |
| 50 | } |
| 51 | |
| 52 | .import-results-summary strong { |
| 53 | font-weight: 600; |
| 54 | } |
| 55 | |
| 56 | .import-results-table { |
| 57 | width: 100%; |
| 58 | border-collapse: collapse; |
| 59 | font-size: 13px; |
| 60 | border: 1px solid var(--sc-color-gray-300, #e0e0e0); |
| 61 | } |
| 62 | |
| 63 | .import-results-table th, |
| 64 | .import-results-table td { |
| 65 | text-align: left; |
| 66 | padding: 8px 12px; |
| 67 | border: 1px solid var(--sc-color-gray-300, #e0e0e0); |
| 68 | color: var(--sc-color-gray-700, #555); |
| 69 | } |
| 70 | |
| 71 | .import-results-table th { |
| 72 | font-weight: 600; |
| 73 | background: var(--sc-color-gray-50, #fafafa); |
| 74 | } |
| 75 | |
| 76 | .import-results-docs-link { |
| 77 | display: inline-flex; |
| 78 | align-items: center; |
| 79 | gap: 0.3em; |
| 80 | color: #2563EB; |
| 81 | text-decoration: none; |
| 82 | font-size: 14px; |
| 83 | } |
| 84 | |
| 85 | .import-results-docs-link:hover { |
| 86 | text-decoration: underline; |
| 87 | } |
| 88 | </style> |
| 89 | |
| 90 | <div class="wrap"> |
| 91 | <?php \SureCart::render( 'layouts/partials/admin-index-styles' ); ?> |
| 92 | |
| 93 | <sc-flex justify-content="center" class="import-results-container"> |
| 94 | <sc-card style="--sc-card-padding: var(--sc-spacing-xxx-large)"> |
| 95 | <sc-flex flex-direction="column" style="--sc-flex-column-gap: 1.25em;"> |
| 96 | <sc-icon name="download" class="import-results-icon"></sc-icon> |
| 97 | |
| 98 | <sc-heading size="large"><?php esc_html_e( 'Import Products', 'surecart' ); ?></sc-heading> |
| 99 | |
| 100 | <div class="import-results-summary"> |
| 101 | <?php if ( ! empty( $results_capped ) ) : ?> |
| 102 | <p role="alert" style="color: #92400e; background: #fef3c7; padding: 8px 12px; border-radius: 4px; margin: 0 0 0.5em;"> |
| 103 | ⚠ <?php esc_html_e( 'Note: Only the first 5,000 results are shown below. Your import may have additional rows not displayed here.', 'surecart' ); ?> |
| 104 | </p> |
| 105 | <?php endif; ?> |
| 106 | |
| 107 | <?php if ( ! empty( $all_skipped ) ) : ?> |
| 108 | <?php esc_html_e( 'No products were imported. All products were skipped (see details below).', 'surecart' ); ?> |
| 109 | <?php elseif ( $succeeded_count > 0 ) : ?> |
| 110 | <?php |
| 111 | echo wp_kses( |
| 112 | sprintf( |
| 113 | /* translators: %s: number of successfully imported products */ |
| 114 | __( 'You have successfully imported %s products.', 'surecart' ), |
| 115 | '<strong>' . esc_html( $succeeded_count ) . '</strong>' |
| 116 | ), |
| 117 | [ 'strong' => [] ] |
| 118 | ); |
| 119 | ?> |
| 120 | <?php else : ?> |
| 121 | <?php esc_html_e( 'No products were imported.', 'surecart' ); ?> |
| 122 | <?php endif; ?> |
| 123 | </div> |
| 124 | |
| 125 | <?php if ( ! empty( $failed_rows ) ) : ?> |
| 126 | <div> |
| 127 | <p class="import-results-summary"> |
| 128 | <?php |
| 129 | echo wp_kses( |
| 130 | sprintf( |
| 131 | /* translators: %s: number of failed products */ |
| 132 | __( '%s products failed to import due to:', 'surecart' ), |
| 133 | '<strong>' . esc_html( count( $failed_rows ) ) . '</strong>' |
| 134 | ), |
| 135 | [ 'strong' => [] ] |
| 136 | ); |
| 137 | ?> |
| 138 | </p> |
| 139 | </div> |
| 140 | <table class="import-results-table"> |
| 141 | <caption class="screen-reader-text"><?php esc_html_e( 'Failed product imports', 'surecart' ); ?></caption> |
| 142 | <thead> |
| 143 | <tr> |
| 144 | <th scope="col"><?php esc_html_e( 'Product Name', 'surecart' ); ?></th> |
| 145 | <th scope="col"><?php esc_html_e( 'Reason', 'surecart' ); ?></th> |
| 146 | </tr> |
| 147 | </thead> |
| 148 | <tbody> |
| 149 | <?php foreach ( $failed_rows as $row ) : ?> |
| 150 | <tr> |
| 151 | <td><?php echo esc_html( $row['name'] ?? '' ); ?></td> |
| 152 | <td><?php echo esc_html( $row['reason'] ?? '' ); ?></td> |
| 153 | </tr> |
| 154 | <?php endforeach; ?> |
| 155 | </tbody> |
| 156 | </table> |
| 157 | <?php endif; ?> |
| 158 | |
| 159 | <?php if ( ! empty( $skipped_products ) ) : ?> |
| 160 | <div> |
| 161 | <?php if ( empty( $all_skipped ) ) : ?> |
| 162 | <p class="import-results-summary" style="margin-bottom: 1em;"> |
| 163 | <?php |
| 164 | echo wp_kses( |
| 165 | sprintf( |
| 166 | /* translators: %s: number of skipped products */ |
| 167 | __( '%s products were skipped:', 'surecart' ), |
| 168 | '<strong>' . esc_html( count( $skipped_products ) ) . '</strong>' |
| 169 | ), |
| 170 | [ 'strong' => [] ] |
| 171 | ); |
| 172 | ?> |
| 173 | </p> |
| 174 | <?php endif; ?> |
| 175 | <sc-heading size="medium" style="margin-bottom: 0.5em;"> |
| 176 | <?php esc_html_e( 'Skipped Products', 'surecart' ); ?> |
| 177 | </sc-heading> |
| 178 | <p class="description" style="margin-bottom: 1em;"> |
| 179 | <?php esc_html_e( 'The following products were not imported because they are unsupported product types or could not be processed.', 'surecart' ); ?> |
| 180 | </p> |
| 181 | <table class="import-results-table"> |
| 182 | <caption class="screen-reader-text"><?php esc_html_e( 'Skipped products', 'surecart' ); ?></caption> |
| 183 | <thead> |
| 184 | <tr> |
| 185 | <th scope="col"><?php esc_html_e( 'Product Name', 'surecart' ); ?></th> |
| 186 | <th scope="col"><?php esc_html_e( 'Type', 'surecart' ); ?></th> |
| 187 | <th scope="col"><?php esc_html_e( 'Reason', 'surecart' ); ?></th> |
| 188 | </tr> |
| 189 | </thead> |
| 190 | <tbody> |
| 191 | <?php foreach ( $skipped_products as $product ) : ?> |
| 192 | <tr> |
| 193 | <td><?php echo esc_html( $product['name'] ?? __( 'Unknown', 'surecart' ) ); ?></td> |
| 194 | <td><?php echo esc_html( $product['type'] ?? '-' ); ?></td> |
| 195 | <td><?php echo esc_html( $product['reason'] ?? __( 'Unknown reason', 'surecart' ) ); ?></td> |
| 196 | </tr> |
| 197 | <?php endforeach; ?> |
| 198 | </tbody> |
| 199 | </table> |
| 200 | </div> |
| 201 | <?php endif; ?> |
| 202 | |
| 203 | <a href="https://surecart.com/docs" target="_blank" rel="noopener noreferrer" class="import-results-docs-link"> |
| 204 | <?php esc_html_e( 'Go to documentation', 'surecart' ); ?> |
| 205 | <span class="screen-reader-text"><?php esc_html_e( '(opens in a new tab)', 'surecart' ); ?></span> |
| 206 | <sc-icon name="external-link" style="font-size: 14px;" aria-hidden="true"></sc-icon> |
| 207 | </a> |
| 208 | |
| 209 | <div> |
| 210 | <sc-button href="<?php echo esc_url( \SureCart::getUrl()->index( 'products' ) ); ?>" size="medium" type="primary"> |
| 211 | <?php esc_html_e( 'Show All Products', 'surecart' ); ?> |
| 212 | </sc-button> |
| 213 | </div> |
| 214 | </sc-flex> |
| 215 | </sc-card> |
| 216 | </sc-flex> |
| 217 | </div> |
| 218 |