mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:45:23 +02:00
fix: prioritize ASIN column detection over SKU in processBuyBoxExcel
This commit is contained in:
@@ -2577,11 +2577,19 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const asinIdx = headers.findIndex(h => {
|
let finalAsinIdx = headers.findIndex(h => {
|
||||||
const s = String(h || '').toUpperCase().trim();
|
const s = String(h || '').toUpperCase().replace(/[^A-Z]/g, '');
|
||||||
return s === 'ASIN' || s.includes('AMAZON ASIN') || s.includes('CHILD ASIN') || s.includes('IDENTIFIER') || s.includes('PRODUCT ID') || s.includes('SKU');
|
return s === 'ASIN' || s.includes('AMAZONASIN') || s.includes('CHILDASIN');
|
||||||
});
|
});
|
||||||
let finalAsinIdx = asinIdx !== -1 ? asinIdx : 1; // Default to Col B if not found
|
|
||||||
|
if (finalAsinIdx === -1) {
|
||||||
|
finalAsinIdx = headers.findIndex(h => {
|
||||||
|
const s = String(h || '').toUpperCase().replace(/[^A-Z]/g, '');
|
||||||
|
return s.includes('IDENTIFIER') || s.includes('PRODUCTID') || s.includes('SKU');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalAsinIdx === -1) finalAsinIdx = 1; // Default to Col B if not found
|
||||||
|
|
||||||
// Dynamically find the "Issue Type" or "Reason" column
|
// Dynamically find the "Issue Type" or "Reason" column
|
||||||
let reasonIdx = headers.findIndex(h => {
|
let reasonIdx = headers.findIndex(h => {
|
||||||
|
|||||||
Reference in New Issue
Block a user