Enhancement: Show proper order details instead of GUIDs
- OrderListMenu now shows item summary (e.g., '2x Product Name' or 'Product Name +2 more') - FormatCart enhanced to show variant selections and multi-buy indicators - FormatOrder enhanced to show variant names and detailed item breakdown - Cart now clearly distinguishes between multi-buy bundles and regular items - Order confirmations now show full product and variant details Replaced generic GUID displays with human-readable product information for better UX.
This commit is contained in:
parent
6c79c04ebd
commit
5ab2c51aa8
@ -333,9 +333,29 @@ namespace TeleBot.UI
|
||||
foreach (var order in orders.Take(10)) // Limit to 10 most recent
|
||||
{
|
||||
var status = GetOrderStatusEmoji(order.Status);
|
||||
|
||||
// Build a summary of items in the order
|
||||
var itemSummary = "";
|
||||
if (order.Items.Any())
|
||||
{
|
||||
var firstItem = order.Items.First();
|
||||
if (order.Items.Count == 1)
|
||||
{
|
||||
itemSummary = $"{firstItem.Quantity}x {firstItem.ProductName}";
|
||||
}
|
||||
else
|
||||
{
|
||||
itemSummary = $"{firstItem.ProductName} +{order.Items.Count - 1} more";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
itemSummary = "Empty order";
|
||||
}
|
||||
|
||||
buttons.Add(new[] {
|
||||
InlineKeyboardButton.WithCallbackData(
|
||||
$"{status} Order {order.Id.ToString().Substring(0, 8)} - £{order.TotalAmount:F2}",
|
||||
$"{status} {itemSummary} - £{order.TotalAmount:F2}",
|
||||
$"order:{order.Id}"
|
||||
)
|
||||
});
|
||||
|
||||
@ -202,9 +202,31 @@ namespace TeleBot.UI
|
||||
|
||||
foreach (var item in cart.Items)
|
||||
{
|
||||
sb.AppendLine($"• *{item.ProductName}*");
|
||||
// Build item display with variants/multi-buy info
|
||||
var itemDisplay = item.ProductName;
|
||||
|
||||
// Show variant if selected
|
||||
if (item.SelectedVariants?.Any() == true)
|
||||
{
|
||||
itemDisplay += $" ({string.Join(", ", item.SelectedVariants)})";
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(item.SelectedVariant))
|
||||
{
|
||||
itemDisplay += $" ({item.SelectedVariant})";
|
||||
}
|
||||
|
||||
// Show if it's a multi-buy
|
||||
if (item.MultiBuyId.HasValue)
|
||||
{
|
||||
sb.AppendLine($"• *{itemDisplay}* _(Multi-buy Bundle)_");
|
||||
sb.AppendLine($" Bundle Price: *£{item.UnitPrice:F2}*");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine($"• *{itemDisplay}*");
|
||||
sb.AppendLine($" Qty: {item.Quantity} × £{item.UnitPrice:F2} = *£{item.TotalPrice:F2}*");
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine($"\n📊 *Summary:*");
|
||||
sb.AppendLine($"Items: {cart.GetTotalItems()}");
|
||||
@ -276,7 +298,16 @@ namespace TeleBot.UI
|
||||
sb.AppendLine("\n*Items:*");
|
||||
foreach (var item in order.Items)
|
||||
{
|
||||
sb.AppendLine($"• {item.ProductName} - Qty: {item.Quantity} - £{item.TotalPrice:F2}");
|
||||
var itemDisplay = item.ProductName ?? "Unknown Product";
|
||||
|
||||
// Add variant info if available
|
||||
if (!string.IsNullOrEmpty(item.ProductVariantName))
|
||||
{
|
||||
itemDisplay += $" ({item.ProductVariantName})";
|
||||
}
|
||||
|
||||
sb.AppendLine($"• {itemDisplay}");
|
||||
sb.AppendLine($" Qty: {item.Quantity} × £{item.UnitPrice:F2} = £{item.TotalPrice:F2}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user