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:
@@ -13,6 +13,8 @@
|
|||||||
* License: GPL-2.0-or-later
|
* License: GPL-2.0-or-later
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
* Text Domain: tmdo-woocommerce
|
* Text Domain: tmdo-woocommerce
|
||||||
|
*
|
||||||
|
* TablePrefix: ^(wc_[a-z_0-9]+|wpdo_wc_[a-z_0-9]+)$
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
*
|
*
|
||||||
* @package TMDO_WOOCOMMERCE
|
* @package TMDO_WOOCOMMERCE
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* - WC tables registered (count + health)
|
* - WC tables registered (count + health)
|
||||||
* - Top vendors by commission (from wp_wpdo_wc_commissions)
|
* - Top vendors by commission (from wp_wpdo_wc_commissions)
|
||||||
*
|
*
|
||||||
* @package WP_Data_Optimizer
|
* @package TMDO
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ final class TMDO_Admin_WC {
|
|||||||
public static function register_menu(): void {
|
public static function register_menu(): void {
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
'tools.php',
|
'tools.php',
|
||||||
__( 'WPDO WooCommerce', 'tmdo-woocommerce' ),
|
__( 'WPDO WooCommerce', '2meet-data-optimizer' ),
|
||||||
__( 'WPDO WC', 'tmdo-woocommerce' ),
|
__( 'WPDO WC', '2meet-data-optimizer' ),
|
||||||
self::CAP,
|
self::CAP,
|
||||||
self::MENU_SLUG,
|
self::MENU_SLUG,
|
||||||
array( __CLASS__, 'render' )
|
array( __CLASS__, 'render' )
|
||||||
@@ -68,61 +68,61 @@ final class TMDO_Admin_WC {
|
|||||||
$totals = self::global_commission_totals();
|
$totals = self::global_commission_totals();
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<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>
|
<h2><?php esc_html_e( 'WC 環境', '2meet-data-optimizer' ); ?></h2>
|
||||||
<table class="widefat" style="max-width:520px;">
|
<table class="widefat wpdo-max-520">
|
||||||
<tr>
|
<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>
|
<td><?php echo esc_html( $wc_ver ); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php esc_html_e( 'HPOS 啟用', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( 'HPOS 啟用', '2meet-data-optimizer' ); ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php if ( $hpos ) : ?>
|
<?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 : ?>
|
<?php else : ?>
|
||||||
<span style="color:#c44;">⚠️ <?php esc_html_e( '否 — orders 仍存於 wp_postmeta(建議啟用以加速)', 'tmdo-woocommerce' ); ?></span>
|
<span class="wpdo-text-error">⚠️ <?php esc_html_e( '否 — orders 仍存於 wp_postmeta(建議啟用以加速)', '2meet-data-optimizer' ); ?></span>
|
||||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=features' ) ); ?>" class="button button-small"><?php esc_html_e( '前往設定', 'tmdo-woocommerce' ); ?></a>
|
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=features' ) ); ?>" class="button button-small"><?php esc_html_e( '前往設定', '2meet-data-optimizer' ); ?></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<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>
|
<td><?php echo (int) count( $tables ); ?> tables</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2><?php esc_html_e( 'Vendor Commissions(marketplace 訂單)', 'tmdo-woocommerce' ); ?></h2>
|
<h2><?php esc_html_e( 'Vendor Commissions(marketplace 訂單)', '2meet-data-optimizer' ); ?></h2>
|
||||||
<?php if ( $totals['order_count'] > 0 ) : ?>
|
<?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">
|
||||||
<div class="wpdo-card__num"><?php echo esc_html( number_format_i18n( $totals['order_count'] ) ); ?></div>
|
<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>
|
||||||
<div class="wpdo-card">
|
<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__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>
|
||||||
<div class="wpdo-card">
|
<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__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>
|
||||||
<div class="wpdo-card">
|
<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__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>
|
||||||
</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">
|
<table class="widefat striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php esc_html_e( 'Vendor', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( 'Vendor', '2meet-data-optimizer' ); ?></th>
|
||||||
<th><?php esc_html_e( '訂單數', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( '訂單數', '2meet-data-optimizer' ); ?></th>
|
||||||
<th><?php esc_html_e( '交易額', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( '交易額', '2meet-data-optimizer' ); ?></th>
|
||||||
<th><?php esc_html_e( '平台抽成', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( '平台抽成', '2meet-data-optimizer' ); ?></th>
|
||||||
<th><?php esc_html_e( 'Vendor 應得', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( 'Vendor 應得', '2meet-data-optimizer' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -141,16 +141,16 @@ final class TMDO_Admin_WC {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<?php else : ?>
|
<?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; ?>
|
<?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">
|
<table class="widefat striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php esc_html_e( '表名', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( '表名', '2meet-data-optimizer' ); ?></th>
|
||||||
<th><?php esc_html_e( '描述', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( '描述', '2meet-data-optimizer' ); ?></th>
|
||||||
<th><?php esc_html_e( '健康', 'tmdo-woocommerce' ); ?></th>
|
<th><?php esc_html_e( '健康', '2meet-data-optimizer' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* Reads from order via `wc_get_order()` — works for both HPOS and legacy.
|
* Reads from order via `wc_get_order()` — works for both HPOS and legacy.
|
||||||
*
|
*
|
||||||
* @package WP_Data_Optimizer
|
* @package TMDO
|
||||||
* @since 1.0.0 (legacy hpct_wc_orders write path)
|
* @since 1.0.0 (legacy hpct_wc_orders write path)
|
||||||
* @since 2.1.0 (wp_wpdo_wc_commissions custom table; HPOS-aware)
|
* @since 2.1.0 (wp_wpdo_wc_commissions custom table; HPOS-aware)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
// phpcs:ignore WPDO.AntiEAV -- platform integration with WooCommerce: term count cache transform
|
|
||||||
/**
|
/**
|
||||||
* TMDO_WC_Term_Count_Filter — Reroute WooCommerce term count cache from
|
* TMDO_WC_Term_Count_Filter — Reroute WooCommerce term count cache from
|
||||||
* wp_termmeta to wp_options (v2.12.3 Phase 3).
|
* wp_termmeta to wp_options (v2.12.3 Phase 3).
|
||||||
@@ -33,10 +32,12 @@
|
|||||||
* 🔒 Lessons applied (v2.11.7): added to TMDO_Hook_Bus_Bridge::COEXIST_WHITELIST
|
* 🔒 Lessons applied (v2.11.7): added to TMDO_Hook_Bus_Bridge::COEXIST_WHITELIST
|
||||||
* so `wp wpdo conflict-scan` does not report a false positive.
|
* so `wp wpdo conflict-scan` does not report a false positive.
|
||||||
*
|
*
|
||||||
* @package WP_Data_Optimizer
|
* @package TMDO
|
||||||
* @since 2.12.3
|
* @since 2.12.3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// phpcs:ignore WPDO.AntiEAV -- platform integration with WooCommerce: term count cache transform
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* This is "Tier 5" in ENTITY_ADAPTER_COOKBOOK.md: integrating with a plugin
|
* This is "Tier 5" in ENTITY_ADAPTER_COOKBOOK.md: integrating with a plugin
|
||||||
* that has its own anti-EAV solution.
|
* that has its own anti-EAV solution.
|
||||||
*
|
*
|
||||||
* @package WP_Data_Optimizer
|
* @package TMDO
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ final class TMDO_WooCommerce {
|
|||||||
<?php
|
<?php
|
||||||
printf(
|
printf(
|
||||||
/* translators: 1: legacy order count, 2: HPOS settings URL, 3: dismiss URL */
|
/* translators: 1: legacy order count, 2: HPOS settings URL, 3: dismiss URL */
|
||||||
esc_html__( '偵測到 %1$d 筆 legacy shop_order(postmeta-based)。建議啟用 WooCommerce High Performance Order Storage (HPOS) 加速 order 查詢。前往 %2$s 啟用,或 %3$s 永久隱藏此通知。', 'tmdo-woocommerce' ),
|
esc_html__( '偵測到 %1$d 筆 legacy shop_order(postmeta-based)。建議啟用 WooCommerce High Performance Order Storage (HPOS) 加速 order 查詢。前往 %2$s 啟用,或 %3$s 永久隱藏此通知。', '2meet-data-optimizer' ),
|
||||||
(int) $legacy_count,
|
(int) $legacy_count,
|
||||||
'<a href="' . esc_url( $settings_url ) . '">WooCommerce → 進階 → 功能</a>',
|
'<a href="' . esc_url( $settings_url ) . '">WooCommerce → 進階 → 功能</a>',
|
||||||
'<a href="' . esc_url( $dismiss_url ) . '">關閉</a>'
|
'<a href="' . esc_url( $dismiss_url ) . '">關閉</a>'
|
||||||
|
|||||||
Reference in New Issue
Block a user