Wall Mirrors | Mirrors | Art (2024)

  • Home
  • Art
  • Mirrors
  • Wall Mirrors

'); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Wall Mirrors | Mirrors | Art (1)') // .attr('src', color.value_data ? color.value_data.image_url : '') // .attr('title', color.label) // .attr('alt', color.label); // $a.append($img); // $div.append($a); // $swatchDiv.append($div); // } // }); // } else { // // 如果没有颜色,可以添加一些默认的提示或者留空 // } // // 如果超过五个颜色,添加额外的自定义图片 // if (item.option_values.length > 5) { // const $div = $('

'); // const $moreLink = $('').attr('href', `${productUrl}`); // const $moreImg = $('Wall Mirrors | Mirrors | Art (2)') // .attr('src', '/content/images/more.svg') // .attr('alt', 'more icon'); // $moreLink.append($moreImg); // $div.append($moreLink); // $swatchDiv.append($div); // } // } // } // }); // } // } // }) // .catch(error => { // console.error('Error fetching product colors:', error); // // 从集合中移除当前的 productId,以便在失败后可以重新请求 // requestedProductIds.delete(productId); // }); // } var skuCache = {}; var pendingRequests = {}; function getMainImage(productId, sku) { // Check if the image for this SKU is already cached if (skuCache&&skuCache[sku]) { const imgSrc = skuCache[sku]; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return; // Return early to avoid making a redundant network request } // Check if a request for this SKU is already pending if (pendingRequests[sku]) { // If a request is pending, just wait for it to complete and use the cached value then pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); return; } // If not cached and no pending request, make a new network request pendingRequests[sku] = fetch(`https://websiteapi2.zgallerie.com/website/product/skuImgUrl?sku=${sku}`, { method: "GET" }) .then(response => response.json()) .then(res => { if(res.code==200) { const imgSrc = res.data; // Cache the image URL for the SKU skuCache[sku] = imgSrc; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return imgSrc; // Return the image source to resolve the pending request promise } else { throw new Error("Failed to load image"); } }) .catch(error => { console.error("Error fetching image:", error); }) .finally(() => { // Clean up the pending request entry once it's fulfilled or rejected delete pendingRequests[sku]; }); // Handle the image once the pending request completes pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); } // 页面加载完成后执行的代码 window.onload = function() { }; document.addEventListener('DOMContentLoaded', function () { }); function calculateDiscountPercentage(originalPrice, discountedPrice) { if (originalPrice <= 0 || discountedPrice <= 0) { return "Invalid input. Prices must be greater than zero."; } var discount = originalPrice - discountedPrice; var discountPercentage = discount / originalPrice / 5 * 100 ; return Math.floor(discountPercentage.toFixed(2)) * 5 + "% OFF"; } var requestedSkus = new Set(); // 用于存储已请求的 sku function getBynderImgByNode(sku,productId){ const $cardImgDiv = $(`#card-img-${productId}`); fetch(`https://websiteapi2.zgallerie.com/node/getBynderImagesBySku/${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.length > 0) { res.forEach((item) => { if (item.property_Order && item.property_Order[0] == '1') { $cardImgDiv.attr("src", item.thumbnails.webimage); } if (item.property_Order && item.property_Order[0] == '2') { $cardImgDiv.attr("data-nsrc", item.thumbnails.webimage); } }).catch(error => { console.error('Error fetching bynder images:', error); }); } }) } function getProductListImageBynder(sku, productId) { // 检查 element 是否是一个有效的 DOM 元素 const $cardImgDiv = $(`#card-img-${productId}`); if (requestedSkus.has(sku)) { return; // 已请求过,直接返回 } // 添加 sku 到集合中 requestedSkus.add(sku); fetch(`https://websiteapi2.zgallerie.com/website/product/findBynderImg?skuCode=${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.data && res.data.length > 0) { $cardImgDiv.attr("src",res.data[0].webimage); $cardImgDiv.attr("data-nsrc", res.data[1].webimage); }else { getBynderImgByNode(sku,productId) } }) }

On Sale!

Nikki Chu - Midnight Feather Mirror

