${function() {
let productData={};
const isTryonList=data[0]||data[1];
let currentFrame={};
let currentImage={};
let frameSku=null;
if(isTryonList)
{
currentFrame=data[1]?.data.framelist?.find(frame=>frame.sku===item.variants[0].sku)||{sku:item.variants[0].sku};
currentImage=data[1]?.data.currentImage||{};
productData={...item};
}else{
productData={...data}
}
let rahmenbreite='';
productData.tags?.split(',')?.forEach(tag=>{
if(tag.includes('Rahmenbreite_'))
{
rahmenbreite=tag.replace('Rahmenbreite_','');
}
});
const force_image_size = "natural";
const product_hover_on = false;
const product_show_sale_label = true;
const product_save_type = "percent";
const badge1 = "";
const badge2 = "";
const badge3 = "";
const product_title_mobile_hide = true;
const product_title_style = "full";
const enable_collection_thumb_image = false;
const variantNames = [];
const thumbMaxNum = 4;
const suffix_id = null || '';
const url = productData.url;
const productId = productData.id;
const price = Number(productData.price);
const productAvailable = productData.available;
const productVariants = productData.variants || [];
const is_collection_page = null;
const type_is_glasses = null || false;
const images = productData.images || [];
const image = productData.image || {};
const imageWidth = image.width;
let imageHeight = image.height;
let image2 = null;
let imageHoverOn = false;
if (force_image_size !== 'natural') {
imageHeight = imageWidth * force_image_size;
}
let compareAtPrice = Number(productData.compare_at_price);
let offRatio = productData.off_ratio;
let discountMaxUrl = url;
const showFrom = productData.price_min != productData.price_max ? true : false;
for (let i = 0; i < productVariants.length; i++) {
const variant = productVariants[i];
if (variant.price == price && compareAtPrice < variant.compare_at_price) {
compareAtPrice = variant.compare_at_price;
offRatio = variant.off_ratio;
variant.available && (discountMaxUrl = variant.url);
}
}
const soldOutText = "Ausverkauft";
let soldOn = false;
let saleOn = false;
if (productAvailable) {
if (product_show_sale_label && price < compareAtPrice) {
saleOn = true;
}
} else {
soldOn = true;
}
const diffPrice = compareAtPrice - price;
const saveLabelContent = product_save_type == 'percent' ? (offRatio + '%') : `
`;
let saveText = "{off_ratio}";
saveText = saveText.replace('{off_ratio}', saveLabelContent);
const productTitle = productData.title;
const heading = "title" === 'subtitle' ? productData.brief : productTitle;
const variantValues = [];
const showVariants = [];
if (productData.need_variant_image && enable_collection_thumb_image && variantNames.length > 0) {
for (let i = 0; i < (productData.options || []).length; i++) {
const option = productData.options[i];
const optionName = option.name.toLowerCase();
if (variantNames.includes(optionName)) {
for (let j = 0; j < productVariants.length; j++) {
const variant = productVariants[j];
const value = variant.options[i].value;
if (!variantValues.includes(value)) {
variantValues.push(value);
showVariants.push(variant);
}
}
break;
}
}
}
return `
`;
}()}