Floor Mirrors | Mirrors | Art (2024)

  • Home
  • Art
  • Mirrors
  • Floor Mirrors

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

Sequoia Leaner Mirror

$999.00

$698.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Floor 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 = $('Floor 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!

    Parker Mirror

    $599.00

    $418.99

  • '); // const $a = $('').attr('href', `${productUrl}?color_id=${color.id}`); // const $img = $('Floor 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 = $('Floor 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!

    Sequoia Floor Mirror

    $999.00

    $698.99

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

    On Sale!

    Shara Art On Floor Mirror

    $1,099.00

    $768.99

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

    On Sale!

    Dakota Mirror

    $599.00

    $418.99

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

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

    Author: Jamar Nader

    Last Updated:

    Views: 6174

    Rating: 4.4 / 5 (75 voted)

    Reviews: 82% of readers found this page helpful

    Author information

    Name: Jamar Nader

    Birthday: 1995-02-28

    Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804

    Phone: +9958384818317

    Job: IT Representative

    Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging

    Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.