fix: add missing weight and description logs
This commit is contained in:
@@ -386,14 +386,7 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean description for feed (remove HTML tags and limit length)
|
// Check if description is missing or too short (less than 20 characters) - skip if insufficient
|
||||||
const rawDescription = product.description
|
|
||||||
? cleanTextContent(product.description).substring(0, 500)
|
|
||||||
: `${product.name || 'Product'} - Art.-Nr.: ${product.articleNumber || 'N/A'}`;
|
|
||||||
|
|
||||||
const cleanDescription = escapeXml(rawDescription) || "Produktbeschreibung nicht verfügbar";
|
|
||||||
|
|
||||||
// Check if description is missing or too short (less than 20 characters)
|
|
||||||
const originalDescription = product.description ? cleanTextContent(product.description) : '';
|
const originalDescription = product.description ? cleanTextContent(product.description) : '';
|
||||||
if (!originalDescription || originalDescription.length < 20) {
|
if (!originalDescription || originalDescription.length < 20) {
|
||||||
productsNeedingDescription.push({
|
productsNeedingDescription.push({
|
||||||
@@ -402,8 +395,14 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => {
|
|||||||
currentDescription: originalDescription || 'NONE',
|
currentDescription: originalDescription || 'NONE',
|
||||||
url: `/Artikel/${product.seoName}`
|
url: `/Artikel/${product.seoName}`
|
||||||
});
|
});
|
||||||
|
skippedCount++;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean description for feed (remove HTML tags and limit length)
|
||||||
|
const rawDescription = cleanTextContent(product.description).substring(0, 500);
|
||||||
|
const cleanDescription = escapeXml(rawDescription) || "Produktbeschreibung nicht verfügbar";
|
||||||
|
|
||||||
// Clean product name
|
// Clean product name
|
||||||
const rawName = product.name || "Unnamed Product";
|
const rawName = product.name || "Unnamed Product";
|
||||||
const cleanName = escapeXml(cleanTextContent(rawName)) || "Unnamed Product";
|
const cleanName = escapeXml(cleanTextContent(rawName)) || "Unnamed Product";
|
||||||
@@ -487,19 +486,22 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => {
|
|||||||
<g:gtin>${gtin}</g:gtin>`;
|
<g:gtin>${gtin}</g:gtin>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add weight if available
|
// Check if product has weight data - skip if missing
|
||||||
if (product.weight && !isNaN(product.weight)) {
|
if (!product.weight || isNaN(product.weight)) {
|
||||||
productsXml += `
|
|
||||||
<g:shipping_weight>${parseFloat(product.weight).toFixed(2)} g</g:shipping_weight>`;
|
|
||||||
} else {
|
|
||||||
// Track products without weight
|
// Track products without weight
|
||||||
productsNeedingWeight.push({
|
productsNeedingWeight.push({
|
||||||
id: product.articleNumber || product.seoName,
|
id: product.articleNumber || product.seoName,
|
||||||
name: product.name || 'Unnamed',
|
name: product.name || 'Unnamed',
|
||||||
url: `/Artikel/${product.seoName}`
|
url: `/Artikel/${product.seoName}`
|
||||||
});
|
});
|
||||||
|
skippedCount++;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add weight (we know it exists at this point)
|
||||||
|
productsXml += `
|
||||||
|
<g:shipping_weight>${parseFloat(product.weight).toFixed(2)} g</g:shipping_weight>`;
|
||||||
|
|
||||||
// Add unit pricing data (required by German law for many products)
|
// Add unit pricing data (required by German law for many products)
|
||||||
const unitPricingData = determineUnitPricingData(product);
|
const unitPricingData = determineUnitPricingData(product);
|
||||||
if (unitPricingData.unit_pricing_measure) {
|
if (unitPricingData.unit_pricing_measure) {
|
||||||
|
|||||||
Reference in New Issue
Block a user