Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-15 22:50:04 +03:00
parent f08bbd5e28
commit 9c76a521c5
3 changed files with 121 additions and 386 deletions

View File

@@ -486,14 +486,7 @@ function resolvePhotoDim3(item, secondColorDisplay = '') {
}
function resolvePhotoDim1ID(item) {
const candidates = [
item?.ItemDim1Code,
item?.itemDim1Code,
item?.ITEMDIM1CODE,
item?.Beden,
item?.RenkID,
item?.Renk_Id
]
const candidates = [item?.ItemDim1Code, item?.itemDim1Code, item?.ITEMDIM1CODE, item?.Beden]
for (const value of candidates) {
const s = String(value || '').trim()
if (/^\d+$/.test(s)) return s
@@ -502,12 +495,7 @@ function resolvePhotoDim1ID(item) {
}
function resolvePhotoDim3ID(item) {
const candidates = [
item?.ItemDim3Code,
item?.itemDim3Code,
item?.ITEMDIM3CODE,
item?.Renk2
]
const candidates = [item?.ItemDim3Code, item?.itemDim3Code, item?.ITEMDIM3CODE, item?.Renk2]
for (const value of candidates) {
const s = String(value || '').trim()
if (/^\d+$/.test(s)) return s
@@ -553,7 +541,7 @@ function normalizeUploadsPath(storagePath) {
function resolveProductImageUrl(item) {
if (!item || typeof item !== 'object') {
return { contentUrl: '', publicUrl: '' }
return { contentUrl: '', publicUrl: '', thumbUrl: '', fullUrl: '' }
}
let contentUrl = ''
@@ -577,11 +565,16 @@ function resolveProductImageUrl(item) {
}
}
return { contentUrl, publicUrl }
const thumbUrl = String(item.thumb_url || item.thumbUrl || '').trim()
const fullUrl = String(item.full_url || item.fullUrl || '').trim()
return { contentUrl, publicUrl, thumbUrl, fullUrl }
}
async function resolveProductImageUrlForCarousel(item) {
const resolved = resolveProductImageUrl(item)
const fullUrl = String(resolved.fullUrl || '').trim()
if (fullUrl) return fullUrl
const contentUrl = String(resolved.contentUrl || '').trim()
if (contentUrl) {
try {
@@ -597,7 +590,7 @@ async function resolveProductImageUrlForCarousel(item) {
}
}
const publicUrl = String(resolved.publicUrl || '').trim()
return String(publicUrl || contentUrl || '').trim()
return String(publicUrl || fullUrl || contentUrl || '').trim()
}
function getProductImageUrl(code, color, secondColor = '', dim1Id = '', dim3Id = '') {
@@ -670,7 +663,7 @@ async function ensureProductImage(code, color, secondColor = '', dim1Id = '', di
const resolved = resolveProductImageUrl(first)
productImageCache.value[key] = resolved.contentUrl || resolved.publicUrl || ''
productImageCache.value[key] = resolved.thumbUrl || resolved.fullUrl || resolved.contentUrl || resolved.publicUrl || ''
productImageFallbackByKey.value[key] = resolved.contentUrl || ''
} catch (err) {
console.warn('[ProductStockByAttributes] product image fetch failed', { code, color, err })