Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/sidebar-orders.php
T
kate522 815e83bac0 fix(user-center): complete certification and order flows
Fix modal scroll ownership and certification modal styling, store evidence as Media Library attachments, reconcile missed provider callbacks, validate currencies, and complete digital fulfillment only after durable entitlement delivery.
2026-07-29 10:29:59 +08:00

84 lines
2.7 KiB
PHP

<?php
/**
* User center sidebar: task-oriented order shortcuts.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$orders_base_url = (string) ($orders_url ?? '');
if ($orders_base_url === '') {
return;
}
$order_user_id = (int) ($user_id ?? 0);
$order_stats = class_exists('\AKSRT\Payment\Order')
? \AKSRT\Payment\Order::get_instance()->get_stats($order_user_id)
: [];
$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'),
'icon' => 'wallet',
'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',
'tab' => 'after',
'count' => (int) ($order_stats['refunding'] ?? 0),
],
];
?>
<div class="uc-sidebar__section uc-order-card">
<div class="uc-sidebar__heading">
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
<a href="<?php echo esc_url($orders_base_url); ?>">
<?php esc_html_e('全部', 'aksrt'); ?><i class="fas fa-angle-right" aria-hidden="true"></i>
</a>
</div>
<div class="uc-order-grid">
<?php foreach ($order_items as $item) :
$item_url = add_query_arg('order_tab', $item['tab'], $orders_base_url);
?>
<a class="uc-order-grid__item" href="<?php echo esc_url($item_url); ?>">
<span class="uc-order-grid__icon">
<i class="fas fa-<?php echo esc_attr((string) $item['icon']); ?>" aria-hidden="true"></i>
<?php if ($item['count'] > 0) : ?>
<small><?php echo esc_html($item['count'] > 99 ? '99+' : (string) $item['count']); ?></small>
<?php endif; ?>
</span>
<span><?php echo esc_html((string) $item['label']); ?></span>
</a>
<?php endforeach; ?>
</div>
</div>