diff --git a/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html b/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html index c08a48d..f078ba3 100644 --- a/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html +++ b/Documents/Vibe Coding Projects/dedicatednodes-redesign/dedicatednodes-bare-metal/new-baremetal.html @@ -4201,27 +4201,54 @@ var wpcf7 = { }); } - // For instant customization, use the exact preselected IDs from WHMCS URL - options.forEach(opt => { - let selectedValId = preselected[opt.id]; // Use the ID directly from WHMCS + // For instant customization, ignore WHMCS URL IDs and match based on server description + // The WHMCS URLs have wrong IDs for the €1520 server + if (selectedServer.storage === "4x Crucial T705 4TB NVMe + 2x Kioxia CM7-V 3.2TB NVMe") { + // Hard-code the correct configuration for this server + const correctConfig = { + 34: 166, // NVMe 1 - Crucial T705 4TB + 35: 252, // NVMe 2 - Crucial T705 4TB + 36: 260, // NVMe 3 - Crucial T705 4TB + 37: 269, // NVMe 4 - Crucial T705 4TB + 38: 254, // NVMe 5 - Kioxia CM7-V 3.2TB + 39: 288, // NVMe 6 - Kioxia CM7-V 3.2TB + }; - // Validate that the preselected ID exists in the options - if (selectedValId && !opt.values.find(v => v.id === selectedValId)) { - console.warn(`Invalid preselected ID ${selectedValId} for option ${opt.id}`); - selectedValId = null; - } - - // For non-storage options, apply price adjustment - if (opt.type !== 'storage' && selectedValId) { - const selectedVal = opt.values.find(v => v.id === selectedValId); - if (selectedVal && selectedVal.price > 0) { - const offset = selectedVal.price; - opt.values.forEach(v => { - v.price = parseFloat((v.price - offset).toFixed(2)); - }); + options.forEach(opt => { + let selectedValId = correctConfig[opt.id]; + if (selectedValId) { + preselected[opt.id] = selectedValId; + console.log(`Storage option ${opt.id} (${opt.label}): set to ${selectedValId}`); } - } - }); + + // For non-storage options, apply price adjustment + if (opt.type !== 'storage' && selectedValId) { + const selectedVal = opt.values.find(v => v.id === selectedValId); + if (selectedVal && selectedVal.price > 0) { + const offset = selectedVal.price; + opt.values.forEach(v => { + v.price = parseFloat((v.price - offset).toFixed(2)); + }); + } + } + }); + } else { + // For other servers, use the preselected IDs from URL + options.forEach(opt => { + let selectedValId = preselected[opt.id]; + + // For non-storage options, apply price adjustment + if (opt.type !== 'storage' && selectedValId) { + const selectedVal = opt.values.find(v => v.id === selectedValId); + if (selectedVal && selectedVal.price > 0) { + const offset = selectedVal.price; + opt.values.forEach(v => { + v.price = parseFloat((v.price - offset).toFixed(2)); + }); + } + } + }); + } // Render options with the exact WHMCS preselected values renderDynamicOptions(options, true, preselected);