Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-15 22:28:25 +03:00
parent 7e98ea66d2
commit f08bbd5e28
2 changed files with 18 additions and 14 deletions

View File

@@ -490,6 +490,7 @@ function resolvePhotoDim1ID(item) {
item?.ItemDim1Code, item?.ItemDim1Code,
item?.itemDim1Code, item?.itemDim1Code,
item?.ITEMDIM1CODE, item?.ITEMDIM1CODE,
item?.Beden,
item?.RenkID, item?.RenkID,
item?.Renk_Id item?.Renk_Id
] ]
@@ -504,7 +505,8 @@ function resolvePhotoDim3ID(item) {
const candidates = [ const candidates = [
item?.ItemDim3Code, item?.ItemDim3Code,
item?.itemDim3Code, item?.itemDim3Code,
item?.ITEMDIM3CODE item?.ITEMDIM3CODE,
item?.Renk2
] ]
for (const value of candidates) { for (const value of candidates) {
const s = String(value || '').trim() const s = String(value || '').trim()
@@ -580,8 +582,6 @@ function resolveProductImageUrl(item) {
async function resolveProductImageUrlForCarousel(item) { async function resolveProductImageUrlForCarousel(item) {
const resolved = resolveProductImageUrl(item) const resolved = resolveProductImageUrl(item)
const publicUrl = String(resolved.publicUrl || '').trim()
if (publicUrl) return publicUrl
const contentUrl = String(resolved.contentUrl || '').trim() const contentUrl = String(resolved.contentUrl || '').trim()
if (contentUrl) { if (contentUrl) {
try { try {
@@ -596,7 +596,8 @@ async function resolveProductImageUrlForCarousel(item) {
// fall through to public url // fall through to public url
} }
} }
return String(contentUrl || '').trim() const publicUrl = String(resolved.publicUrl || '').trim()
return String(publicUrl || contentUrl || '').trim()
} }
function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') { function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') {
@@ -669,8 +670,8 @@ async function ensureProductImage(code, color, secondColor = '', dim1Id = '', di
const resolved = resolveProductImageUrl(first) const resolved = resolveProductImageUrl(first)
productImageCache.value[key] = resolved.publicUrl || resolved.contentUrl || '' productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
productImageFallbackByKey.value[key] = resolved.publicUrl ? '' : (resolved.contentUrl || '') productImageFallbackByKey.value[key] = resolved.contentUrl || ''
} catch (err) { } catch (err) {
console.warn('[ProductStockByAttributes] product image fetch failed', { code, color, err }) console.warn('[ProductStockByAttributes] product image fetch failed', { code, color, err })
productImageCache.value[key] = '' productImageCache.value[key] = ''
@@ -1152,7 +1153,8 @@ async function openProductCard(grp1, grp2) {
colorCode, colorCode,
secondColor, secondColor,
candidateCount: imageCandidates.length, candidateCount: imageCandidates.length,
imageCount: images.length imageCount: images.length,
firstImages: images.slice(0, 3)
}) })
const uniqueImages = Array.from(new Set(images)) const uniqueImages = Array.from(new Set(images))

View File

@@ -483,6 +483,7 @@ function resolvePhotoDim1ID(item) {
item?.ItemDim1Code, item?.ItemDim1Code,
item?.itemDim1Code, item?.itemDim1Code,
item?.ITEMDIM1CODE, item?.ITEMDIM1CODE,
item?.Beden,
item?.RenkID, item?.RenkID,
item?.Renk_Id item?.Renk_Id
] ]
@@ -497,7 +498,8 @@ function resolvePhotoDim3ID(item) {
const candidates = [ const candidates = [
item?.ItemDim3Code, item?.ItemDim3Code,
item?.itemDim3Code, item?.itemDim3Code,
item?.ITEMDIM3CODE item?.ITEMDIM3CODE,
item?.Renk2
] ]
for (const value of candidates) { for (const value of candidates) {
const s = String(value || '').trim() const s = String(value || '').trim()
@@ -567,8 +569,6 @@ function resolveProductImageUrl(item) {
async function resolveProductImageUrlForCarousel(item) { async function resolveProductImageUrlForCarousel(item) {
const resolved = resolveProductImageUrl(item) const resolved = resolveProductImageUrl(item)
const publicUrl = String(resolved.publicUrl || '').trim()
if (publicUrl) return publicUrl
const contentUrl = String(resolved.contentUrl || '').trim() const contentUrl = String(resolved.contentUrl || '').trim()
if (contentUrl) { if (contentUrl) {
try { try {
@@ -583,7 +583,8 @@ async function resolveProductImageUrlForCarousel(item) {
// fall through to public url // fall through to public url
} }
} }
return String(contentUrl || '').trim() const publicUrl = String(resolved.publicUrl || '').trim()
return String(publicUrl || contentUrl || '').trim()
} }
function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') { function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') {
@@ -653,8 +654,8 @@ async function ensureProductImage(code, color, secondColor = '', dim1Id = '', di
const first = list[0] || null const first = list[0] || null
const resolved = resolveProductImageUrl(first) const resolved = resolveProductImageUrl(first)
productImageCache.value[key] = resolved.publicUrl || resolved.contentUrl || '' productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
productImageFallbackByKey.value[key] = resolved.publicUrl ? '' : (resolved.contentUrl || '') productImageFallbackByKey.value[key] = resolved.contentUrl || ''
} catch (err) { } catch (err) {
console.warn('[ProductStockQuery] product image fetch failed', { code, color, err }) console.warn('[ProductStockQuery] product image fetch failed', { code, color, err })
productImageCache.value[key] = '' productImageCache.value[key] = ''
@@ -1027,7 +1028,8 @@ async function openProductCard(grp1, grp2) {
colorCode, colorCode,
secondColor, secondColor,
candidateCount: imageCandidates.length, candidateCount: imageCandidates.length,
imageCount: images.length imageCount: images.length,
firstImages: images.slice(0, 3)
}) })
const uniqueImages = Array.from(new Set(images)) const uniqueImages = Array.from(new Set(images))