Mirrors | Décor | Z Gallerie (2024)

  • Home
  • Art
  • Mirrors

'); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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!

Sequoia Leaner Mirror

$999.00

$698.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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 - Midnight Feather Mirror

    $399.00

    $278.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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 - Faceted Mirror

    $299.00

    $208.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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) } }) }

    On Sale!

    Nikki Chu - Daybreak Feather Mirror

    $399.00

    $278.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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 = $('Mirrors | Décor | Z Gallerie (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) } }) }

    Mirrors | Décor | Z Gallerie (2024)
    Top Articles
    Latest Posts
    Recommended Articles
    Article information

    Author: Lilliana Bartoletti

    Last Updated:

    Views: 6170

    Rating: 4.2 / 5 (73 voted)

    Reviews: 80% of readers found this page helpful

    Author information

    Name: Lilliana Bartoletti

    Birthday: 1999-11-18

    Address: 58866 Tricia Spurs, North Melvinberg, HI 91346-3774

    Phone: +50616620367928

    Job: Real-Estate Liaison

    Hobby: Graffiti, Astronomy, Handball, Magic, Origami, Fashion, Foreign language learning

    Introduction: My name is Lilliana Bartoletti, I am a adventurous, pleasant, shiny, beautiful, handsome, zealous, tasty person who loves writing and wants to share my knowledge and understanding with you.