';
} else {
swatchesHtml += '
';
}
swatchFocusHandler = 'klevu_commons.updateProductThumbnailImage(\'' + escape(currentSwatch.image) + '\', \'klevuProductImage-' + product.id + '\');';
swatchBlurHandler = 'klevu_commons.updateProductThumbnailImage(\'' + escape(product.productImage) + '\', \'klevuProductImage-' + product.id + '\');';
if (klevu_commons.isMobileDevice()) {
swatchEventHandlerHtml = ' onclick = "' + swatchFocusHandler + '" ';
} else {
swatchEventHandlerHtml = ' onmouseleave = "' + swatchBlurHandler + '" onmouseenter = "' + swatchFocusHandler + '" ';
}
swatchesHtml += '
';
swatchesHtml += '';
} else {
swatchCount += 1;
}
}
if (product.swatches.swatch.length > totalSwatchesToShow) {
swatchCount += product.swatches.swatch.length - totalSwatchesToShow;
}
if (!swatchesShown) {
swatchesHtml = '
' + swatchesHtml;
} else {
swatchesHtml = '
' + swatchesHtml;
}
swatchCount += (product.swatches.numberOfAdditionalVariants ? +(product.swatches.numberOfAdditionalVariants) : 0);
if (swatchCount > 0 && swatchesShown) {
swatchesHtml += '
';
}
swatchesHtml += '
';
toReturn += swatchesHtml;
}
} catch (e) {}
if ('undefined' !== typeof klevu_showDiscountBadge &&
klevu_showDiscountBadge && product.discount != '' &&
product.discount != '0' && product.discount != '0.0') {
if (klevu_uiLabels.discountBadgeText.indexOf("#") === -1) {
toReturn += '
' +
klevu_uiLabels.discountBadgeText + ' ' +
Number(product.discount).toFixed(0) +
'%
';
} else {
toReturn += '
' +
klevu_uiLabels.discountBadgeText.replace("#", Number(product.discount).toFixed(0) + "%") +
'
';
}
}
toReturn += '
';
toReturn += '
';
toReturn += '
' + product.productDescription + '
';
if (product.rating.trim().length > 0 && !isNaN(Number(product.rating)) &&
Number(product.rating) <= 5 && Number(product.rating) >= 0) {
var starWidth = 20 * Number(product.rating);
toReturn += '';
}
toReturn += '
';
toReturn += '
';
if (klevu_showPrices ) {
if (klevu_userOptions.showOnlyOriginalAndSalePrices ) {
if (!klevuHidePrice) {
toReturn += klevu_commons.showOriginalAndSalePrices('LANDING', product, salepriceClass, 'kuSalePrice kuSpecialPrice');
}
} else {
if (!klevuHidePrice) {
toReturn += klevu_commons.showProductPrices('LANDING', product, salepriceClass, 'kuSalePrice kuSpecialPrice');
}
}
}
if (klevu_userOptions.vatCaption.trim().length > 0) {
toReturn += '
(' + klevu_userOptions.vatCaption + ')
';
}
if (product.totalProductVariants && product.totalProductVariants != '0' && !swatchesShown) {
if (klevu_uiLabels.variants.indexOf("#") === -1) {
toReturn += '
+' + product.totalProductVariants +
' ' + klevu_uiLabels.variants + '
';
} else {
toReturn += '
' +
klevu_uiLabels.variants.replace("#", product.totalProductVariants) + '
';
}
}
if (klevu_userOptions.outOfStockCaption.trim().length > 0) {
if ((product.inStock) && product.inStock === 'no') {
toReturn += '
' +
klevu_userOptions.outOfStockCaption + '
';
}
}
toReturn += '
';
if (klevu_commons.showAddToCartButton(product.inStock, product.hideAddToCart)) {
if (!(product.isCustomOptionsAvailable && product.isCustomOptionsAvailable === "yes") &&
(!product.totalProductVariants || product.totalProductVariants == '0')) {
toReturn += '
';
} else {
toReturn += '
';
}
toReturn += '
';
}
toReturn += '
';
toReturn += '';
return toReturn;
},
showProductData: function (product) {
var toReturn = '',
priceWithCurrency = '',
appendCurrencyAtLast = false,
salepriceClass = 'klevu-saleprice',
additionalParams = '',
priceFormatter,
priceToSet,
showToLabel = false,
trackingParams = "",
klevuHidePrice;
product = klevu_productCustomizations(product);
klevuHidePrice = typeof product.klevu_hide_price !== 'undefined' && product.klevu_hide_price.toLowerCase() === 'hide price' ? true : false;
if (product.productImage.trim().length === 0) {
product.productImage = klevu_userOptions.noImageUrl;
}
if (klevu_userOptions.openProductClicksInNewWindow) {
additionalParams = ' target="_blank"';
} else {
additionalParams = ' onclick="klevu_analytics.stopClickDefault( event );"';
}
trackingParams = '{' +
'data: {' +
'code: \'' + escape(product.productCode) + '\',' +
'url: \'' + escape(product.productUrl) + '\',' +
'name: \'' + escape(product.productName) + '\',' +
'salePrice: \'' + escape(product.salePrice) + '\',' +
'rating: \'' + escape(product.rating) + '\',' +
'position: ' + product.productPosition + ',' +
'category: \'' + escape(product.category) + '\'' +
'}' +
'}';
toReturn += '
';
toReturn += '';
} else {
toReturn += ' onmousedown="return klevu_analytics.trackClickedProduct(event, ' + trackingParams + ');" ' +
additionalParams + ' >';
}
toReturn += '';
if ('undefined' !== typeof klevu_showDiscountBadge &&
klevu_showDiscountBadge && product.discount != '' &&
product.discount != '0' && product.discount != '0.0') {
if (klevu_uiLabels.discountBadgeText.indexOf("#") === -1) {
toReturn += '' +
klevu_uiLabels.discountBadgeText + ' ' + Number(product.discount).toFixed(0) +
'%
';
} else {
toReturn += '' +
klevu_uiLabels.discountBadgeText.replace("#", Number(product.discount).toFixed(0) + "%") +
'
';
}
}
toReturn += '' +
'
' + product.productName + '
' +
'
' + product.productDescription + '
';
if (product.rating.trim().length > 0 && !isNaN(Number(product.rating)) &&
Number(product.rating) <= 5 && Number(product.rating) >= 0) {
var starWidth = 20 * Number(product.rating);
toReturn += '
';
}
toReturn += '
';
toReturn += '';
if (klevu_showPrices) {
if (klevu_userOptions.showOnlyOriginalAndSalePrices) {
if (!klevuHidePrice) {
toReturn += klevu_commons.showOriginalAndSalePrices('BASIC', product, salepriceClass, 'klevu-saleprice klevu-special-price');
}
} else {
if (!klevuHidePrice) {
toReturn += klevu_commons.showProductPrices('BASIC', product, salepriceClass, 'klevu-saleprice klevu-special-price');
}
}
}
if (klevu_userOptions.vatCaption.trim().length > 0) {
toReturn += '
(' +
klevu_userOptions.vatCaption + ')
';
}
if (product.totalProductVariants && product.totalProductVariants != '0') {
toReturn += '
+' +
product.totalProductVariants + ' ' +
klevu_uiLabels.variants + '
';
}
if (klevu_userOptions.outOfStockCaption.trim().length > 0) {
if ((product.inStock) && product.inStock === 'no') {
toReturn += '
' +
klevu_userOptions.outOfStockCaption + '
';
}
}
toReturn += '
';
toReturn += '';
toReturn += '';
if (klevu_commons.showAddToCartButton(product.inStock, product.hideAddToCart)) {
if (!(product.isCustomOptionsAvailable && product.isCustomOptionsAvailable === "yes") &&
(!product.totalProductVariants || product.totalProductVariants == '0')) {
if (klevu_userOptions.fullpageLayoutEnabled) {
toReturn += '' +
klevu_userOptions.addToCartButton + '';
} else {
toReturn += '';
}
} else {
if (klevu_userOptions.fullpageLayoutEnabled) {
toReturn += '' +
klevu_userOptions.addToCartButton + '';
} else {
toReturn += '';
}
}
toReturn += '';
}
toReturn += '';
return toReturn;
}
}