This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Esun_LegacyOrder::css/legacy-orders.css"/>
</head>
<body>
<referenceBlock name="customer_account_navigation">
<block class="Esun\LegacyOrder\Block\Account\NavigationLink"
name="customer-account-navigation-legacy-orders">
<arguments>
<argument name="path" xsi:type="string">legacy_order/account/index</argument>
<argument name="label" xsi:type="string" translate="true">Historical Orders</argument>
<argument name="sortOrder" xsi:type="number">225</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
<referenceContainer name="content">
<block class="Esun\LegacyOrder\Block\Account\History"
name="legacy.order.history"
template="Esun_LegacyOrder::account/history.phtml"
cacheable="false"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
<referenceContainer name="content">
<block class="Esun\LegacyOrder\Block\Account\OrderView"
name="legacy.order.view"
template="Esun_LegacyOrder::account/view.phtml"
cacheable="false"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,44 @@
<?php
/** @var \Esun\LegacyOrder\Block\Account\History $block */
/** @var \Magento\Framework\Escaper $escaper */
$orders = $block->getOrders();
?>
<div class="legacy-orders">
<div class="message info legacy-orders__notice">
<span><?= $escaper->escapeHtml(__('This order is from the old website and is for historical reference only.')) ?></span>
</div>
<?php if (!$orders->getSize()): ?>
<div class="message info empty">
<span><?= $escaper->escapeHtml(__('No historical orders were found.')) ?></span>
</div>
<?php else: ?>
<div class="table-wrapper orders-history">
<table class="data table table-order-items history">
<caption class="table-caption"><?= $escaper->escapeHtml(__('Historical Orders')) ?></caption>
<thead>
<tr>
<th scope="col" class="col id"><?= $escaper->escapeHtml(__('Order #')) ?></th>
<th scope="col" class="col date"><?= $escaper->escapeHtml(__('Date')) ?></th>
<th scope="col" class="col status"><?= $escaper->escapeHtml(__('Status')) ?></th>
<th scope="col" class="col total"><?= $escaper->escapeHtml(__('Order Total')) ?></th>
<th scope="col" class="col actions"><?= $escaper->escapeHtml(__('Action')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($orders as $order): ?>
<tr>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Order #')) ?>" class="col id"><?= $escaper->escapeHtml($order->getData('source_order_number')) ?></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Date')) ?>" class="col date"><?= $escaper->escapeHtml($order->getData('ordered_at') ?: '-') ?></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Status')) ?>" class="col status"><?= $escaper->escapeHtml($order->getData('order_status') ?: '-') ?></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Order Total')) ?>" class="col total"><?= $escaper->escapeHtml(trim((string)$order->getData('currency') . ' ' . number_format((float)$order->getData('grand_total'), 2, '.', ','))) ?></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Action')) ?>" class="col actions">
<a class="action view" href="<?= $escaper->escapeUrl($block->getViewUrl((int)$order->getId())) ?>"><span><?= $escaper->escapeHtml(__('View')) ?></span></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
@@ -0,0 +1,119 @@
<?php
/** @var \Esun\LegacyOrder\Block\Account\OrderView $block */
/** @var \Magento\Framework\Escaper $escaper */
$order = $block->getOrder();
$items = $block->getItems();
$shipping = $block->decodeAddress($order['shipping_address'] ?? null);
$billing = $block->decodeAddress($order['billing_address'] ?? null);
$currency = (string)($order['currency'] ?? '');
$discountAmount = abs((float)($order['discount_amount'] ?? 0));
$couponCode = trim((string)($order['coupon'] ?? ''));
$hasDiscount = $discountAmount > 0.0001 || $couponCode !== '';
$formatMoney = static fn ($value): string => number_format((float)$value, 2, '.', ',');
$formatQty = static fn ($value): string => (string)(int)round((float)$value);
$formatAddress = static function (array $address): array {
return array_values(array_filter([
$address['name'] ?? '',
trim((string)($address['street'] ?? '') . ' ' . (string)($address['unit'] ?? '')),
trim((string)($address['city'] ?? '') . ' ' . (string)($address['region'] ?? '') . ' ' . (string)($address['postcode'] ?? '')),
$address['country'] ?? '',
$address['telephone'] ?? '',
], static fn ($value): bool => trim((string)$value) !== ''));
};
?>
<div class="legacy-order-view">
<div class="legacy-order-view__notice" role="note">
<span class="legacy-order-view__notice-icon" aria-hidden="true">i</span>
<span><?= $escaper->escapeHtml(__('This order is from the old website and is for historical reference only.')) ?></span>
</div>
<section class="legacy-order-view__hero">
<div>
<span class="legacy-order-view__eyebrow"><?= $escaper->escapeHtml(__('Historical record')) ?></span>
<h1><?= $escaper->escapeHtml(__('Order #%1', $order['source_order_number'] ?? '')) ?></h1>
<p><?= $escaper->escapeHtml(__('Placed on %1', $order['ordered_at'] ?: '-')) ?></p>
</div>
<div class="legacy-order-view__hero-total">
<span><?= $escaper->escapeHtml(__('Grand Total')) ?></span>
<strong><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($order['grand_total'] ?? 0))) ?></strong>
<a href="<?= $escaper->escapeUrl($block->getUrl('legacy_order/account/index')) ?>">
<span aria-hidden="true">←</span> <?= $escaper->escapeHtml(__('Back to Historical Orders')) ?>
</a>
</div>
</section>
<section class="legacy-order-view__status-grid" aria-label="<?= $escaper->escapeHtmlAttr(__('Order status summary')) ?>">
<?php foreach ([
[__('Order Status'), $order['order_status'] ?? null],
[__('Payment Status'), $order['payment_status'] ?? null],
[__('Shipping Status'), $order['shipping_status'] ?? null],
[__('Tracking Number'), $order['tracking_number'] ?? null],
] as [$label, $value]): ?>
<div class="legacy-order-view__status-card">
<span><?= $escaper->escapeHtml($label) ?></span>
<strong><?= $escaper->escapeHtml($value ?: '-') ?></strong>
</div>
<?php endforeach; ?>
</section>
<section class="legacy-order-view__panel legacy-order-view__items">
<header class="legacy-order-view__section-title">
<div><span><?= count($items) ?></span><h2><?= $escaper->escapeHtml(__('Items Ordered')) ?></h2></div>
</header>
<div class="table-wrapper order-items">
<table class="data table table-order-items">
<caption class="table-caption"><?= $escaper->escapeHtml(__('Items Ordered')) ?></caption>
<thead><tr><th class="col name"><?= $escaper->escapeHtml(__('Product')) ?></th><th class="col sku"><?= $escaper->escapeHtml(__('SKU')) ?></th><th class="col price"><?= $escaper->escapeHtml(__('Price')) ?></th><th class="col qty"><?= $escaper->escapeHtml(__('Qty')) ?></th><th class="col subtotal"><?= $escaper->escapeHtml(__('Subtotal')) ?></th></tr></thead>
<tbody>
<?php foreach ($items as $item): ?>
<tr>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Product')) ?>" class="col name"><strong><?= $escaper->escapeHtml($item['product_name'] ?: $item['sku']) ?></strong></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('SKU')) ?>" class="col sku"><?= $escaper->escapeHtml($item['sku']) ?></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Price')) ?>" class="col price"><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($item['price']))) ?></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Qty')) ?>" class="col qty"><span><?= $escaper->escapeHtml($formatQty($item['qty'])) ?></span></td>
<td data-th="<?= $escaper->escapeHtmlAttr(__('Subtotal')) ?>" class="col subtotal"><strong><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($item['row_total']))) ?></strong></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr><th colspan="4" scope="row"><?= $escaper->escapeHtml(__('Product Subtotal')) ?></th><td><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($order['product_total'] ?? 0))) ?></td></tr>
<?php if ($hasDiscount): ?>
<tr class="legacy-order-view__discount-row">
<th colspan="4" scope="row">
<?= $escaper->escapeHtml(__('Discount')) ?>
<?php if ($couponCode !== ''): ?><small><?= $escaper->escapeHtml(__('Coupon: %1', $couponCode)) ?></small><?php endif; ?>
</th>
<td>-<?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($discountAmount))) ?></td>
</tr>
<?php endif; ?>
<?php if ((float)($order['shipping_amount'] ?? 0) !== 0.0): ?><tr><th colspan="4" scope="row"><?= $escaper->escapeHtml(__('Shipping')) ?></th><td><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($order['shipping_amount']))) ?></td></tr><?php endif; ?>
<?php if ((float)($order['tax_amount'] ?? 0) !== 0.0): ?><tr><th colspan="4" scope="row"><?= $escaper->escapeHtml(__('Tax')) ?></th><td><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($order['tax_amount']))) ?></td></tr><?php endif; ?>
<?php if ((float)($order['fee_amount'] ?? 0) !== 0.0): ?><tr><th colspan="4" scope="row"><?= $escaper->escapeHtml(__('Fee')) ?></th><td><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($order['fee_amount']))) ?></td></tr><?php endif; ?>
<tr class="grand_total"><th colspan="4" scope="row"><?= $escaper->escapeHtml(__('Grand Total')) ?></th><td><strong><?= $escaper->escapeHtml(trim($currency . ' ' . $formatMoney($order['grand_total'] ?? 0))) ?></strong></td></tr>
</tfoot>
</table>
</div>
</section>
<section class="legacy-order-view__panel legacy-order-view__information">
<header class="legacy-order-view__section-title"><h2><?= $escaper->escapeHtml(__('Order Information')) ?></h2></header>
<div class="legacy-order-view__info-grid">
<?php foreach ([[__('Shipping Address'), $shipping], [__('Billing Address'), $billing]] as [$label, $address]): ?>
<article class="legacy-order-view__info-card">
<h3><?= $escaper->escapeHtml($label) ?></h3>
<address><?= /* @noEscape */ implode('<br>', array_map([$escaper, 'escapeHtml'], $formatAddress($address))) ?: $escaper->escapeHtml('-') ?></address>
</article>
<?php endforeach; ?>
<article class="legacy-order-view__info-card">
<h3><?= $escaper->escapeHtml(__('Shipping Method')) ?></h3>
<p><?= $escaper->escapeHtml($order['shipping_method'] ?: '-') ?></p>
<?php if (!empty($order['carrier'])): ?><small><?= $escaper->escapeHtml(__('Carrier: %1', $order['carrier'])) ?></small><?php endif; ?>
</article>
<article class="legacy-order-view__info-card">
<h3><?= $escaper->escapeHtml(__('Payment Method')) ?></h3>
<p><?= $escaper->escapeHtml($order['payment_method'] ?: '-') ?></p>
<?php if (!empty($order['payment_transaction_id'])): ?><small><?= $escaper->escapeHtml(__('Transaction: %1', $order['payment_transaction_id'])) ?></small><?php endif; ?>
</article>
</div>
</section>
</div>
@@ -0,0 +1,345 @@
.account.legacy-order-account-index.page-layout-2columns-left .column.main,
.account.legacy-order-account-view.page-layout-2columns-left .column.main {
background: transparent;
border-radius: 0;
padding: 0 !important;
}
.legacy-orders__notice,
.legacy-order-view__notice {
font-weight: 600;
margin-bottom: 24px;
}
.legacy-order-view {
color: #333;
}
.legacy-order-view__notice {
align-items: center;
background: #fff8ed;
border: 1px solid #f3d5a5;
border-radius: 8px;
color: #6f4a12;
display: flex;
gap: 12px;
padding: 15px 18px;
}
.legacy-order-view__notice-icon {
align-items: center;
background: #f28c00;
border-radius: 50%;
color: #fff;
display: inline-flex;
flex: 0 0 22px;
font-family: Georgia, serif;
font-size: 14px;
font-style: italic;
height: 22px;
justify-content: center;
}
.legacy-order-view__hero {
align-items: center;
background: linear-gradient(135deg, #282d32 0%, #3b4248 100%);
border-radius: 10px;
box-shadow: 0 10px 30px rgba(25, 31, 36, .12);
color: #fff;
display: flex;
justify-content: space-between;
margin-bottom: 20px;
min-height: 170px;
overflow: hidden;
padding: 34px 38px;
position: relative;
}
.legacy-order-view__hero::after {
border: 32px solid rgba(255, 255, 255, .04);
border-radius: 50%;
content: '';
height: 190px;
position: absolute;
right: -65px;
top: -85px;
width: 190px;
}
.legacy-order-view__eyebrow {
color: #ffb175;
display: block;
font-size: 13px;
font-weight: 700;
letter-spacing: .12em;
margin-bottom: 8px;
text-transform: uppercase;
}
.legacy-order-view__hero h1 {
color: #fff;
font-size: 32px;
font-weight: 600;
line-height: 1.2;
margin: 0 0 10px;
}
.legacy-order-view__hero p {
color: rgba(255, 255, 255, .7);
margin: 0;
}
.legacy-order-view__hero-total {
align-items: flex-end;
display: flex;
flex-direction: column;
position: relative;
z-index: 1;
}
.legacy-order-view__hero-total > span {
color: rgba(255, 255, 255, .68);
font-size: 13px;
text-transform: uppercase;
}
.legacy-order-view__hero-total strong {
color: #fff;
font-size: 30px;
line-height: 1.3;
margin: 4px 0 16px;
}
.legacy-order-view__hero-total a {
color: #ffb175;
font-size: 14px;
text-decoration: none;
}
.legacy-order-view__status-grid {
display: grid;
gap: 14px;
grid-template-columns: repeat(4, minmax(0, 1fr));
margin-bottom: 24px;
}
.legacy-order-view__status-card {
background: #fff;
border: 1px solid #e7e7e7;
border-radius: 8px;
box-shadow: 0 3px 12px rgba(25, 31, 36, .04);
min-width: 0;
padding: 18px 20px;
}
.legacy-order-view__status-card span {
color: #8a8a8a;
display: block;
font-size: 12px;
letter-spacing: .04em;
margin-bottom: 7px;
text-transform: uppercase;
}
.legacy-order-view__status-card strong {
color: #303030;
display: block;
font-size: 16px;
overflow-wrap: anywhere;
}
.legacy-order-view__panel {
background: #fff;
border-radius: 10px;
box-shadow: 0 4px 18px rgba(25, 31, 36, .05);
margin-top: 24px;
padding: 28px 30px;
}
.legacy-order-view__section-title {
align-items: center;
border-bottom: 1px solid #ececec;
display: flex;
justify-content: space-between;
margin-bottom: 8px;
padding-bottom: 18px;
}
.legacy-order-view__section-title > div {
align-items: center;
display: flex;
gap: 11px;
}
.legacy-order-view__section-title > div > span {
align-items: center;
background: #fff0e8;
border-radius: 50%;
color: #ff5a16;
display: inline-flex;
font-size: 13px;
font-weight: 700;
height: 28px;
justify-content: center;
width: 28px;
}
.legacy-order-view__section-title h2 {
color: #222;
font-size: 22px;
font-weight: 600;
margin: 0;
}
.legacy-order-view .table-wrapper {
margin: 0;
}
.legacy-order-view .data.table > thead > tr > th {
background: #f7f8f8;
color: #777;
font-size: 12px;
letter-spacing: .04em;
padding: 15px 16px;
text-transform: uppercase;
}
.legacy-order-view .data.table > tbody > tr > td {
padding: 19px 16px;
vertical-align: middle;
}
.legacy-order-view .data.table .col.price,
.legacy-order-view .data.table .col.subtotal,
.legacy-order-view .data.table tfoot td {
text-align: right;
white-space: nowrap;
}
.legacy-order-view .data.table .col.qty {
text-align: center;
}
.legacy-order-view .data.table .col.qty span {
background: #f2f3f3;
border-radius: 15px;
display: inline-block;
min-width: 24px;
padding: 3px 9px;
}
.legacy-order-view .data.table tfoot th,
.legacy-order-view .data.table tfoot td {
border-top: 0;
font-size: 14px;
padding: 8px 16px;
}
.legacy-order-view .data.table tfoot tr:first-child th,
.legacy-order-view .data.table tfoot tr:first-child td {
border-top: 1px solid #ddd;
padding-top: 18px;
}
.legacy-order-view .data.table tfoot th {
color: #666;
font-weight: 500;
text-align: right;
}
.legacy-order-view .data.table tfoot .legacy-order-view__discount-row th,
.legacy-order-view .data.table tfoot .legacy-order-view__discount-row td {
color: #16894b;
}
.legacy-order-view__discount-row small {
background: #eaf8f0;
border-radius: 4px;
display: inline-block;
font-size: 11px;
margin-left: 7px;
padding: 3px 7px;
}
.legacy-order-view .data.table tfoot .grand_total th,
.legacy-order-view .data.table tfoot .grand_total td {
border-top: 2px solid #333;
color: #222;
font-size: 18px;
padding-top: 16px;
}
.legacy-order-view__info-grid {
display: grid;
gap: 16px;
grid-template-columns: repeat(2, minmax(0, 1fr));
padding-top: 14px;
}
.legacy-order-view__info-card {
background: #f8f9f9;
border: 1px solid #eceeee;
border-radius: 8px;
min-height: 125px;
padding: 20px 22px;
}
.legacy-order-view__info-card h3 {
color: #222;
font-size: 15px;
font-weight: 600;
margin: 0 0 12px;
}
.legacy-order-view__info-card address,
.legacy-order-view__info-card p {
color: #666;
font-style: normal;
line-height: 1.7;
margin: 0;
}
.legacy-order-view__info-card small {
color: #999;
display: block;
margin-top: 8px;
overflow-wrap: anywhere;
}
@media (max-width: 900px) {
.legacy-order-view__status-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 767px) {
.legacy-order-view__hero {
align-items: flex-start;
flex-direction: column;
gap: 28px;
padding: 26px 22px;
}
.legacy-order-view__hero-total {
align-items: flex-start;
}
.legacy-order-view__hero h1 {
font-size: 25px;
}
.legacy-order-view__status-grid,
.legacy-order-view__info-grid {
grid-template-columns: 1fr;
}
.legacy-order-view__panel {
padding: 22px 18px;
}
.legacy-order-view .data.table .col.price,
.legacy-order-view .data.table .col.subtotal,
.legacy-order-view .data.table .col.qty {
text-align: right;
}
}