Fix product performance grouped JSON build
This commit is contained in:
@@ -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 = '') {
|
||||
|
||||
Reference in New Issue
Block a user