Просмотр исходного кода

fix: correct product name extraction in shoprenter-sync cache storage

- Use productDescriptions[0].name as primary source, with product.name as fallback
- Ensures consistency with qdrant sync logic for proper localized product names
- Fixes null product names in shoprenter_products_cache table
- WebUI will now display correct product names instead of null values

This aligns the cache storage with the same logic used in qdrant sync:
productDesc.name || product.name || null

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fszontagh 4 месяцев назад
Родитель
Сommit
901a7b8ab1
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      supabase/functions/shoprenter-sync/index.ts

+ 5 - 1
supabase/functions/shoprenter-sync/index.ts

@@ -1033,11 +1033,15 @@ serve(wrapHandler('shoprenter-sync', async (req) => {
         const productsToCache = await Promise.all(
           allProductsForCache.map(async (product: any) => {
             const categories = await extractProductCategories(product, categoryCache)
+            // Extract the correct name from productDescriptions (same logic as qdrant sync)
+            const productDesc = product.productDescriptions?.[0] || {}
+            const productName = productDesc.name || product.name || null
+
             return {
               store_id: storeId,
               product_id: product.id,
               inner_id: product.innerId,
-              name: product.name,
+              name: productName,
               sku: product.sku,
               categories: categories,  // Now stores [{ id: "206", name: "Category Name" }]
               excluded: false, // Will be set if in exclusion list