From 4d901448eb5286ce7bac00a86ff890c8be360c73 Mon Sep 17 00:00:00 2001 From: George Birikorang Date: Thu, 18 Sep 2025 03:42:37 -0700 Subject: [PATCH] refactor: update product comparison layout and JavaScript for improved clarity - Renamed sections in product-comparison.html for better alignment with product details, changing "Sales Package" to "Materials", "Model Number" to "Design", and "Secondary Material" to "Use Cases". - Removed redundant product and dimensions sections from the HTML as per request to streamline the comparison layout. - Updated main.js to reflect changes in the HTML, limiting the sections updated in the comparison table to "general" and "warranty" only, and adjusted data retrieval to match new section names. --- product-comparison.html | 392 +--------------------------------------- scripts/main.js | 39 +--- 2 files changed, 14 insertions(+), 417 deletions(-) diff --git a/product-comparison.html b/product-comparison.html index 70fb4a2..b00e7bc 100644 --- a/product-comparison.html +++ b/product-comparison.html @@ -311,12 +311,12 @@
- +
- Sales Package + Materials
- +
- Model Number + Design
- +
- Secondary Material -
-
- - -
-
- - -
-
-
- - -
-
- Configuration -
-
- - -
-
- - -
-
-
- - -
-
- Upholstery Material -
-
- - -
-
- - -
-
-
- - -
-
- Upholstery Color + Use Cases
- -
-

- Product -

-
+ - -
- -
-
- Filling Material -
-
- - -
-
- - -
-
-
- - -
-
- Finish Type -
-
- - -
-
- - -
-
-
- - -
-
- Adjustable Headrest -
-
- - -
-
- - -
-
-
- - -
-
- Maximum Load Capacity -
-
- - -
-
- - -
-
-
- - -
-
- Origin of Manufacture -
-
- - -
-
- - -
-
-
-
- - -
-

- Dimensions -

-
- - -
- -
-
- Width -
-
- - -
-
- - -
-
-
- - -
-
- Height -
-
- - -
-
- - -
-
-
- - -
-
- Depth -
-
- - -
-
- - -
-
-
- - -
-
- Weight -
-
- - -
-
- - -
-
-
- - -
-
- Seat Height -
-
- - -
-
- - -
-
-
- - -
-
- Leg Height -
-
- - -
-
- - -
-
-
-
+
@@ -700,86 +404,6 @@
- - -
-
- Warranty Service Type -
-
- - -
-
- - -
-
-
- - -
-
- Covered in Warranty -
-
- - -
-
- - -
-
-
- - -
-
- Not Covered in Warranty -
-
- - -
-
- - -
-
-
- - -
-
- Domestic Warranty -
-
- - -
-
- - -
-
-
diff --git a/scripts/main.js b/scripts/main.js index 46721ab..e6f3e96 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -923,8 +923,8 @@ function updateComparisonTable(product, slotNumber) { console.log(`=== UPDATING COMPARISON TABLE FOR SLOT ${slotNumber} ===`); console.log("Product:", product); - // Update all sections - const sections = ["general", "product", "dimensions", "warranty"]; + // Update only sections present in the HTML + const sections = ["general", "warranty"]; sections.forEach((section) => { console.log(`Updating ${section} section...`); @@ -1001,41 +1001,14 @@ function getProductSectionData(product, sectionName) { switch (sectionName) { case "general": sectionData = [ - product.salesPackage || "N/A", // Sales Package - product.modelNo || "N/A", // Model Number - product.additionalInformation?.Material || "N/A", // Secondary Material - product.configuration || "N/A", // Configuration - product.additionalInformation?.Upholstery || "N/A", // Upholstery Material - product.colors?.[0]?.name || "N/A", // Upholstery Color - ]; - break; - case "product": - sectionData = [ - product.fillingMaterial || "N/A", // Filling Material - product.finishType || "N/A", // Finish Type - product.adjustableHeadrest || "N/A", // Adjustable Headrest - product.maxLoadCapacity || "N/A", // Maximum Load Capacity - product.originOfManufacture || "N/A", // Origin of Manufacture - ]; - break; - case "dimensions": - const dims = product.dimensions?.split(" x ") || []; - sectionData = [ - dims[0] || "N/A", // Width - dims[1] || "N/A", // Height - dims[2] || "N/A", // Depth - product.weight || "N/A", // Weight - product.seatHeight || "N/A", // Seat Height - product.legHeight || "N/A", // Leg Height + product.additionalInformation?.Material || "N/A", // Materials + product.additionalInformation?.Design || "N/A", // Design + product.additionalInformation?.["Use Cases"] || "N/A", // Use Cases ]; break; case "warranty": sectionData = [ - product.additionalInformation?.Warranty || "N/A", // Warranty Summary - product.warrantyServiceType || "N/A", // Warranty Service Type - product.coveredInWarranty || "N/A", // Covered in Warranty - product.notCoveredInWarranty || "N/A", // Not Covered in Warranty - product.additionalInformation?.Warranty || "N/A", // Domestic Warranty + product.additionalInformation?.Warranty || "N/A", // Warranty Summary only ]; break; default: