{{:url}}{{/}} {{name}} {{:url}}{{/}}
{{:price_from}}From: ${{price_from}}
{{/}} {{:stars}}{{/}} {{:description}}{{/}} {{:url}} {{/}}{{~exec(function() {
const fullStar = ``;
const emptyStar = ``;
const halfStar = ``;
for (let item of data.items) {
var starsArray = (() => {
const fullStars = Math.floor(item.rating);
const partialStars = item.rating - fullStars;
let returnArray = Array.from({length: fullStars}, () => fullStar);
if (partialStars > 0 && partialStars < 0.7) returnArray.push(halfStar)
else if (partialStars >= 0.7) returnArray.push(fullStar);
if (returnArray.length < 5) {
for (let i = 0; i < 5 - returnArray.length; i++) {
starsArray.push(emptyStar);
}
}
return returnArray;
})();
item.stars = starsArray.join('');
if (item.description && item.description.trim().length) {
item.description = helpers.plugins.stringLib.substringOnWord(helpers.plugins.stringLib.stripHtml(item.description), 180, {ellipsis: true});
}
const imageUrl = item.images?.length ? item.images[0].url : helpers.plugins.sv_site.siteConfig.custom[helpers.plugins.sv_site.site].placeholderImageUrl;
item.asset = {
resource: helpers.plugins.cloudinary.createResource({
imageUrl,
}),
alt_text: item.name
};
}
helpers.var.imageConfig = {
mediaSources: [
{
minScreenSize: '1024px',
imageWidth: 480,
imageHeight: 400,
},
{
minScreenSize: '640px',
imageWidth: 512,
imageHeight: 427,
},
],
mobileImageRatio: {
width: 640,
height: 534,
},
};
})}}
{{+slide}}
From: ${{price_from}}
{{:url}}{{/}}
{{name}}
{{:url}}{{/}}
{{:price_from}}