Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-07-05 20:31:27 +03:00
parent b2113a8d49
commit fbdde54eee
10 changed files with 1383 additions and 144 deletions
+7 -12
View File
@@ -618,14 +618,9 @@ function resolveProductImageUrl(item) {
}
let contentUrl = ''
const imageId = Number(item.id || item.ID || 0)
if (Number.isFinite(imageId) && imageId > 0) {
contentUrl = `/api/product-images/${imageId}/content`
} else {
const contentURL = String(item.content_url || item.ContentURL || '').trim()
if (contentURL.startsWith('/api/')) contentUrl = contentURL
else if (contentURL.startsWith('/')) contentUrl = `/api${contentURL}`
}
const contentURL = String(item.content_url || item.ContentURL || '').trim()
if (contentURL.startsWith('/api/')) contentUrl = contentURL
else if (contentURL.startsWith('/')) contentUrl = `/api${contentURL}`
const uploadsPath = normalizeUploadsPath(item.storage_path || item.storage || '')
let publicUrl = ''
@@ -686,6 +681,9 @@ function clearGalleryQueryIndex() {
async function resolveProductImageUrlForCarousel(item) {
const resolved = resolveProductImageUrl(item)
const directUrl = String(resolved.fullUrl || resolved.thumbUrl || resolved.publicUrl || '').trim()
if (directUrl) return directUrl
const contentUrl = String(resolved.contentUrl || '').trim()
if (contentUrl) {
try {
@@ -700,10 +698,7 @@ async function resolveProductImageUrlForCarousel(item) {
// fall through to public url
}
}
const fullUrl = String(resolved.fullUrl || '').trim()
if (fullUrl) return fullUrl
const publicUrl = String(resolved.publicUrl || '').trim()
return String(publicUrl || fullUrl || contentUrl || '').trim()
return contentUrl
}
function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') {