<% var todayDate = Math.round(new Date().getTime()) %>
<% if (recommendations[i].product.categories.indexOf('frenchdays2019') > -1) { %>
<% } %>
<% if (recommendations[i].product.categories.indexOf('soldeshiver2020') > -1 && todayDate > Date.parse('2020-01-08 08:00:00') && todayDate < Date.parse('2020-02-04 23:59:00')) { %>
<% } %>
<% if (recommendations[i].product.categories.indexOf('Black Friday HT') > -1 && todayDate > Date.parse('2019-11-25 08:00:00') && todayDate < Date.parse('2019-12-02 23:59:00')) { %>
<% } %>
<% if (recommendations[i].product.categories.indexOf('Black Friday Electro') > -1 && todayDate > Date.parse('2019-11-25 08:00:00') && todayDate < Date.parse('2019-12-02 23:59:00')) { %>
<% } %>
<% if (recommendations[i].product.categories.indexOf('soldes2020') > -1 && todayDate > Date.parse('2020-07-15 08:00:00') && todayDate < Date.parse('2020-08-11 23:59:00')) { %>
<% } %>
<% if (recommendations[i].product.categories.indexOf('Blackfriday2020HT') > -1 && todayDate > Date.parse('2020-11-30 00:00:00') && todayDate < Date.parse('2020-12-06 23:59:00')) { %>
<% } %>
<% if (recommendations[i].product.categories.indexOf('blackfriday2020PEM') > -1 && todayDate > Date.parse('2020-11-30 00:00:00') && todayDate < Date.parse('2020-12-06 23:59:00')) { %>
<% } %>
<%
var testNull = function(input){
return (typeof input !== 'undefined' && input !== '' && input !== null && input !== 0 && input !== '0');
}
if (testNull(recommendations[i].product.promoType) && testNull(recommendations[i].product.promoAmount) && testNull(recommendations[i].product.promoUnit) && recommendations[i].product.promoType !== 'SANS') {
if (recommendations[i].product.promoType === 'TEL') {
var promoUnit = recommendations[i].product.promoUnit === 'e' ? '€' : '%25';
var imglink = 'https://e-leclerc.scene7.com/is/image/gtinternet/tel-sue?fmt=png-alpha&$hideTEL=0&$entier=' + recommendations[i].product.promoAmount + '&$virgule=%2C&$unite=' + promoUnit + '&$decimale=00';
%>
<% }
if (recommendations[i].product.promoType === 'BRII') {
var promoUnit = recommendations[i].product.promoUnit === 'e' ? '€' : '%';
%>
style="font-size: 15px;"
<% } %>
<% if (recommendations[i].product.promoAmount.toString().length > 5) { %>
style="font-size: 14px;"
<% } %>
>-<%=recommendations[i].product.promoAmount%><%=promoUnit%>
<% } %>
<%}%>
<% if (recommendations[i].product.photo.indexOf('?') === -1) { %>
<% } else { %>
<% } %>
<%
var price = recommendations[i].product.price;
var oldPrice = null;
if (recommendations[i].product.promoType !== null && recommendations[i].product.promoType !== 'TEL' && recommendations[i].product.startingPrice && recommendations[i].product.startingPrice !== 0 && recommendations[i].product.startingPrice !== null){
price = recommendations[i].product.price;
oldPrice = recommendations[i].product.startingPrice;
} else if (recommendations[i].product.promoType !== null && recommendations[i].product.promoType !== 'TEL' && typeof recommendations[i].product.promoAmount !== 'undefined' && recommendations[i].product.promoAmount !== '') {
if (recommendations[i].product.promoUnit) {
if (recommendations[i].product.promoUnit === 'p') {
price = (recommendations[i].product.price * (100 - recommendations[i].product.promoAmount)) / 100;
oldPrice = recommendations[i].product.price;
} else if (recommendations[i].product.promoUnit === 'e') {
price = recommendations[i].product.price - recommendations[i].product.promoAmount;
oldPrice = recommendations[i].product.price;
}
}
} %>
<%= (Math.round(price * 100) / 100).toString().replace('.',',') %> €
<% if (oldPrice !== null) { %>
<%= (Math.round(oldPrice * 100) / 100).toString().replace('.',',') %> €
<% } %>
<% if (recommendations[i].strategy.includes('criteo')) { %>
<% } %>