Skip to main content

Overview

PixelTech’s order tracking system provides customers with real-time status updates, visual progress timelines, shipping tracking integration, and warranty claim management - all synchronized automatically via Firebase.

Accessing Order Details

From Profile Page

1

View Order History

Navigate to profile page (/profile.html)
2

Browse Orders

See list of all orders with status badges
3

Click Any Order

Navigate to detailed order view (/shop/order-detail.html?id={orderId})
4

Real-Time Loading

Order details load instantly from cache, then sync with Firebase

From Success Page

After checkout:
  • Customer redirected to /shop/success.html?order={orderId}
  • Success page shows celebration animation
  • “View Order Details” button links to order detail page
  • Email notification sent with order link

Order Detail Page

Information Displayed

The order detail page shows comprehensive information:

Order Header

  • Order ID (e.g., “#ABC123DE”)
  • Order date and time
  • Current status badge
  • Visual progress timeline

Buyer Information

  • Customer name
  • Email address
  • Phone number
  • Delivery address
  • City and department

Payment Details

  • Payment method used
  • Transaction status
  • Payment processor icons
  • Approval indicators

Product List

  • Product images
  • Names and specifications
  • Color/capacity variants
  • Quantities and prices
  • Warranty status per item

Real-Time Order Sync

Smart Cache + Live Updates
async function initSmartRealtimeOrder() {
  // 1. INSTANT LOAD: Check localStorage cache
  const cachedRaw = localStorage.getItem('pixeltech_user_orders');
  if (cachedRaw) {
    const parsed = JSON.parse(cachedRaw);
    if (parsed.map && parsed.map[orderId]) {
      currentOrder = parsed.map[orderId];
      renderAllOrderData(currentOrder); // Immediate display
    }
  }
  
  // 2. REAL-TIME SYNC: Connect to Firebase
  unsubscribeOrder = onSnapshot(doc(db, "orders", orderId), (snap) => {
    const freshData = { id: snap.id, ...snap.data() };
    
    // Only re-render if something actually changed
    if (JSON.stringify(currentOrder) !== JSON.stringify(freshData)) {
      currentOrder = freshData;
      renderAllOrderData(currentOrder);
      updateOrderInLocalCache(currentOrder); // Silent cache update
    }
  });
}
The order page loads instantly from cache, then establishes a real-time connection. If the admin updates the order status, the customer sees the change immediately without refreshing.

Order Status Timeline

Visual Progress Indicator

The timeline shows order progress through four main stages:
    ○━━━━●━━━━●━━━━●
  PENDING  CONFIRMED  PREPARED  DISPATCHED
Timeline Features:
  • Completed Steps: Black circles with white icons
  • Current Step: Cyan glowing circle with animated icon
  • Future Steps: Gray circles
  • Progress Bar: Animated fill showing percentage complete

Status Stages

Awaiting Payment Confirmation

Status: PENDIENTE_PAGOOrder is created but payment not yet confirmed. Applicable to:
  • Cash on Delivery orders (awaiting admin approval)
  • Bank transfers (awaiting payment verification)
  • Failed online payments
Customer sees: Yellow “Pending Payment” badge

Timeline Implementation

function renderTimeline(currentStatus) {
  const steps = [
    { label: 'Pending Payment', icon: 'fa-file-invoice-dollar' },
    { label: 'Confirmed', icon: 'fa-clipboard-check' },
    { label: 'Prepared', icon: 'fa-box-open' },
    { label: 'Dispatched', icon: 'fa-truck-fast' }
  ];
  
  // Determine which step customer is on
  let activeIndex = 0;
  if (status === 'PENDIENTE_PAGO') activeIndex = 0;
  else if (['PAGADO', 'CONFIRMADO'].includes(status)) activeIndex = 1;
  else if (['ALISTAMIENTO', 'ALISTADO'].includes(status)) activeIndex = 2;
  else if (['DESPACHADO', 'EN_RUTA', 'ENTREGADO'].includes(status)) activeIndex = 3;
  
  const progressPercent = (activeIndex / (steps.length - 1)) * 100;
  // Render animated progress bar and step indicators
}

Shipping Tracking Integration

Tracking Number Display

Once order is dispatched, tracking information becomes available:

Tracking Information Box

┌─────────────────────────────────────────┐
│  🚚 Shipping Tracking                   │
├─────────────────────────────────────────┤
│                                         │
│  Carrier: Servientrega                  │
│  Tracking #: 123456789012               │
│                                         │
│  [Copy Number] [Track on Carrier Site]  │
└─────────────────────────────────────────┘

Supported Carriers

System detects carrier and provides direct tracking link:
Colombia’s Leading CarrierTracking URL: https://www.servientrega.com/rastreo-envioGuide format: 10-13 digits

Tracking Number Actions

Copy to Clipboard
els.copyGuideBtn.onclick = () => {
  navigator.clipboard.writeText(trackingNumber);
  // Show success feedback
  button.innerHTML = '<i class="fa-solid fa-check"></i>';
  button.classList.add('text-green-500');
  setTimeout(() => {
    // Revert after 2 seconds
    button.innerHTML = 'Copy';
    button.classList.remove('text-green-500');
  }, 2000);
};
Track on Carrier Site Button opens carrier’s tracking page in new tab with tracking number pre-filled (where supported).

Product Warranty System

How Warranties Work

Each product in an order has warranty tracking:
1

Warranty Defined in Product

Each product has warranty period (e.g., 60 days, 12 months)
2

Warranty Starts at Dispatch

Clock starts when order status becomes DESPACHADO
3

Warranty Active During Period

Customer can report issues while warranty is valid
4

Warranty Expiration

After period ends, warranty claims no longer accepted

Warranty Period Calculation

function getWarrantyDaysInTotal(item) {
  let warranty = item.warranty || item.warrantyDays;
  
  // Check if warranty is object with time/unit
  if (typeof warranty === 'object') {
    const time = parseInt(warranty.time);
    const unit = warranty.unit.toLowerCase();
    
    if (unit.includes('year')) return time * 365;
    if (unit.includes('month')) return time * 30;
    if (unit.includes('week')) return time * 7;
    return time; // days
  }
  
  // Direct number of days
  return parseInt(warranty) || 60; // Default 60 days
}

Warranty Status Badges

Each product in order details shows warranty status:

Status: Order not yet shippedBadge: 🕐 “Warranty starts when dispatched”Customer cannot submit claims yet.

Warranty Claim Process

Submitting a Warranty Claim

1

Open Order Details

Navigate to order containing defective product
2

Check Warranty Status

Ensure product shows “Warranty Active” badge
3

Click Report Problem

Button appears next to product with active warranty
4

Enter Serial Number

System validates S/N against product’s assigned serial numbers
5

Describe Issue

Text field for detailed problem description
6

Upload Evidence

Attach photos/videos of the defect (optional but recommended)
7

Submit Claim

System validates and creates warranty record in Firebase
8

Receive Confirmation

Success message displayed, claim appears in order details

Warranty Claim Form

┌──────────────────────────────────────┐
│  Report Problem                      │
│  iPhone 14 Pro (Black, 128GB)       │
├──────────────────────────────────────┤
│                                      │
│  Serial Number: *                    │
│  [________________]                  │
│                                      │
│  Describe the Problem: *             │
│  [________________________________]  │
│  [________________________________]  │
│  [________________________________]  │
│                                      │
│  Evidence (Photos/Videos):           │
│  [Choose Files]  (0 files selected)  │
│                                      │
│            [Cancel] [Submit Claim]   │
└──────────────────────────────────────┘

Serial Number Validation

Security Measure to Prevent Fraud
if (item.sns && Array.isArray(item.sns)) {
  // Check if provided S/N matches any assigned to this order
  const snFound = item.sns.some(validSn => 
    validSn.trim().toUpperCase() === inputSN.toUpperCase()
  );
  
  if (!snFound) {
    throw new Error("Serial number doesn't match this shipment");
  }
}

// Also check for duplicate claims on same S/N
const duplicateQuery = query(
  collection(db, "warranties"),
  where("userId", "==", userId),
  where("snProvided", "==", inputSN),
  where("productId", "==", productId)
);

const existingClaim = await getDocs(duplicateQuery);
if (!existingClaim.empty) {
  throw new Error("Warranty claim already exists for this serial number");
}
Serial number validation prevents customers from:
  • Claiming warranty on products they didn’t purchase
  • Submitting duplicate claims for same unit
  • Using serial numbers from other orders

Evidence Upload

Customers can attach multiple files:
const evidenceUrls = [];
if (imageFiles.length > 0) {
  for (const file of imageFiles) {
    // Upload to Firebase Storage
    const storageRef = ref(storage, `warranties/${orderId}/${Date.now()}_${file.name}`);
    await uploadBytes(storageRef, file);
    const url = await getDownloadURL(storageRef);
    evidenceUrls.push(url);
  }
}

// Store URLs in warranty document
await addDoc(collection(db, "warranties"), {
  evidenceImages: evidenceUrls,
  // ... other warranty data
});

Tracking Warranty Claims

Claim Status Display

Once submitted, warranty claim appears in order details:
Product: iPhone 14 Pro
[Active Warranty: 45 days]

[Case #1: Under Review 🔵]
[Case #2: Approved ✅]

Claim Statuses

Status: PENDIENTE_REVISIONClaim submitted and awaiting admin review.
  • Admin receives notification
  • Technical team evaluates claim
  • Customer sees “Under Review” badge
  • Estimated review time: 1-2 business days

Viewing Claim Details

Click any warranty case badge to see full details:
┌──────────────────────────────────────────┐
│  Warranty Claim #ABC123                  │
├──────────────────────────────────────────┤
│  Status: ✅ APPROVED                     │
│  Filed: March 5, 2024                    │
│                                          │
│  Your Report:                            │
│  "Screen has dead pixels in upper        │
│   right corner. Issue started after      │
│   3 days of normal use."                 │
│                                          │
│  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  │
│                                          │
│  Admin Response:                         │
│  "Claim approved. Manufacturing defect   │
│   confirmed. Please bring device to      │
│   authorized service center for display  │
│   replacement. No cost to customer."     │
│                                          │
│  Resolved: March 7, 2024                 │
│                                          │
│  [📄 Download Technical Report PDF]      │
│                                          │
│  [Close]                                 │
└──────────────────────────────────────────┘

Real-Time Warranty Updates

function listenForWarranties() {
  const qW = query(
    collection(db, "warranties"),
    where("orderId", "==", orderId),
    where("userId", "==", userId)
  );
  
  unsubscribeWarranties = onSnapshot(qW, (snapshot) => {
    // Warranty changes detected
    const freshWarranties = snapshot.docs.map(d => ({ 
      id: d.id, 
      ...d.data() 
    }));
    
    // Compare with current state
    if (JSON.stringify(activeWarranties) !== JSON.stringify(freshWarranties)) {
      activeWarranties = freshWarranties;
      renderItems(currentOrder); // Re-render product list with updated warranty status
    }
  });
}
When admin updates a warranty claim (approves, rejects, adds comment), customer sees the change immediately without refreshing the page.

Email Notifications

Customers receive email notifications for:
  • Order Confirmation (immediately after purchase)
  • 📦 Order Dispatched (when tracking number is assigned)
  • 🏠 Order Delivered (carrier confirmation)
  • 🛠️ Warranty Claim Received (claim submission)
  • Warranty Claim Approved (admin approves claim)
  • Warranty Claim Rejected (admin rejects with reason)
Each email includes direct link to order details page.

Invoice Display

If customer requested an invoice during checkout:
┌─────────────────────────────────────┐
│  📄 Invoice Information             │
├─────────────────────────────────────┤
│  Business Name: Empresa XYZ S.A.S.  │
│  Tax ID: 900123456-1                │
│  Email: [email protected]
│                                     │
│  Invoice will be sent within        │
│  3 business days after delivery.    │
└─────────────────────────────────────┘

Technical Implementation

Cache Structure for Orders

{
  "map": {
    "order_abc123": {
      "id": "order_abc123",
      "userId": "user_xyz",
      "status": "DESPACHADO",
      "total": 2500000,
      "shippingTracking": "1234567890",
      "shippingCarrier": "Servientrega",
      "items": [
        {
          "id": "prod_001",
          "name": "iPhone 14 Pro",
          "price": 4500000,
          "quantity": 1,
          "sns": ["C02ABC123DEF"],
          "warranty": { "time": 12, "unit": "months" }
        }
      ],
      "createdAt": "2024-03-05T10:00:00Z",
      "updatedAt": "2024-03-06T14:30:00Z",
      "shippedAt": "2024-03-06T14:30:00Z"
    }
  },
  "lastSync": 1709738400000
}

Performance Optimizations

Instant Loading

Order details render from cache before Firebase connection

Smart Re-rendering

Only updates UI when data actually changes (JSON comparison)

Selective Listeners

Only subscribes to current order, not entire collection

Automatic Cleanup

Unsubscribes from real-time listeners when leaving page

Shopping Cart

How orders are created from checkout

User Accounts

Accessing order history from profile

Build docs developers (and LLMs) love