fix: hard-code correct storage IDs for €1520 instant server
The WHMCS URL has incorrect configoption IDs: - Shows Kioxia 3.2TB for slots that should have Crucial 4TB - Wrong IDs prevent proper preselection Fixed by: - Detecting the €1520 server by storage description - Hard-coding the correct configoption IDs: * 34: 166 (Crucial T705 4TB) * 35: 252 (Crucial T705 4TB) * 36: 260 (Crucial T705 4TB) * 37: 269 (Crucial T705 4TB) * 38: 254 (Kioxia CM7-V 3.2TB) * 39: 288 (Kioxia CM7-V 3.2TB) Now shows correctly: 4x Crucial T705 4TB + 2x Kioxia CM7-V 3.2TB 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4201,27 +4201,54 @@ var wpcf7 = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// For instant customization, use the exact preselected IDs from WHMCS URL
|
// For instant customization, ignore WHMCS URL IDs and match based on server description
|
||||||
options.forEach(opt => {
|
// The WHMCS URLs have wrong IDs for the €1520 server
|
||||||
let selectedValId = preselected[opt.id]; // Use the ID directly from WHMCS
|
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
|
options.forEach(opt => {
|
||||||
if (selectedValId && !opt.values.find(v => v.id === selectedValId)) {
|
let selectedValId = correctConfig[opt.id];
|
||||||
console.warn(`Invalid preselected ID ${selectedValId} for option ${opt.id}`);
|
if (selectedValId) {
|
||||||
selectedValId = null;
|
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));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
// 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
|
// Render options with the exact WHMCS preselected values
|
||||||
renderDynamicOptions(options, true, preselected);
|
renderDynamicOptions(options, true, preselected);
|
||||||
|
|||||||
Reference in New Issue
Block a user