refactor: update product comparison layout and JavaScript for improved clarity
All checks were successful
continuous-integration/drone/push Build is passing

- 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.
This commit is contained in:
George Birikorang 2025-09-18 03:42:37 -07:00
parent 6ea34ba68f
commit 4d901448eb
2 changed files with 14 additions and 417 deletions

View file

@ -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: