$('.load-more-orologi-brand').click(function(){
var row = Number($('#row').val());
var all = Number($('#all').val());
var quante = Number($('#quante').val());
var id_brand = Number($('#id_brand').val());
var order_by = $('#order-by').val();
var venduto = $('#venduto').val();
let next = 0;
next = row * quante;
if(next <= all){
$("#row").val(row);
$.ajax({
url: 'https://www.ccwatchesmc.com/assets/ajax/load-more-orologi.php',
type: 'post',
data: {row:row,all:all,quante:quante,order_by:order_by,id_brand:id_brand,venduto:venduto},
beforeSend:function(){
$('.load-more-orologi-brand').text('Chargement en cours...');
},
success: function(response){
var dati = JSON.parse(response);
const loader = new LoadMore('.lista-orologi');
let immagini = [];
let immagine_zero = '';
let orologio = [];
let label_corredo = '';
let html_referenza = '';
let html_anno = '';
let html_corredo = '';
let html_immagine = '';
let html_copertina = '';
let html_titolo_brand = '';
let html_modello = '';
let html_prezzo = '';
let html_novita = '';
let html_eq_height_modello = '';
let html_eq_height_info = '';
let html_riservato = '';
dati.contenuto.forEach(item => {
const formattatore = new Intl.NumberFormat('nl-NL', {
style: 'currency',
currency: 'EUR'
});
html_titolo_brand = '';
if(typeof item.titolo_brand != "undefined" && item.titolo_brand != null && item.titolo_brand.trim() != ''){
html_titolo_brand = item.titolo_brand;
}
html_modello = '';
if(typeof item.modello != "undefined" && item.modello != null && item.modello.trim() != ''){
html_modello = item.modello;
}
html_referenza = '';
if(typeof item.referenza != "undefined" && item.referenza != null && item.referenza.trim() != ''){
html_referenza = 'Référence: '+item.referenza+'';
}
html_anno = '';
if(typeof item.anno != "undefined" && item.anno != null && item.anno.trim() != ''){
html_anno = 'Année: '+item.anno+'';
}
html_corredo = '';
if(typeof item.corredo != "undefined" && item.corredo != null && item.corredo.trim() != ''){
label_corredo = '';
switch (item.corredo){
case 'orologio_con_scatola_e_documenti_originali':
label_corredo = 'Montre con boîte et papiers d'origine';
break;
case 'orologio_con_documenti_originali':
label_corredo = 'Montre avec papiers d'origine';
break;
case 'orologio_con_scatola_originale':
label_corredo = 'Montre avec boîte d'origine';
break;
}
html_corredo = ''+label_corredo+'';
}
html_prezzo = '';
if(typeof item.prezzo != "undefined" && item.prezzo != null && item.prezzo.trim() != '' && item.prezzo != "0" && item.prezzo != 0 && item.prezzo != "0,0"){
html_prezzo = formattatore.format(item.prezzo);
} else {
html_prezzo = 'Prix sur demande';
}
html_copertina = '';
if(typeof item.copertina != "undefined" && item.copertina != null && item.copertina.trim() != ''){
if(typeof item.immagini != "undefined" && item.immagini != null && item.immagini.trim() != ''){
immagini = JSON.parse(item.immagini);
immagine_zero = immagini[0].immagine;
html_copertina = '
';
html_immagine = '
';
} else {
html_copertina = '
';
}
} else {
if(typeof item.immagini != "undefined" && item.immagini != null && item.immagini.trim() != '') {
immagini = JSON.parse(item.immagini);
immagine_zero = immagini[0].immagine;
html_immagine = '
';
} else {
html_copertina = '
';
}
}
html_novita = '';
if(typeof item.evidenza != "undefined" && item.evidenza != null && item.evidenza.trim() != ''){
if(item.evidenza == 'TRUE'){
html_novita = 'Nouveautés';
}
}
html_riservato = '';
if(typeof item.riservato != "undefined" && item.riservato != null && item.riservato.trim() != ''){
if(item.riservato == 'TRUE'){
html_riservato = 'Réservé';
}
}
if(venduto == 'true'){
html_eq_height_modello = "js-eq-altezza-title-modello-lista-orologi-venduti";
html_eq_height_info = "js-eq-info-lista-orologi-venduti";
} else {
html_eq_height_modello = "js-eq-altezza-title-modello-lista-orologi";
html_eq_height_info = "js-eq-info-lista-orologi";
}
orologio = {
titolo_brand: html_titolo_brand,
modello: html_modello,
referenza: html_referenza,
anno: html_anno,
corredo: html_corredo,
seo_url: item.seo_url,
scopri_di_piu: 'En savoir plus',
prezzo: html_prezzo,
copertina: html_copertina,
immagine: html_immagine,
novita: html_novita,
riservato: html_riservato
};
loader.render('https://www.ccwatchesmc.com/lib/snippets/frontend/tpl/card-orologio.html', orologio);
});
if(venduto){
let js_eq_altezza_title_modello_lista_orologi_venduti = document.querySelector('.js-eq-altezza-title-modello-lista-orologi-venduti');
if (js_eq_altezza_title_modello_lista_orologi_venduti) {
if ($(window).width() > 768) {
e = 0;
$(".js-eq-altezza-title-modello-lista-orologi-venduti").each(function () {
$(this).height() > e && (e = $(this).height())
}
), $(".js-eq-altezza-title-modello-lista-orologi-venduti").height(e)
}
}
let js_eq_info_lista_orologi_venduti = document.querySelector('.js-eq-info-lista-orologi-venduti');
if (js_eq_info_lista_orologi_venduti) {
if ($(window).width() > 768) {
e = 0;
$(".js-eq-info-lista-orologi-venduti").each(function () {
$(this).height() > e && (e = $(this).height())
}
), $(".js-eq-info-lista-orologi-venduti").height(e)
}
}
} else {
let js_eq_altezza_title_modello_lista_orologi = document.querySelector('.js-eq-altezza-title-modello-lista-orologi');
if (js_eq_altezza_title_modello_lista_orologi) {
if ($(window).width() > 768) {
e = 0;
$(".js-eq-altezza-title-modello-lista-orologi").each(function () {
$(this).height() > e && (e = $(this).height())
}
), $(".js-eq-altezza-title-modello-lista-orologi").height(e)
}
}
let js_eq_info_lista_orologi = document.querySelector('.js-eq-info-lista-orologi');
if (js_eq_info_lista_orologi) {
if ($(window).width() > 768) {
e = 0;
$(".js-eq-info-lista-orologi").each(function () {
$(this).height() > e && (e = $(this).height())
}
), $(".js-eq-info-lista-orologi").height(e)
}
}
}
$('.load-more-orologi-brand').text('Charger plus');
$("#row").val(dati.row);
if( (dati.row * quante) >= all){
$('.load-more-orologi-brand').hide();
}
}
});
}else{
}
});