feat: implement product image saving in prerender-single-product and enhance image loading logic in Images component

This commit is contained in:
sebseb7
2025-07-20 10:46:22 +02:00
parent bffb1fed27
commit 92987a518b
2 changed files with 54 additions and 38 deletions

View File

@@ -88,6 +88,12 @@ const renderSingleProduct = async (productSeoName) => {
const productDetails = await fetchProductDetails(socket, productSeoName);
console.log(`📦 Product found: ${productDetails.product.name}`);
// Save product image to static files
if (productDetails.product) {
console.log(`📷 Saving product image...`);
await saveProductImages(socket, [productDetails.product], "Single Product", config.outputDir);
}
// Set up minimal global cache (empty for single product test)
global.window.productCache = {};
global.productCache = {};