$399.00

$278.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Wall Mirrors | Mirrors | Art (4)') // .attr('src', color.value_data ? color.value_data.image_url : '') // .attr('title', color.label) // .attr('alt', color.label); // $a.append($img); // $div.append($a); // $swatchDiv.append($div); // } // }); // } else { // // 如果没有颜色,可以添加一些默认的提示或者留空 // } // // 如果超过五个颜色,添加额外的自定义图片 // if (item.option_values.length > 5) { // const $div = $('

    '); // const $moreLink = $('').attr('href', `${productUrl}`); // const $moreImg = $('Wall Mirrors | Mirrors | Art (5)') // .attr('src', '/content/images/more.svg') // .attr('alt', 'more icon'); // $moreLink.append($moreImg); // $div.append($moreLink); // $swatchDiv.append($div); // } // } // } // }); // } // } // }) // .catch(error => { // console.error('Error fetching product colors:', error); // // 从集合中移除当前的 productId,以便在失败后可以重新请求 // requestedProductIds.delete(productId); // }); // } var skuCache = {}; var pendingRequests = {}; function getMainImage(productId, sku) { // Check if the image for this SKU is already cached if (skuCache&&skuCache[sku]) { const imgSrc = skuCache[sku]; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return; // Return early to avoid making a redundant network request } // Check if a request for this SKU is already pending if (pendingRequests[sku]) { // If a request is pending, just wait for it to complete and use the cached value then pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); return; } // If not cached and no pending request, make a new network request pendingRequests[sku] = fetch(`https://websiteapi2.zgallerie.com/website/product/skuImgUrl?sku=${sku}`, { method: "GET" }) .then(response => response.json()) .then(res => { if(res.code==200) { const imgSrc = res.data; // Cache the image URL for the SKU skuCache[sku] = imgSrc; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return imgSrc; // Return the image source to resolve the pending request promise } else { throw new Error("Failed to load image"); } }) .catch(error => { console.error("Error fetching image:", error); }) .finally(() => { // Clean up the pending request entry once it's fulfilled or rejected delete pendingRequests[sku]; }); // Handle the image once the pending request completes pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); } // 页面加载完成后执行的代码 window.onload = function() { }; document.addEventListener('DOMContentLoaded', function () { }); function calculateDiscountPercentage(originalPrice, discountedPrice) { if (originalPrice <= 0 || discountedPrice <= 0) { return "Invalid input. Prices must be greater than zero."; } var discount = originalPrice - discountedPrice; var discountPercentage = discount / originalPrice / 5 * 100 ; return Math.floor(discountPercentage.toFixed(2)) * 5 + "% OFF"; } var requestedSkus = new Set(); // 用于存储已请求的 sku function getBynderImgByNode(sku,productId){ const $cardImgDiv = $(`#card-img-${productId}`); fetch(`https://websiteapi2.zgallerie.com/node/getBynderImagesBySku/${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.length > 0) { res.forEach((item) => { if (item.property_Order && item.property_Order[0] == '1') { $cardImgDiv.attr("src", item.thumbnails.webimage); } if (item.property_Order && item.property_Order[0] == '2') { $cardImgDiv.attr("data-nsrc", item.thumbnails.webimage); } }).catch(error => { console.error('Error fetching bynder images:', error); }); } }) } function getProductListImageBynder(sku, productId) { // 检查 element 是否是一个有效的 DOM 元素 const $cardImgDiv = $(`#card-img-${productId}`); if (requestedSkus.has(sku)) { return; // 已请求过,直接返回 } // 添加 sku 到集合中 requestedSkus.add(sku); fetch(`https://websiteapi2.zgallerie.com/website/product/findBynderImg?skuCode=${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.data && res.data.length > 0) { $cardImgDiv.attr("src",res.data[0].webimage); $cardImgDiv.attr("data-nsrc", res.data[1].webimage); }else { getBynderImgByNode(sku,productId) } }) }

    On Sale!

    Nikki Chu - Faceted Mirror

    $299.00

    $208.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Wall Mirrors | Mirrors | Art (7)') // .attr('src', color.value_data ? color.value_data.image_url : '') // .attr('title', color.label) // .attr('alt', color.label); // $a.append($img); // $div.append($a); // $swatchDiv.append($div); // } // }); // } else { // // 如果没有颜色,可以添加一些默认的提示或者留空 // } // // 如果超过五个颜色,添加额外的自定义图片 // if (item.option_values.length > 5) { // const $div = $(''); // const $moreLink = $('').attr('href', `${productUrl}`); // const $moreImg = $('Wall Mirrors | Mirrors | Art (8)') // .attr('src', '/content/images/more.svg') // .attr('alt', 'more icon'); // $moreLink.append($moreImg); // $div.append($moreLink); // $swatchDiv.append($div); // } // } // } // }); // } // } // }) // .catch(error => { // console.error('Error fetching product colors:', error); // // 从集合中移除当前的 productId,以便在失败后可以重新请求 // requestedProductIds.delete(productId); // }); // } var skuCache = {}; var pendingRequests = {}; function getMainImage(productId, sku) { // Check if the image for this SKU is already cached if (skuCache&&skuCache[sku]) { const imgSrc = skuCache[sku]; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return; // Return early to avoid making a redundant network request } // Check if a request for this SKU is already pending if (pendingRequests[sku]) { // If a request is pending, just wait for it to complete and use the cached value then pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); return; } // If not cached and no pending request, make a new network request pendingRequests[sku] = fetch(`https://websiteapi2.zgallerie.com/website/product/skuImgUrl?sku=${sku}`, { method: "GET" }) .then(response => response.json()) .then(res => { if(res.code==200) { const imgSrc = res.data; // Cache the image URL for the SKU skuCache[sku] = imgSrc; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return imgSrc; // Return the image source to resolve the pending request promise } else { throw new Error("Failed to load image"); } }) .catch(error => { console.error("Error fetching image:", error); }) .finally(() => { // Clean up the pending request entry once it's fulfilled or rejected delete pendingRequests[sku]; }); // Handle the image once the pending request completes pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); } // 页面加载完成后执行的代码 window.onload = function() { }; document.addEventListener('DOMContentLoaded', function () { }); function calculateDiscountPercentage(originalPrice, discountedPrice) { if (originalPrice <= 0 || discountedPrice <= 0) { return "Invalid input. Prices must be greater than zero."; } var discount = originalPrice - discountedPrice; var discountPercentage = discount / originalPrice / 5 * 100 ; return Math.floor(discountPercentage.toFixed(2)) * 5 + "% OFF"; } var requestedSkus = new Set(); // 用于存储已请求的 sku function getBynderImgByNode(sku,productId){ const $cardImgDiv = $(`#card-img-${productId}`); fetch(`https://websiteapi2.zgallerie.com/node/getBynderImagesBySku/${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.length > 0) { res.forEach((item) => { if (item.property_Order && item.property_Order[0] == '1') { $cardImgDiv.attr("src", item.thumbnails.webimage); } if (item.property_Order && item.property_Order[0] == '2') { $cardImgDiv.attr("data-nsrc", item.thumbnails.webimage); } }).catch(error => { console.error('Error fetching bynder images:', error); }); } }) } function getProductListImageBynder(sku, productId) { // 检查 element 是否是一个有效的 DOM 元素 const $cardImgDiv = $(`#card-img-${productId}`); if (requestedSkus.has(sku)) { return; // 已请求过,直接返回 } // 添加 sku 到集合中 requestedSkus.add(sku); fetch(`https://websiteapi2.zgallerie.com/website/product/findBynderImg?skuCode=${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.data && res.data.length > 0) { $cardImgDiv.attr("src",res.data[0].webimage); $cardImgDiv.attr("data-nsrc", res.data[1].webimage); }else { getBynderImgByNode(sku,productId) } }) }

    On Sale!

    Nikki Chu - Daybreak Feather Mirror

    $399.00

    $278.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Wall Mirrors | Mirrors | Art (10)') // .attr('src', color.value_data ? color.value_data.image_url : '') // .attr('title', color.label) // .attr('alt', color.label); // $a.append($img); // $div.append($a); // $swatchDiv.append($div); // } // }); // } else { // // 如果没有颜色,可以添加一些默认的提示或者留空 // } // // 如果超过五个颜色,添加额外的自定义图片 // if (item.option_values.length > 5) { // const $div = $('

    '); // const $moreLink = $('').attr('href', `${productUrl}`); // const $moreImg = $('Wall Mirrors | Mirrors | Art (11)') // .attr('src', '/content/images/more.svg') // .attr('alt', 'more icon'); // $moreLink.append($moreImg); // $div.append($moreLink); // $swatchDiv.append($div); // } // } // } // }); // } // } // }) // .catch(error => { // console.error('Error fetching product colors:', error); // // 从集合中移除当前的 productId,以便在失败后可以重新请求 // requestedProductIds.delete(productId); // }); // } var skuCache = {}; var pendingRequests = {}; function getMainImage(productId, sku) { // Check if the image for this SKU is already cached if (skuCache&&skuCache[sku]) { const imgSrc = skuCache[sku]; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return; // Return early to avoid making a redundant network request } // Check if a request for this SKU is already pending if (pendingRequests[sku]) { // If a request is pending, just wait for it to complete and use the cached value then pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); return; } // If not cached and no pending request, make a new network request pendingRequests[sku] = fetch(`https://websiteapi2.zgallerie.com/website/product/skuImgUrl?sku=${sku}`, { method: "GET" }) .then(response => response.json()) .then(res => { if(res.code==200) { const imgSrc = res.data; // Cache the image URL for the SKU skuCache[sku] = imgSrc; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return imgSrc; // Return the image source to resolve the pending request promise } else { throw new Error("Failed to load image"); } }) .catch(error => { console.error("Error fetching image:", error); }) .finally(() => { // Clean up the pending request entry once it's fulfilled or rejected delete pendingRequests[sku]; }); // Handle the image once the pending request completes pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); } // 页面加载完成后执行的代码 window.onload = function() { }; document.addEventListener('DOMContentLoaded', function () { }); function calculateDiscountPercentage(originalPrice, discountedPrice) { if (originalPrice <= 0 || discountedPrice <= 0) { return "Invalid input. Prices must be greater than zero."; } var discount = originalPrice - discountedPrice; var discountPercentage = discount / originalPrice / 5 * 100 ; return Math.floor(discountPercentage.toFixed(2)) * 5 + "% OFF"; } var requestedSkus = new Set(); // 用于存储已请求的 sku function getBynderImgByNode(sku,productId){ const $cardImgDiv = $(`#card-img-${productId}`); fetch(`https://websiteapi2.zgallerie.com/node/getBynderImagesBySku/${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.length > 0) { res.forEach((item) => { if (item.property_Order && item.property_Order[0] == '1') { $cardImgDiv.attr("src", item.thumbnails.webimage); } if (item.property_Order && item.property_Order[0] == '2') { $cardImgDiv.attr("data-nsrc", item.thumbnails.webimage); } }).catch(error => { console.error('Error fetching bynder images:', error); }); } }) } function getProductListImageBynder(sku, productId) { // 检查 element 是否是一个有效的 DOM 元素 const $cardImgDiv = $(`#card-img-${productId}`); if (requestedSkus.has(sku)) { return; // 已请求过,直接返回 } // 添加 sku 到集合中 requestedSkus.add(sku); fetch(`https://websiteapi2.zgallerie.com/website/product/findBynderImg?skuCode=${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.data && res.data.length > 0) { $cardImgDiv.attr("src",res.data[0].webimage); $cardImgDiv.attr("data-nsrc", res.data[1].webimage); }else { getBynderImgByNode(sku,productId) } }) }

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Wall Mirrors | Mirrors | Art (13)') // .attr('src', color.value_data ? color.value_data.image_url : '') // .attr('title', color.label) // .attr('alt', color.label); // $a.append($img); // $div.append($a); // $swatchDiv.append($div); // } // }); // } else { // // 如果没有颜色,可以添加一些默认的提示或者留空 // } // // 如果超过五个颜色,添加额外的自定义图片 // if (item.option_values.length > 5) { // const $div = $('

    '); // const $moreLink = $('').attr('href', `${productUrl}`); // const $moreImg = $('Wall Mirrors | Mirrors | Art (14)') // .attr('src', '/content/images/more.svg') // .attr('alt', 'more icon'); // $moreLink.append($moreImg); // $div.append($moreLink); // $swatchDiv.append($div); // } // } // } // }); // } // } // }) // .catch(error => { // console.error('Error fetching product colors:', error); // // 从集合中移除当前的 productId,以便在失败后可以重新请求 // requestedProductIds.delete(productId); // }); // } var skuCache = {}; var pendingRequests = {}; function getMainImage(productId, sku) { // Check if the image for this SKU is already cached if (skuCache&&skuCache[sku]) { const imgSrc = skuCache[sku]; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return; // Return early to avoid making a redundant network request } // Check if a request for this SKU is already pending if (pendingRequests[sku]) { // If a request is pending, just wait for it to complete and use the cached value then pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); return; } // If not cached and no pending request, make a new network request pendingRequests[sku] = fetch(`https://websiteapi2.zgallerie.com/website/product/skuImgUrl?sku=${sku}`, { method: "GET" }) .then(response => response.json()) .then(res => { if(res.code==200) { const imgSrc = res.data; // Cache the image URL for the SKU skuCache[sku] = imgSrc; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return imgSrc; // Return the image source to resolve the pending request promise } else { throw new Error("Failed to load image"); } }) .catch(error => { console.error("Error fetching image:", error); }) .finally(() => { // Clean up the pending request entry once it's fulfilled or rejected delete pendingRequests[sku]; }); // Handle the image once the pending request completes pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); } // 页面加载完成后执行的代码 window.onload = function() { }; document.addEventListener('DOMContentLoaded', function () { }); function calculateDiscountPercentage(originalPrice, discountedPrice) { if (originalPrice <= 0 || discountedPrice <= 0) { return "Invalid input. Prices must be greater than zero."; } var discount = originalPrice - discountedPrice; var discountPercentage = discount / originalPrice / 5 * 100 ; return Math.floor(discountPercentage.toFixed(2)) * 5 + "% OFF"; } var requestedSkus = new Set(); // 用于存储已请求的 sku function getBynderImgByNode(sku,productId){ const $cardImgDiv = $(`#card-img-${productId}`); fetch(`https://websiteapi2.zgallerie.com/node/getBynderImagesBySku/${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.length > 0) { res.forEach((item) => { if (item.property_Order && item.property_Order[0] == '1') { $cardImgDiv.attr("src", item.thumbnails.webimage); } if (item.property_Order && item.property_Order[0] == '2') { $cardImgDiv.attr("data-nsrc", item.thumbnails.webimage); } }).catch(error => { console.error('Error fetching bynder images:', error); }); } }) } function getProductListImageBynder(sku, productId) { // 检查 element 是否是一个有效的 DOM 元素 const $cardImgDiv = $(`#card-img-${productId}`); if (requestedSkus.has(sku)) { return; // 已请求过,直接返回 } // 添加 sku 到集合中 requestedSkus.add(sku); fetch(`https://websiteapi2.zgallerie.com/website/product/findBynderImg?skuCode=${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.data && res.data.length > 0) { $cardImgDiv.attr("src",res.data[0].webimage); $cardImgDiv.attr("data-nsrc", res.data[1].webimage); }else { getBynderImgByNode(sku,productId) } }) }

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Wall Mirrors | Mirrors | Art (16)') // .attr('src', color.value_data ? color.value_data.image_url : '') // .attr('title', color.label) // .attr('alt', color.label); // $a.append($img); // $div.append($a); // $swatchDiv.append($div); // } // }); // } else { // // 如果没有颜色,可以添加一些默认的提示或者留空 // } // // 如果超过五个颜色,添加额外的自定义图片 // if (item.option_values.length > 5) { // const $div = $('

    '); // const $moreLink = $('').attr('href', `${productUrl}`); // const $moreImg = $('Wall Mirrors | Mirrors | Art (17)') // .attr('src', '/content/images/more.svg') // .attr('alt', 'more icon'); // $moreLink.append($moreImg); // $div.append($moreLink); // $swatchDiv.append($div); // } // } // } // }); // } // } // }) // .catch(error => { // console.error('Error fetching product colors:', error); // // 从集合中移除当前的 productId,以便在失败后可以重新请求 // requestedProductIds.delete(productId); // }); // } var skuCache = {}; var pendingRequests = {}; function getMainImage(productId, sku) { // Check if the image for this SKU is already cached if (skuCache&&skuCache[sku]) { const imgSrc = skuCache[sku]; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return; // Return early to avoid making a redundant network request } // Check if a request for this SKU is already pending if (pendingRequests[sku]) { // If a request is pending, just wait for it to complete and use the cached value then pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); return; } // If not cached and no pending request, make a new network request pendingRequests[sku] = fetch(`https://websiteapi2.zgallerie.com/website/product/skuImgUrl?sku=${sku}`, { method: "GET" }) .then(response => response.json()) .then(res => { if(res.code==200) { const imgSrc = res.data; // Cache the image URL for the SKU skuCache[sku] = imgSrc; const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); return imgSrc; // Return the image source to resolve the pending request promise } else { throw new Error("Failed to load image"); } }) .catch(error => { console.error("Error fetching image:", error); }) .finally(() => { // Clean up the pending request entry once it's fulfilled or rejected delete pendingRequests[sku]; }); // Handle the image once the pending request completes pendingRequests[sku].then(imgSrc => { const $cardImgDiv = $(`#card-img-${productId}`); $cardImgDiv.attr("src", imgSrc); }); } // 页面加载完成后执行的代码 window.onload = function() { }; document.addEventListener('DOMContentLoaded', function () { }); function calculateDiscountPercentage(originalPrice, discountedPrice) { if (originalPrice <= 0 || discountedPrice <= 0) { return "Invalid input. Prices must be greater than zero."; } var discount = originalPrice - discountedPrice; var discountPercentage = discount / originalPrice / 5 * 100 ; return Math.floor(discountPercentage.toFixed(2)) * 5 + "% OFF"; } var requestedSkus = new Set(); // 用于存储已请求的 sku function getBynderImgByNode(sku,productId){ const $cardImgDiv = $(`#card-img-${productId}`); fetch(`https://websiteapi2.zgallerie.com/node/getBynderImagesBySku/${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.length > 0) { res.forEach((item) => { if (item.property_Order && item.property_Order[0] == '1') { $cardImgDiv.attr("src", item.thumbnails.webimage); } if (item.property_Order && item.property_Order[0] == '2') { $cardImgDiv.attr("data-nsrc", item.thumbnails.webimage); } }).catch(error => { console.error('Error fetching bynder images:', error); }); } }) } function getProductListImageBynder(sku, productId) { // 检查 element 是否是一个有效的 DOM 元素 const $cardImgDiv = $(`#card-img-${productId}`); if (requestedSkus.has(sku)) { return; // 已请求过,直接返回 } // 添加 sku 到集合中 requestedSkus.add(sku); fetch(`https://websiteapi2.zgallerie.com/website/product/findBynderImg?skuCode=${sku}`, { method: "GET" }).then(response => response.json()) .then(res => { if (res && res.data && res.data.length > 0) { $cardImgDiv.attr("src",res.data[0].webimage); $cardImgDiv.attr("data-nsrc", res.data[1].webimage); }else { getBynderImgByNode(sku,productId) } }) }

    Wall Mirrors | Mirrors | Art (2024)
    Top Articles
    Latest Posts
    Recommended Articles
    Article information

    Author: Rubie Ullrich

    Last Updated:

    Views: 6168

    Rating: 4.1 / 5 (72 voted)

    Reviews: 95% of readers found this page helpful

    Author information

    Name: Rubie Ullrich

    Birthday: 1998-02-02

    Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

    Phone: +2202978377583

    Job: Administration Engineer

    Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

    Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.