feat: remove shop feature (Phase 2)
Delete all shop domain classes, controllers, schema builders, templates, JS/CSS, admin SPA pages, and shop-only payment classes (Shipping, AfterSale, Discount). Remove shop-only DB table definitions (product_variant, after_sale, order_shipping, card_key) from migrator and add their DROP to uninstall.php. Clean up shared files: - Remove aksrt_product CPT + taxonomies from Setup.php - Remove shop rewrite rules/query vars/template redirect from SetupPart2.php - Remove shop widget areas from SetupPart1.php - Remove shop enqueues from ScriptsPart1b.php - Remove sepakerator-aksrt-shop from SetupPart2.php - Remove get_shop_settings facade (delete ForumShop.php, clean DomainGroups.php) - Remove ORDER_PRODUCT_SHOP constant from DomainModel.php - Remove Shop::class fallback branches from UserOrders.php, OrderCenterRest.php - Remove shipping/after-sale branches from OrderRepositoryAdmin.php, PayMenus.php, PayOrders.php - Remove shop product widgets from widgets-register.php - Remove cart page from template-registry.php, routing.php, ScriptsPart2.php - Remove cart UI from sidebar-nav.php, profile-orders.php, sidebar-orders.php - Clean up order-center.js (remove rebuy/cartUrl/receipt/after-sale handlers) - Remove aksrt_get_cart_page_url/product_page/product_edit from transactions.php - Clean up aksrt_product_cat references in Coupon.php, PayCoupons.php Shared payment/order/credits/content-pay stack fully retained.
This commit is contained in:
1 parent
2bbd7c01a3
commit
1d2505356e
103 files changed
+46
-21267
No files matched your search
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Commerce center (cart / orders / revenue) presentation helpers.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_get_commerce_nav_items')) {
|
||||
/**
|
||||
* Secondary nav for commerce center pages.
|
||||
*
|
||||
* @return array<int, array{key:string,label:string,url:string}>
|
||||
*/
|
||||
function aksrt_get_commerce_nav_items(): array {
|
||||
$items = [];
|
||||
|
||||
$cart = function_exists('aksrt_get_cart_page_url') ? aksrt_get_cart_page_url() : '';
|
||||
if ($cart !== '') {
|
||||
$items[] = [
|
||||
'key' => 'cart',
|
||||
'label' => __('购物车', 'aksrt'),
|
||||
'url' => $cart,
|
||||
];
|
||||
}
|
||||
|
||||
$orders = function_exists('aksrt_get_orders_page_url') ? aksrt_get_orders_page_url() : '';
|
||||
if ($orders !== '') {
|
||||
$items[] = [
|
||||
'key' => 'orders',
|
||||
'label' => __('我的订单', 'aksrt'),
|
||||
'url' => $orders,
|
||||
];
|
||||
}
|
||||
|
||||
$revenue = function_exists('aksrt_get_revenue_page_url') ? aksrt_get_revenue_page_url() : '';
|
||||
if ($revenue !== '') {
|
||||
$items[] = [
|
||||
'key' => 'revenue',
|
||||
'label' => __('创作收益', 'aksrt'),
|
||||
'url' => $revenue,
|
||||
];
|
||||
}
|
||||
|
||||
$center = function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url() : '';
|
||||
if ($center !== '') {
|
||||
$items[] = [
|
||||
'key' => 'center',
|
||||
'label' => __('个人中心', 'aksrt'),
|
||||
'url' => $center,
|
||||
];
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_render_commerce_page_header')) {
|
||||
/**
|
||||
* Shared commerce page header: title / intro / secondary nav.
|
||||
*
|
||||
* @param array{title?:string,subtitle?:string,active?:string} $args
|
||||
*/
|
||||
function aksrt_render_commerce_page_header(array $args = []): void {
|
||||
$title = (string) ($args['title'] ?? '');
|
||||
$subtitle = (string) ($args['subtitle'] ?? '');
|
||||
$active = sanitize_key((string) ($args['active'] ?? ''));
|
||||
$nav = aksrt_get_commerce_nav_items();
|
||||
?>
|
||||
<header class="aksrt-commerce-header">
|
||||
<?php if ($title !== '') : ?>
|
||||
<h1 class="aksrt-commerce-header__title"><?php echo esc_html($title); ?></h1>
|
||||
<?php endif; ?>
|
||||
<?php if ($subtitle !== '') : ?>
|
||||
<p class="aksrt-commerce-header__subtitle"><?php echo esc_html($subtitle); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($nav)) : ?>
|
||||
<nav class="aksrt-commerce-header__nav" aria-label="<?php esc_attr_e('交易中心导航', 'aksrt'); ?>">
|
||||
<?php foreach ($nav as $item) :
|
||||
$is_active = $active !== '' && $active === ($item['key'] ?? '');
|
||||
?>
|
||||
<a
|
||||
class="aksrt-commerce-header__nav-item<?php echo $is_active ? ' is-active' : ''; ?>"
|
||||
href="<?php echo esc_url((string) ($item['url'] ?? '#')); ?>"
|
||||
<?php echo $is_active ? ' aria-current="page"' : ''; ?>
|
||||
>
|
||||
<?php echo esc_html((string) ($item['label'] ?? '')); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -17,41 +17,6 @@ function aksrt_get_order_status_labels(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
function aksrt_get_product_page_view(int $product_id): array {
|
||||
if ($product_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_product_detail_view($product_id);
|
||||
}
|
||||
|
||||
function aksrt_get_product_edit_page_view(int $user_id, int $product_id = 0): array {
|
||||
if ($user_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
|
||||
return [
|
||||
'allowed' => false,
|
||||
'is_edit' => false,
|
||||
'product' => [],
|
||||
];
|
||||
}
|
||||
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_product_edit_view($user_id, $product_id);
|
||||
}
|
||||
|
||||
function aksrt_get_cart_page_view(int $user_id): array {
|
||||
if ($user_id <= 0 || !class_exists('\AKSRT\Shop\Shop')) {
|
||||
return [
|
||||
'payment_methods' => [],
|
||||
'shipping_methods' => [],
|
||||
'address_book' => [],
|
||||
'coupon_enabled' => false,
|
||||
'currency_symbol' => '¥',
|
||||
'pending_orders' => [],
|
||||
];
|
||||
}
|
||||
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_cart_page_view($user_id);
|
||||
}
|
||||
|
||||
function aksrt_get_orders_page_view(int $user_id, int $paged = 1, int $per_page = 20, string $status = '', string $product_type = ''): array {
|
||||
$empty = [
|
||||
'items' => [],
|
||||
@@ -79,10 +44,6 @@ function aksrt_get_orders_page_view(int $user_id, int $paged = 1, int $per_page
|
||||
return \AKSRT\Payment\UserOrders::get_instance()->get_order_center_view($user_id, $args);
|
||||
}
|
||||
|
||||
if (class_exists('\AKSRT\Shop\Shop')) {
|
||||
return \AKSRT\Shop\Shop::get_instance()->get_order_center_view($user_id, $args);
|
||||
}
|
||||
|
||||
return $empty;
|
||||
}
|
||||
|
||||
@@ -135,4 +96,4 @@ function aksrt_get_revenue_page_view(int $user_id): array {
|
||||
'total_withdrawn' => $total_withdrawn,
|
||||
'records' => $records,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ $section = sanitize_key((string) ($_GET['section'] ?? ''));
|
||||
if ($tab === '' && isset($_GET['tab']) && sanitize_key((string) $_GET['tab']) !== 'orders') {
|
||||
// When rendered as standalone legacy include, outer tab may be status.
|
||||
$maybe = sanitize_key((string) $_GET['tab']);
|
||||
if (in_array($maybe, ['pending', 'to-ship', 'shipped', 'received', 'review', 'after'], true)) {
|
||||
if (in_array($maybe, ['pending', 'after'], true)) {
|
||||
$tab = $maybe;
|
||||
}
|
||||
}
|
||||
@@ -37,9 +37,6 @@ if (isset($tab_aliases[$tab])) {
|
||||
|
||||
$tab_status_map = [
|
||||
'pending' => \AKSRT\Payment\Order::STATUS_PENDING,
|
||||
'to-ship' => \AKSRT\Payment\Order::STATUS_PAID,
|
||||
'shipped' => \AKSRT\Payment\Order::STATUS_DELIVERED,
|
||||
'review' => \AKSRT\Payment\Order::STATUS_PENDING_REVIEW,
|
||||
'after' => \AKSRT\Payment\Order::STATUS_REFUNDING,
|
||||
];
|
||||
if ($tab !== '' && isset($tab_status_map[$tab])) {
|
||||
@@ -58,15 +55,10 @@ if ($type_options === [] && class_exists('\AKSRT\Core\DomainModel')) {
|
||||
$type_options = array_merge(['' => __('全部类型', 'aksrt')], \AKSRT\Core\DomainModel::order_product_type_labels());
|
||||
}
|
||||
|
||||
$shop = class_exists('\AKSRT\Shop\Shop') ? \AKSRT\Shop\Shop::get_instance() : null;
|
||||
|
||||
$tabs = [
|
||||
'' => __('全部', 'aksrt'),
|
||||
'pending' => __('待支付', 'aksrt'),
|
||||
'to-ship' => __('待发货', 'aksrt'),
|
||||
'shipped' => __('待收货', 'aksrt'),
|
||||
'review' => __('待评价', 'aksrt'),
|
||||
'after' => __('售后', 'aksrt'),
|
||||
'after' => __('退款中', 'aksrt'),
|
||||
];
|
||||
|
||||
$base_query = ['tab' => 'orders'];
|
||||
@@ -115,16 +107,8 @@ $pending_count = (int) ($stats['pending'] ?? 0);
|
||||
<i class="fas fa-receipt uc-orders-panel__title-icon" aria-hidden="true"></i>
|
||||
<?php esc_html_e('我的订单', 'aksrt'); ?>
|
||||
</div>
|
||||
<div class="muted-2-color em09 mt3"><?php esc_html_e('查看商城、付费内容、会员与充值等全部订单。', 'aksrt'); ?></div>
|
||||
<div class="muted-2-color em09 mt3"><?php esc_html_e('查看付费内容、会员与充值等全部订单。', 'aksrt'); ?></div>
|
||||
</div>
|
||||
<?php if (function_exists('aksrt_get_cart_page_url') && aksrt_get_cart_page_url() !== '') : ?>
|
||||
<a class="uc-orders-panel__cart-link" href="<?php echo esc_url(aksrt_get_cart_page_url()); ?>">
|
||||
<i class="fas fa-shopping-cart" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('购物车', 'aksrt'); ?></span>
|
||||
<i class="fa fa-angle-right em12" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($stats)) : ?>
|
||||
<div class="aksrt-orders-page__stats" data-aksrt-order-stats>
|
||||
@@ -145,9 +129,7 @@ $pending_count = (int) ($stats['pending'] ?? 0);
|
||||
|
||||
<div class="aksrt-orders-page__extra-nav" data-aksrt-orders-extra-nav>
|
||||
<a href="<?php echo esc_url($orders_url(['section' => null])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === '' ? ' is-active' : ''; ?>"><?php esc_html_e('订单列表', 'aksrt'); ?></a>
|
||||
<a href="<?php echo esc_url($orders_url(['section' => 'after-sale'])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === 'after-sale' ? ' is-active' : ''; ?>"><?php esc_html_e('售后工单', 'aksrt'); ?></a>
|
||||
<a href="<?php echo esc_url($orders_url(['section' => 'coupons'])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === 'coupons' ? ' is-active' : ''; ?>"><?php esc_html_e('优惠券', 'aksrt'); ?></a>
|
||||
<a href="<?php echo esc_url($orders_url(['section' => 'favorites'])); ?>" class="aksrt-orders-page__extra-link<?php echo $section === 'favorites' ? ' is-active' : ''; ?>"><?php esc_html_e('收藏', 'aksrt'); ?></a>
|
||||
</div>
|
||||
|
||||
<?php if ($type_options && $section === '') : ?>
|
||||
@@ -304,23 +286,11 @@ $pending_count = (int) ($stats['pending'] ?? 0);
|
||||
<?php if (!empty($actions['can_pay'])) : ?>
|
||||
<button type="button" class="btn-primary btn-sm" data-aksrt-order-pay="<?php echo esc_attr($on); ?>" data-aksrt-order-method="<?php echo esc_attr((string) ($order['payment_method']['value'] ?? '')); ?>"><?php esc_html_e('去支付', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($actions['can_receipt'])) : ?>
|
||||
<button type="button" class="btn-primary btn-sm" data-aksrt-order-receipt="<?php echo esc_attr($on); ?>"><?php esc_html_e('确认收货', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($actions['can_review']) || (class_exists('\AKSRT\Payment\Order') && $os === \AKSRT\Payment\Order::STATUS_PENDING_REVIEW)) : ?>
|
||||
<button type="button" class="btn-primary btn-sm c-green" data-aksrt-order-review="<?php echo esc_attr($on); ?>"><?php esc_html_e('评价', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($actions['can_rebuy'])) : ?>
|
||||
<button type="button" class="btn-outline btn-sm" data-aksrt-order-rebuy="<?php echo esc_attr($on); ?>"><?php esc_html_e('再次购买', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($actions['can_after_sale'])) : ?>
|
||||
<button type="button" class="btn-outline btn-sm" data-aksrt-order-after-sale="<?php echo esc_attr($on); ?>"><?php esc_html_e('售后', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($actions['can_view_product']) && !empty($order['permalink'])) : ?>
|
||||
<a class="btn-ghost btn-sm" href="<?php echo esc_url((string) $order['permalink']); ?>"><?php
|
||||
echo (class_exists('\AKSRT\Core\DomainModel') && $ptype === \AKSRT\Core\DomainModel::ORDER_PRODUCT_RESOURCE)
|
||||
? esc_html__('去内容', 'aksrt')
|
||||
: esc_html__('商品页', 'aksrt');
|
||||
: esc_html__('查看', 'aksrt');
|
||||
?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -348,7 +318,7 @@ $pending_count = (int) ($stats['pending'] ?? 0);
|
||||
<div class="aksrt-orders-page__empty">
|
||||
<i class="fas fa-receipt" aria-hidden="true"></i>
|
||||
<p><?php esc_html_e('暂无订单记录', 'aksrt'); ?></p>
|
||||
<p class="aksrt-orders-page__empty-hint muted-2-color em09"><?php esc_html_e('去逛逛商城或开通会员,订单会出现在这里。', 'aksrt'); ?></p>
|
||||
<p class="aksrt-orders-page__empty-hint muted-2-color em09"><?php esc_html_e('开通会员或购买付费内容,订单会出现在这里。', 'aksrt'); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -367,114 +337,6 @@ $pending_count = (int) ($stats['pending'] ?? 0);
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- After-sale modal -->
|
||||
<div class="aksrt-modal" data-aksrt-aftersale-modal hidden>
|
||||
<div class="aksrt-modal__overlay"></div>
|
||||
<div class="aksrt-modal__dialog">
|
||||
<div class="aksrt-modal__header">
|
||||
<h3><?php esc_html_e('申请售后', 'aksrt'); ?></h3>
|
||||
<button type="button" class="aksrt-modal__close" data-aksrt-aftersale-modal-close>×</button>
|
||||
</div>
|
||||
<form class="aksrt-modal__body" data-aksrt-aftersale-form>
|
||||
<input type="hidden" name="order_number" value="">
|
||||
<div class="aksrt-orders-page__field">
|
||||
<label><?php esc_html_e('售后类型', 'aksrt'); ?></label>
|
||||
<select name="type" class="aksrt-orders-page__select">
|
||||
<?php if (class_exists('\AKSRT\Payment\AfterSale')) : ?>
|
||||
<?php foreach (\AKSRT\Payment\AfterSale::get_valid_types() as $type_key => $type_label) : ?>
|
||||
<option value="<?php echo esc_attr($type_key); ?>"><?php echo esc_html($type_label); ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="aksrt-orders-page__field">
|
||||
<label><?php esc_html_e('售后原因', 'aksrt'); ?> *</label>
|
||||
<textarea name="reason" class="aksrt-orders-page__textarea" rows="4" required placeholder="<?php esc_attr_e('请描述问题', 'aksrt'); ?>"></textarea>
|
||||
</div>
|
||||
<div class="aksrt-modal__footer">
|
||||
<button type="button" class="btn-ghost" data-aksrt-aftersale-modal-close><?php esc_html_e('取消', 'aksrt'); ?></button>
|
||||
<button type="submit" class="btn-primary"><?php esc_html_e('提交', 'aksrt'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Return shipping modal -->
|
||||
<div class="aksrt-modal" data-aksrt-return-ship-modal hidden>
|
||||
<div class="aksrt-modal__overlay"></div>
|
||||
<div class="aksrt-modal__dialog">
|
||||
<div class="aksrt-modal__header">
|
||||
<h3><?php esc_html_e('填写退货物流', 'aksrt'); ?></h3>
|
||||
<button type="button" class="aksrt-modal__close" data-aksrt-return-ship-close>×</button>
|
||||
</div>
|
||||
<form class="aksrt-modal__body" data-aksrt-return-ship-form>
|
||||
<input type="hidden" name="ticket_id" value="">
|
||||
<div class="aksrt-orders-page__field">
|
||||
<label><?php esc_html_e('快递公司', 'aksrt'); ?> *</label>
|
||||
<input type="text" name="carrier" class="aksrt-orders-page__input" required placeholder="<?php esc_attr_e('如:顺丰速运', 'aksrt'); ?>">
|
||||
</div>
|
||||
<div class="aksrt-orders-page__field">
|
||||
<label><?php esc_html_e('运单号', 'aksrt'); ?> *</label>
|
||||
<input type="text" name="tracking_no" class="aksrt-orders-page__input" required placeholder="<?php esc_attr_e('快递单号', 'aksrt'); ?>">
|
||||
</div>
|
||||
<div class="aksrt-modal__footer">
|
||||
<button type="button" class="btn-ghost" data-aksrt-return-ship-close><?php esc_html_e('取消', 'aksrt'); ?></button>
|
||||
<button type="submit" class="btn-primary"><?php esc_html_e('提交物流', 'aksrt'); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($section === 'after-sale' && class_exists('\AKSRT\Payment\AfterSale')) :
|
||||
$tickets = \AKSRT\Payment\AfterSale::get_instance()->get_user_tickets($user_id, 50);
|
||||
?>
|
||||
<section class="aksrt-orders-page__aftersale" data-aksrt-aftersale-list>
|
||||
<h2><?php esc_html_e('我的售后', 'aksrt'); ?></h2>
|
||||
<?php if (!empty($tickets)) : ?>
|
||||
<div class="aksrt-as-list">
|
||||
<?php foreach ($tickets as $t) :
|
||||
$tid = (int) ($t['id'] ?? 0);
|
||||
$events = is_array($t['events'] ?? null) ? $t['events'] : [];
|
||||
$actions_t = is_array($t['actions'] ?? null) ? $t['actions'] : [];
|
||||
?>
|
||||
<article class="aksrt-as-card" data-aksrt-as-ticket="<?php echo esc_attr((string) $tid); ?>">
|
||||
<div class="aksrt-as-card__head">
|
||||
<strong>#<?php echo esc_html((string) $tid); ?></strong>
|
||||
<span class="aksrt-as-card__order"><?php echo esc_html((string) ($t['order_number'] ?? '')); ?></span>
|
||||
<span class="aksrt-as-card__status"><?php echo esc_html((string) ($t['status_label'] ?? $t['status'] ?? '')); ?></span>
|
||||
</div>
|
||||
<div class="aksrt-as-card__meta muted-2-color">
|
||||
<?php echo esc_html((string) ($t['type_label'] ?? $t['type'] ?? '')); ?>
|
||||
· <?php echo esc_html((string) ($t['created_at'] ?? '')); ?>
|
||||
</div>
|
||||
<div class="aksrt-as-card__reason"><?php echo esc_html((string) ($t['reason'] ?? '')); ?></div>
|
||||
<?php if ($events) : ?>
|
||||
<ol class="aksrt-as-timeline">
|
||||
<?php foreach (array_reverse($events) as $ev) : ?>
|
||||
<li>
|
||||
<time><?php echo esc_html((string) ($ev['time'] ?? '')); ?></time>
|
||||
<span><?php echo esc_html((string) ($ev['label'] ?? '')); ?></span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
<div class="aksrt-as-card__actions">
|
||||
<?php if (!empty($actions_t['can_return_ship'])) : ?>
|
||||
<button type="button" class="btn-primary btn-sm" data-aksrt-return-ship="<?php echo esc_attr((string) $tid); ?>"><?php esc_html_e('填写退货物流', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($actions_t['can_cancel'])) : ?>
|
||||
<button type="button" class="btn-ghost btn-sm" data-aksrt-as-cancel="<?php echo esc_attr((string) $tid); ?>"><?php esc_html_e('取消售后', 'aksrt'); ?></button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<p class="muted-2-color"><?php esc_html_e('暂无售后记录', 'aksrt'); ?></p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($section === 'coupons') : ?>
|
||||
<section class="aksrt-orders-page__coupons" data-aksrt-coupon-wallet>
|
||||
<h2><?php esc_html_e('优惠券', 'aksrt'); ?></h2>
|
||||
@@ -483,27 +345,4 @@ $pending_count = (int) ($stats['pending'] ?? 0);
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($section === 'favorites' && $shop) :
|
||||
$fav_data = $shop->get_user_favorites($user_id);
|
||||
?>
|
||||
<section class="aksrt-orders-page__favorites">
|
||||
<h2><?php esc_html_e('收藏商品', 'aksrt'); ?></h2>
|
||||
<?php if (!empty($fav_data['items'])) : ?>
|
||||
<div class="aksrt-orders-page__fav-grid">
|
||||
<?php foreach ($fav_data['items'] as $fav) : ?>
|
||||
<a href="<?php echo esc_url((string) ($fav['permalink'] ?? '#')); ?>" class="aksrt-orders-page__fav-card">
|
||||
<?php if (!empty($fav['image'])) : ?>
|
||||
<img src="<?php echo esc_url((string) $fav['image']); ?>" alt="" loading="lazy">
|
||||
<?php endif; ?>
|
||||
<h3><?php echo esc_html((string) ($fav['title'] ?? '')); ?></h3>
|
||||
<strong>¥<?php echo esc_html(number_format((float) ($fav['price'] ?? 0), 2)); ?></strong>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<p><?php esc_html_e('暂无收藏商品', 'aksrt'); ?></p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -7,19 +7,12 @@
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$cart_url = function_exists('aksrt_get_cart_page_url') ? aksrt_get_cart_page_url() : '';
|
||||
$level_url = isset($dashboard_tabs['level'])
|
||||
? aksrt_get_user_center_tab_url('level')
|
||||
: '';
|
||||
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
||||
|
||||
$services = array_values(array_filter([
|
||||
[
|
||||
'label' => __('购物车', 'aksrt'),
|
||||
'icon' => 'shopping-cart',
|
||||
'tone' => 'cart',
|
||||
'url' => $cart_url,
|
||||
],
|
||||
[
|
||||
'label' => __('我的等级', 'aksrt'),
|
||||
'icon' => 'chart-line',
|
||||
|
||||
@@ -19,12 +19,6 @@ $order_stats = class_exists('\AKSRT\Payment\Order')
|
||||
$order_repo = class_exists('\AKSRT\Payment\OrderRepository')
|
||||
? \AKSRT\Payment\OrderRepository::get_instance()
|
||||
: null;
|
||||
$shop_type = class_exists('\AKSRT\Core\DomainModel')
|
||||
? \AKSRT\Core\DomainModel::ORDER_PRODUCT_SHOP
|
||||
: 'shop_product';
|
||||
$shop_paid = $order_repo ? $order_repo->count_user_orders($order_user_id, ['status' => \AKSRT\Payment\Order::STATUS_PAID, 'product_type' => $shop_type]) : 0;
|
||||
$shop_delivered = $order_repo ? $order_repo->count_user_orders($order_user_id, ['status' => \AKSRT\Payment\Order::STATUS_DELIVERED, 'product_type' => $shop_type]) : 0;
|
||||
$shop_review = $order_repo ? $order_repo->count_user_orders($order_user_id, ['status' => \AKSRT\Payment\Order::STATUS_PENDING_REVIEW, 'product_type' => $shop_type]) : 0;
|
||||
$order_items = [
|
||||
[
|
||||
'label' => __('待支付', 'aksrt'),
|
||||
@@ -32,24 +26,6 @@ $order_items = [
|
||||
'tab' => 'pending',
|
||||
'count' => (int) ($order_stats['pending'] ?? 0),
|
||||
],
|
||||
[
|
||||
'label' => __('待发货', 'aksrt'),
|
||||
'icon' => 'gift',
|
||||
'tab' => 'to-ship',
|
||||
'count' => $shop_paid,
|
||||
],
|
||||
[
|
||||
'label' => __('待收货', 'aksrt'),
|
||||
'icon' => 'truck',
|
||||
'tab' => 'shipped',
|
||||
'count' => $shop_delivered,
|
||||
],
|
||||
[
|
||||
'label' => __('待评价', 'aksrt'),
|
||||
'icon' => 'comment-dots',
|
||||
'tab' => 'review',
|
||||
'count' => $shop_review,
|
||||
],
|
||||
[
|
||||
'label' => __('售后', 'aksrt'),
|
||||
'icon' => 'undo-alt',
|
||||
|
||||
@@ -113,12 +113,6 @@ $_aksrt_special_templates = [
|
||||
'title' => '我的订单',
|
||||
'fallback' => '/orders/',
|
||||
],
|
||||
'cart' => [
|
||||
'file' => 'templates/pages/page-cart.php',
|
||||
'slug' => 'cart',
|
||||
'title' => '购物车',
|
||||
'fallback' => '/cart/',
|
||||
],
|
||||
'revenue' => [
|
||||
'file' => 'templates/pages/page-revenue.php',
|
||||
'slug' => 'revenue',
|
||||
@@ -413,11 +407,6 @@ function aksrt_get_current_special_template_path(): string {
|
||||
return $orders_template ?: '';
|
||||
}
|
||||
|
||||
if (get_query_var('aksrt_cart')) {
|
||||
$cart_template = aksrt_locate_template_file('templates/pages/page-cart.php');
|
||||
return $cart_template ?: '';
|
||||
}
|
||||
|
||||
if (get_query_var('aksrt_revenue')) {
|
||||
$revenue_template = aksrt_locate_template_file('templates/pages/page-revenue.php');
|
||||
return $revenue_template ?: '';
|
||||
|
||||
@@ -92,12 +92,7 @@ function aksrt_register_widgets() {
|
||||
register_widget('\AKSRT\Widgets\WidgetIconCoverCards');
|
||||
register_widget('\AKSRT\Widgets\WidgetBookmarkLinks');
|
||||
|
||||
// Shop product widgets (§6.9)
|
||||
register_widget('\AKSRT\Widgets\WidgetProductList');
|
||||
register_widget('\AKSRT\Widgets\WidgetProductOneline');
|
||||
register_widget('\AKSRT\Widgets\WidgetProductTab');
|
||||
|
||||
aksrt_maybe_repair_sidebar_blog_widgets();
|
||||
aksrt_maybe_repair_sidebar_blog_widgets();
|
||||
}
|
||||
add_action('widgets_init', 'aksrt_register_widgets');
|
||||
|
||||
|
||||
Reference in new issue
Block a user