From 28e4e19a3c1004150cd58bcdc6cda1f17040ec06 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 12 Jul 2026 11:46:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85/=E5=BD=92=E6=A1=A3=E5=A3=B3=E5=B1=82=201:1=20?= =?UTF-8?q?=E5=90=8C=E5=AE=B6=E6=97=8F=E5=8D=A1=E7=89=87=E4=B8=8E=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 商品详情接入 content-wrap 主站详情壳;相关推荐与分类/标签/用户主页商品统一 product-card;卖家入口对齐用户主页 product tab。 Co-Authored-By: Claude Fable 5 --- assets/css/routes/product.css | 26 ++++++++ templates/pages/page-product.php | 81 +++++++++++++++-------- templates/parts/shop/product-card.php | 59 +++++++++++++++++ templates/parts/user-home/panels-core.php | 31 ++------- templates/shop/product-cat.php | 34 ++-------- templates/shop/product-tag.php | 34 ++-------- 6 files changed, 152 insertions(+), 113 deletions(-) create mode 100644 templates/parts/shop/product-card.php diff --git a/assets/css/routes/product.css b/assets/css/routes/product.css index aa8bb520..beeedf78 100644 --- a/assets/css/routes/product.css +++ b/assets/css/routes/product.css @@ -463,3 +463,29 @@ html.dark .aksrt-product-page__content img { font-size: 13px; color: var(--color-ink-3); } + + +/* Product detail shell — align with single content stream */ +.content-shell--product .content-wrap { + padding-top: 8px; +} +.content-shell--product .aksrt-product-page { + width: 100%; +} +.aksrt-product-page__related { + margin-top: 28px; + padding-top: 8px; +} +.aksrt-product-page__related-title { + margin: 0 0 14px; + font-size: 18px; + font-weight: 700; + color: var(--color-ink, #1f2937); +} +.aksrt-product-page__related-grid.aksrt-product-archive__grid { + margin: 0; +} +.aksrt-product-page__merchant-link { + display: inline-block; + margin-top: 4px; +} diff --git a/templates/pages/page-product.php b/templates/pages/page-product.php index 745b2676..dd23a299 100644 --- a/templates/pages/page-product.php +++ b/templates/pages/page-product.php @@ -37,12 +37,15 @@ $author_id = (int) get_post_field('post_author', $product_id); $author = $author_id > 0 ? get_userdata($author_id) : null; ?> -
+
+
+
+
0 ? get_userdata($author_id) : null;
- +
display_name); ?> - +
@@ -312,33 +319,44 @@ $author = $author_id > 0 ? get_userdata($author_id) : null; 'aksrt_product', - 'posts_per_page' => 6, - 'post_status' => 'publish', - 'post__not_in' => [$product_id], - 'tax_query' => !empty($product['categories']) ? [[ - 'taxonomy' => 'aksrt_product_cat', - 'field' => 'term_id', - 'terms' => wp_list_pluck($product['categories'], 'term_id'), - ]] : [], - 'orderby' => 'rand', - ]); + $related_items = []; + if ($shop && method_exists($shop, 'build_product_card_view')) { + $related_q = new WP_Query([ + 'post_type' => 'aksrt_product', + 'posts_per_page' => 6, + 'post_status' => 'publish', + 'post__not_in' => [$product_id], + 'ignore_sticky_posts' => true, + 'no_found_rows' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'tax_query' => !empty($product['categories']) ? [[ + 'taxonomy' => 'aksrt_product_cat', + 'field' => 'term_id', + 'terms' => wp_list_pluck($product['categories'], 'term_id'), + ]] : [], + 'orderby' => 'rand', + ]); + while ($related_q->have_posts()) { + $related_q->the_post(); + $card = $shop->build_product_card_view((int) get_the_ID()); + if (!empty($card['id'])) { + $related_items[] = $card; + } + } + wp_reset_postdata(); + } ?> - have_posts()) : ?> + @@ -397,6 +415,11 @@ $author = $author_id > 0 ? get_userdata($author_id) : null;
+
+
+ + +