chore(wc): 同步 A v3.4.6 的 WooCommerce 整合 + TablePrefix header(F4/F5)

4 個整合檔(woocommerce / wc-orders-interceptor / wc-term-count-filter /
admin-wc)對齊 A v3.4.6;主檔補 TablePrefix header。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
This commit is contained in:
2026-07-31 06:07:39 +08:00
parent 955689ddd2
commit 2f9ed57390
5 changed files with 37 additions and 34 deletions
+29 -29
View File
@@ -9,7 +9,7 @@
* - WC tables registered (count + health)
* - Top vendors by commission (from wp_wpdo_wc_commissions)
*
* @package WP_Data_Optimizer
* @package TMDO
* @since 2.1.0
*/
@@ -45,8 +45,8 @@ final class TMDO_Admin_WC {
public static function register_menu(): void {
add_submenu_page(
'tools.php',
__( 'WPDO WooCommerce', 'tmdo-woocommerce' ),
__( 'WPDO WC', 'tmdo-woocommerce' ),
__( 'WPDO WooCommerce', '2meet-data-optimizer' ),
__( 'WPDO WC', '2meet-data-optimizer' ),
self::CAP,
self::MENU_SLUG,
array( __CLASS__, 'render' )
@@ -68,61 +68,61 @@ final class TMDO_Admin_WC {
$totals = self::global_commission_totals();
?>
<div class="wrap">
<h1><?php esc_html_e( 'WPDO × WooCommerce', 'tmdo-woocommerce' ); ?></h1>
<h1><?php esc_html_e( 'WPDO × WooCommerce', '2meet-data-optimizer' ); ?></h1>
<h2><?php esc_html_e( 'WC 環境', 'tmdo-woocommerce' ); ?></h2>
<table class="widefat" style="max-width:520px;">
<h2><?php esc_html_e( 'WC 環境', '2meet-data-optimizer' ); ?></h2>
<table class="widefat wpdo-max-520">
<tr>
<th><?php esc_html_e( 'WC 版本', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( 'WC 版本', '2meet-data-optimizer' ); ?></th>
<td><?php echo esc_html( $wc_ver ); ?></td>
</tr>
<tr>
<th><?php esc_html_e( 'HPOS 啟用', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( 'HPOS 啟用', '2meet-data-optimizer' ); ?></th>
<td>
<?php if ( $hpos ) : ?>
<span style="color:#2a5a2a;">✅ <?php esc_html_e( '是 — orders 走 wp_wc_orders 不污染 postmeta', 'tmdo-woocommerce' ); ?></span>
<span class="wpdo-text-success">✅ <?php esc_html_e( '是 — orders 走 wp_wc_orders 不污染 postmeta', '2meet-data-optimizer' ); ?></span>
<?php else : ?>
<span style="color:#c44;">⚠️ <?php esc_html_e( '否 — orders 仍存於 wp_postmeta(建議啟用以加速)', 'tmdo-woocommerce' ); ?></span>
&nbsp;<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced&section=features' ) ); ?>" class="button button-small"><?php esc_html_e( '前往設定', 'tmdo-woocommerce' ); ?></a>
<span class="wpdo-text-error">⚠️ <?php esc_html_e( '否 — orders 仍存於 wp_postmeta(建議啟用以加速)', '2meet-data-optimizer' ); ?></span>
&nbsp;<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced&section=features' ) ); ?>" class="button button-small"><?php esc_html_e( '前往設定', '2meet-data-optimizer' ); ?></a>
<?php endif; ?>
</td>
</tr>
<tr>
<th><?php esc_html_e( 'WPDO 註冊的 WC 表', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( 'WPDO 註冊的 WC 表', '2meet-data-optimizer' ); ?></th>
<td><?php echo (int) count( $tables ); ?> tables</td>
</tr>
</table>
<h2><?php esc_html_e( 'Vendor Commissionsmarketplace 訂單)', 'tmdo-woocommerce' ); ?></h2>
<h2><?php esc_html_e( 'Vendor Commissionsmarketplace 訂單)', '2meet-data-optimizer' ); ?></h2>
<?php if ( $totals['order_count'] > 0 ) : ?>
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;max-width:720px;margin:1rem 0;">
<div class="wpdo-grid-4col">
<div class="wpdo-card">
<div class="wpdo-card__num"><?php echo esc_html( number_format_i18n( $totals['order_count'] ) ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( '總訂單數', 'tmdo-woocommerce' ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( '總訂單數', '2meet-data-optimizer' ); ?></div>
</div>
<div class="wpdo-card">
<div class="wpdo-card__num">$<?php echo esc_html( number_format_i18n( $totals['total_subtotal'], 2 ) ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( '總交易額', 'tmdo-woocommerce' ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( '總交易額', '2meet-data-optimizer' ); ?></div>
</div>
<div class="wpdo-card">
<div class="wpdo-card__num">$<?php echo esc_html( number_format_i18n( $totals['total_commission'], 2 ) ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( '平台抽成', 'tmdo-woocommerce' ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( '平台抽成', '2meet-data-optimizer' ); ?></div>
</div>
<div class="wpdo-card">
<div class="wpdo-card__num">$<?php echo esc_html( number_format_i18n( $totals['total_payout'], 2 ) ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( 'Vendor 應得', 'tmdo-woocommerce' ); ?></div>
<div class="wpdo-card__lbl"><?php esc_html_e( 'Vendor 應得', '2meet-data-optimizer' ); ?></div>
</div>
</div>
<h3><?php esc_html_e( 'Top 10 Vendors', 'tmdo-woocommerce' ); ?></h3>
<h3><?php esc_html_e( 'Top 10 Vendors', '2meet-data-optimizer' ); ?></h3>
<table class="widefat striped">
<thead>
<tr>
<th><?php esc_html_e( 'Vendor', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( '訂單數', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( '交易額', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( '平台抽成', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( 'Vendor 應得', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( 'Vendor', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( '訂單數', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( '交易額', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( '平台抽成', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( 'Vendor 應得', '2meet-data-optimizer' ); ?></th>
</tr>
</thead>
<tbody>
@@ -141,16 +141,16 @@ final class TMDO_Admin_WC {
</tbody>
</table>
<?php else : ?>
<p style="opacity:.6;"><?php esc_html_e( '尚未有 marketplace 訂單。當客戶下訂並進入 processing/completed 狀態,commission 會自動寫入 wp_wpdo_wc_commissions。', 'tmdo-woocommerce' ); ?></p>
<p class="wpdo-opacity-60"><?php esc_html_e( '尚未有 marketplace 訂單。當客戶下訂並進入 processing/completed 狀態,commission 會自動寫入 wp_wpdo_wc_commissions。', '2meet-data-optimizer' ); ?></p>
<?php endif; ?>
<h2><?php esc_html_e( '已註冊的 WC 表', 'tmdo-woocommerce' ); ?></h2>
<h2><?php esc_html_e( '已註冊的 WC 表', '2meet-data-optimizer' ); ?></h2>
<table class="widefat striped">
<thead>
<tr>
<th><?php esc_html_e( '表名', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( '描述', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( '健康', 'tmdo-woocommerce' ); ?></th>
<th><?php esc_html_e( '表名', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( '描述', '2meet-data-optimizer' ); ?></th>
<th><?php esc_html_e( '健康', '2meet-data-optimizer' ); ?></th>
</tr>
</thead>
<tbody>