/* SHOP.JS.PHP*/
$(document).on('submit','#menuLoginForm',
function ()
{
$('#menuLoginForm .loginInfo').show();
$('#menuLoginForm .loginLoader').show();
$('#menuLoginForm .loginFailed').hide();
$('#btnMenuLoginSubmit').attr('disabled', true);
$.ajax({
type: 'POST',
url: 'https://www.werbekollektion.de/',
data: $('#menuLoginForm').serialize(),
success:
function(text)
{
if(text=='failed')
{
$('#menuLoginForm .loginLoader').hide();
$('#menuLoginForm .loginFailed').show();
$('#menuLoginForm .loginFailed').html('Login gescheitert - Bitte prüfen Sie die Eingabe und versuchen es erneut.');
$('#btnMenuLoginSubmit').attr('disabled', false);
}
else
{
top.location.href = text; //'http://ts.ic.de/schilderstyle.de/schilderstyle/cms.php?sp=kundenkonto';
}
//alert(text);
},
error:
function(text)
{
$('#menuLoginForm .loginLoader').hide();
$('#menuLoginForm .loginFailed').show();
$('#menuLoginForm .loginFailed').html('Verbindungsfehler zum Server - Bitte probieren Sie es erneut.');
$('#btnMenuLoginSubmit').attr('disabled', false);
}
});
return false;
});
/** LOGIN MENU EVENTS (DESKTOP VERSION) **/
//$(document).on('mouseover', '.showUserPanel,.showUserPanelLogged', function () {
//
// if($('.userPanel').is(':visible')) {} else { menuFadeIn(); }
//});
$(document).on('click', '.showUserPanel,.showUserPanelLogged', function () {
//if($('.userPanel').is(':visible') && $('.userPanel').css('opacity')==1) { menuFadeOut(); }
//else { menuFadeIn(); }
if($('.userPanel').is(':visible')) { $('.userPanel').hide(); }
else { $('.userPanel').show(); }
});
//$(document).mouseup(function(e)
//{
// var cparent = $('.showUserPanel');
// var container = $('.userPanel');
// if(!container.is(e.target) && container.has(e.target).length === 0 && !cparent.is(e.target)) { menuFadeOut(); }
//});
function menuFadeOut()
{
$('.userPanel').fadeOut({queue: false, duration: 'medium'});
$('.userPanel').animate({ top: "180px" }, 'slow');
}
function menuFadeIn()
{
$('.userPanel').fadeIn({queue: false, duration: 'medium'});
$('.userPanel').animate({ top: "140px", opacity:1 }, 'medium');
}
$(document).on('change','#b2b_mode',
function ()
{
var mode = $(this).prop('checked')===true ? 1 : 0;
//replace_param_and_reload('chgStoreMode',mode);
setB2BstoreMode(mode)
});
$(document).on('click','.setStoreMode', function()
{
var mode = $(this).data('id')==1 ? 1 : 0;
setB2BstoreMode(mode);
});
function setB2BstoreMode(mode)
{
$.ajax({type: "GET", url: "https://www.werbekollektion.de/scripts/shop.warenkorb-io.php", data: { com: 'setStoreMode', id: mode }}).done(function(ex)
{
location.reload();
}).fail(function(err) { console.log(err); });
}
//function replace_param_and_reload(name, value)
//{
// var str = location.search;
// if (new RegExp("[&?]"+name+"([=&].+)?$").test(str)) {
// str = str.replace(new RegExp("(?:[&?])"+name+"[^&]*", "g"), "");
// }
// str += "&";
// str += name + "=" + value;
// str = "?" + str.slice(1);
// location.assign(location.origin + location.pathname + str + location.hash);
//}
/** SEEMS TO BE OLD CODE FROM EPRINDO WITH ENHANCED ERROR HANDLING **/
/** CURRENT EVENTS FOR REGISTER + LOGIN IN shop.customer.php **/
$(document).on('submit','#loginForm',
function ()
{
$('#registerFormError').hide();
$('#loginFormError').hide();
$('#btnLoginFormSubmit').attr('disabled', true);
$.ajax({ type: 'POST',
url: 'https://www.werbekollektion.de/login/',
data: $('#loginForm').serialize(),
success:
function(text)
{
if(text=='0')
{
$('#loginFormError .msg').html('Login fehlgeschlagen
- Bitte überprüfen Sie E-Mail-Adresse und Passwort.');
$('#loginFormError').show();
$('#btnLoginFormSubmit').attr('disabled', false);
}
else
{
//alert($('#loginReturnUrl').val());
top.location.href = $('#loginReturnUrl').val();
}
},
error:
function (text)
{
$('#loginFormError .msg').html('Verbindungsfehler zum Server
Bitte probieren Sie es noch einmal.');
$('#loginFormError').show();
$('#btnLoginFormSubmit').attr('disabled', false);
}
});
return false;
});
$(document).on('submit','#registerForm',
function ()
{
$('#registerFormError').hide();
$('#loginFormError').hide();
$('#btnRegisterFormSubmit').attr('disabled', true);
$.ajax({ type: 'POST',
url: 'https://www.werbekollektion.de/login/',
data: $('#registerForm').serialize(),
success:
function(text)
{
//alert(text);
if(text!='1')
{
var errmess='';
switch(text)
{
case '2': errmess='- Bitte geben Sie E-Mailadresse und die Passwörter ein.'; break;
case '3': errmess='- Die angegebene E-Mailadresse ist ungültig.'; break;
case '4': errmess='- Für diese E-Mailadresse existiert bereits ein Konto.'; break;
case '5': errmess='- Das Passwort stimmt nicht mit der Wiederholung überein.'; break;
}
$('#registerFormError .msg').html('Login fehlgeschlagen
' + errmess);
$('#registerFormError').show();
$('#btnRegisterFormSubmit').attr('disabled', false);
}
else
{
top.location.href = $('#registerReturnUrl').val();
}
},
error:
function (text)
{
$('#registerFormError .msg').html('Verbindungsfehler zum Server
Bitte probieren Sie es noch einmal.');
$('#registerFormError').show();
$('#btnRegisterFormSubmit').attr('disabled', false);
}
});
return false;
});
/** AMAZON FAKE BUTTON **/
$(document).on('click', '.amazonButtonFake', function(event)
{
$('#LoginWithAmazon img').trigger('click');
});
$(document).on('submit','#pwdRestoreForm',
function ()
{
//alert($('#pwdRestoreForm').serialize());
$('.msgOk').hide();
$('.msgError').hide();
$('#btnLoginFormSubmit').attr('disabled', true);
$.ajax({ type: 'POST',
url: 'https://www.werbekollektion.de/scripts/shop.kundenkonto-io.php',
data: $('#pwdRestoreForm').serialize(),
success:
function(text)
{
var regex = new RegExp("^(http|https).*");
if(!regex.test(text))
{ $('#formError').html(text);
$('.msgError').show();
$('html,body').animate({scrollTop: $('.pwdTitle').offset().top}, 'slow');
//alert(text);
$('#btnLoginFormSubmit').attr('disabled', false);
}
else
{
top.location.href = text;
}
},
error:
function (text)
{
$('#formError').html('Verbindungsfehler zum Server
Bitte probieren Sie es noch einmal.');
$('.msgError').show();
$('html,body').animate({scrollTop: $('.pwdTitle').offset().top}, 'slow');
$('#btnLoginFormSubmit').attr('disabled', false);
}
});
return false;
});
$(document).ready(function()
{
/** FILTER SUBMIT EVENTS**/
$('#catoby,#catppp').on('change', function() { resetPage(); removeEmptyFilter(); $('#catform').submit(); });
$('#catasc').on('click', function() { if($('#catoasc').val()==1) { $('#catoasc').val('0'); } else { $('#catoasc').val('1'); } removeEmptyFilter(); $('#catform').submit(); });
$('.catmf').on('click', function() { $('#mf').val($(this).val()); resetPage(); removeEmptyFilter(); $('#catform').submit(); });
$('.catmfremove').on('click', function() { $('#mf').val(''); resetPage(); removeEmptyFilter(); $('#catform').submit(); });
$('.catcolor').on('click', function() { $('#color').val($(this).val()); resetPage(); removeEmptyFilter(); $('#catform').submit(); });
$('.catcolorrem').on('click', function() { $('#color').val(''); resetPage(); removeEmptyFilter(); $('#catform').submit(); });
$('.catResetFilter').on('click',function() { resetPage(); resetFilter(); $('#catform').submit(); });
$('#pfilter').on('change', function() { $('#pfs').val(1); removeEmptyFilter(); $('#catform').submit(); });
$('.pfilterrem').on('click', function() { $('#pfs').prop('disabled',true); $('#pfilter').prop('disabled',true); removeEmptyFilter(); $('#catform').submit(); });
$('.setPage').on('click',function() { $('#page').val($(this).data('id')); removeEmptyFilter(); $('#catform').submit(); });
$('.setNewSearch').on('click',function() { resetPage(); resetFilter(); $('#catform').submit(); });
/** SORT **/
$('.sortMenuChoice').on('click', function()
{
$('.pageMenu').hide();
if($('.sortMenu').is(':hidden')) { $('.sortMenu').fadeIn('medium'); }
else { $('.sortMenu').fadeOut('medium'); }
});
$('.sortMode').on('click', function() {
var id = $(this).data('id');
var asc = $(this).data('asc');
$('#catoby option[value="'+id+'"]').attr('selected', 'selected');
$('#catoasc').val(asc);
$('#catoby').trigger('change');
});
/** PAGE **/
$('.pageMenuChoice').on('click', function()
{
$('.sortMenu').hide();
if($('.pageMenu').is(':hidden')) { $('.pageMenu').fadeIn('medium'); }
else { $('.pageMenu').fadeOut('medium'); }
});
$('.pageMode').on('click', function() {
var amount = $(this).data('amount');
$('#catppp option[value="'+amount+'"]').attr('selected', 'selected');
$('#catppp').trigger('change');
});
/** RESP FILTER BUTTON / SMALL **/
$('#searchCatFilterButton').on('click', function()
{
if($('.searchCatFilterBlock').is(':visible'))
{
$('.searchCatFilterBlock').hide();
$('#searchCatFilterButton').text('Filter anzeigen');
}
else
{
$('.searchCatFilterBlock').show();
$('#searchCatFilterButton').text('Filter ausblenden');
}
});
});
/** SET PAGE TO 0 **/
function resetPage()
{
$('#page').val(0);
}
/** REMOVE EMPTY FILTER SO THE WONt APPEARE IN QUERY_STRING **/
function resetFilter()
{
$('#mf').prop('disabled',true);
$('#color').prop('disabled',true);
$('#pfilter').prop('disabled',true);
$('#pfs').prop('disabled',true);
}
/** REMOVE EMPTY FILTER SO THE WONt APPEARE IN QUERY_STRING **/
function removeEmptyFilter()
{
if($('#mf').val()!='' && $('#mf').val().length==0) { $('#mf').prop('disabled',true); }
if($('#color').val()!='' && $('#color').val().length==0) { $('#color').prop('disabled',true); }
if($('#pfilter').val()!='' && $('#pfilter').val().length==0) { $('#pfilter').prop('disabled',true); }
}
$(document).ready(function()
{
/** SEND ANFRAGE **/
$('#anfrageform').on('submit', function(e)
{
e.preventDefault();
$('#anfrageform .loader3').show();
$('#anfrageform .sentAnfrageButtonLoaderText').hide();
$('#sent-anfrage').prop('disabled',true);
setTimeout(function() {
$('.messAreaMsg').html(" Ihre Anfrage wird übertragen...");
var error=0; var errmess='Bitte füllen Sie Pflichfelder aus, um die Anfrage abzuschicken.';
/** inline error check **/
if($('#iqname').val().length=='') { error = 1; $('.ffiqname strong').css('color','#bb0000'); } else { $('.ffiqname strong').css('color','#000000'); }
if($('#iqmail').val().length=='') { error = 1; $('.ffiqmail strong').css('color','#bb0000'); } else { $('.ffiqmail strong').css('color','#000000'); }
//if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test($('#iqmail').val())) { $('.ffiqmail').css('color','#000000'); }
if(/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/.test($('#iqmail').val())) { $('.ffiqmail').css('color','#000000'); }
else { error = 1; errmess = "Bitte überprüfen Sie die angegebene E-Mail-Adresse. Diese ist ungültig!"; $('.ffiqmail').css('color','#bb0000'); }
if($('#iqphone').val().length=='') { error = 1; $('.ffiqphone').html('Ihre Telefonnummer*:'); } else { $('.ffiqphone strong').css('color','#000000'); }
//if($('#iqrequest').val().length=='') { error = 1; $('.ffiqrequest').html('Ihre Anfrage*:'); } else { $('.ffiqrequest strong').css('color','#000000'); }
if($("#iqimages")[0].files[0] && $("#iqimages")[0].files[0].size>0)
{
var fn = $("#iqimages")[0].files[0].name; //.substr(($("#iqimages")[0].files[0].name.lastIndexOf('.') +1));
var pe = fn.substr((fn.lastIndexOf(".") +1));
var ext = pe.toLowerCase();
//console.log(ext);
//if($("#iqimages")[0].files[0].size>2097152)
//if($("#iqimages")[0].files[0].size>4194304)
if($("#iqimages")[0].files[0].size>8388608)
{
error=1;
errmess = "Die angegebene Datei ist größer als 8MB. Bitte beachten Sie die maximale Dateigröße.";
}
else if(ext!='eps' && ext!='jpg' && ext!='jpeg' && ext!='png' && ext!='pdf' && ext!='svg')
{
error=1;
errmess = "Derzeit können nur Dateien vom Typ \"EPS\", \"JPEG\", \"PNG\", \"PDF\" und \"SVG\" heraufgeladen werden.";
}
}
if(error==0)
{
var xhr = new XMLHttpRequest();
xhr.open('post', 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', true);
xhr.onload = function() { } //console.log('Upload erfolgreich beendet!');
xhr.onreadystatechange = function ()
{
if(xhr.readyState == 4 && xhr.status == 200)
{
if(xhr.responseText.length > 0)
{
data = JSON.parse(xhr.responseText);
var price = JSON.parse(data.price_array);
var product = JSON.parse(data.product);
//console.log(price.price);
//console.log(price);
//console.log(product);
$('#anfrageformfill').hide();
//$('#anfrageok').show();
//if(typeof gtag == 'function' ) { gtag("event", "generate_lead", {"currency": "EUR", "value": price.price,"lead_source": "Anfrageformular"}); }
$('#iqname').val('');
$('#iqmail').val('');
$('#iqphone').val('');
$('#iqimages').val('');
$('#messagearea').show()
$('#messageerror').hide()
//$('#anfrageform .loader3').hide();
//$('#anfrageform .sentAnfrageButtonLoaderText').show();
//$('#sent-anfrage').prop('disabled',false);
window.location.href = 'https://www.werbekollektion.de/anfrage-abgeschickt/';
}
else
{
$('#messagearea').hide()
$('#messageerror').html("Es ist ein Fehler aufgetreten:
"+ xhr.responseText +"");
$('#messageerror').show();
$('#anfrageform .loader3').hide();
$('#anfrageform .sentAnfrageButtonLoaderText').show();
$('#sent-anfrage').prop('disabled',false);
}
}
return false;
}
var formData = new FormData();
formData.append('com', 'sendAnfrage');
//formData.append('pid', $('#apid').val());
formData.append('pid', $('#aprodid').val());
formData.append('pname', $('#apname').val());
formData.append('pmenge', $('#qty').val());
formData.append('pveredelung', $('#vmethod option:selected').text());
formData.append('pveredelung_id', $('#vmethod option:selected').val());
formData.append('pposition', $('#vposition option:selected').text());
formData.append('pposition_id', $('#vposition option:selected').val());
formData.append('pcolor', $('#vcolor option:selected').text());
formData.append('pcolor_id', $('#vcolor option:selected').val());
formData.append('pmuster', $('#muster option:selected').text());
formData.append('pmuster_id', $('#muster option:selected').val());
formData.append('peinzeldata', $('#einzeldata').val());
formData.append('peinzelfont', $('#einzelfont').val());
formData.append('pdruckflaechen', $('#druckflaechen').val());
formData.append('iqname', $('#iqname').val());
formData.append('iqmail', $('#iqmail').val());
formData.append('iqphone', $('#iqphone').val());
formData.append('iqeinzeldata', $('#iqeinzeldata').val());
formData.append('iqrequest', $('#iqrequest').val());
formData.append('iqimages', $("#iqimages")[0].files[0]);
formData.append('iqentwurf', $(".imgDBAnfrage").data('fileraw'));
formData.append('adClickID', $('#adClickID').val());
xhr.send(formData);
}
else
{
$('#messagearea').hide()
$('#messageerror').html("Es ist ein Fehler aufgetreten:
"+ errmess +"");
$('#messageerror').show();
$('#anfrageform .loader3').hide();
$('#anfrageform .sentAnfrageButtonLoaderText').show();
$('#sent-anfrage').prop('disabled',false);
}
}, 500);
return false;
});
});
$('#anfrage-close').on('click', function(e)
{
anfrageWin.close();
});
/** CREATE ANGEBOT **/
$('#create-angebot').on('click', function(e)
{
$('.loaderAngebot').show();
$('.createAngebotText').hide();
var xhr = new XMLHttpRequest();
xhr.open('post', 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', true);
xhr.onload = function() { //console.log('Upload erfolgreich beendet!');
}
xhr.onreadystatechange = function ()
{
if(xhr.readyState == 4 && xhr.status == 200)
{
if(xhr.responseText.length > 0)
{
data = JSON.parse(xhr.responseText);
var price = JSON.parse(data.price_array);
var product = JSON.parse(data.product);
//console.log(data);
//console.log(price.price);
//console.log(price);
//console.log(product);
$('.loaderAngebot').hide();
$('.createAngebotText').show();
if(typeof gtag == 'function' ) { gtag("event", "generate_lead", {"currency": "EUR", "value": price.price, "lead_source":"PDF Angebot"}); }
// EMULATE CLICK TO OFFER.PDF
var hash = guidGenerator();
var link = document.createElement('a');
link.href = data.url + 'xuser/uploads/angebot.pdf?hs=' + hash;
link.target = '_blank';
//link.download = '../xuser/upload/angebot.pdf';
link.download = 'Online-Angebot.pdf';
link.dispatchEvent(new MouseEvent('click'));
}
}
return false;
}
var formData = new FormData();
formData.append('com', 'createAngebot');
formData.append('pid', $('#aprodid').val());
formData.append('pmenge', $('#qty').val());
formData.append('pveredelung', $('#vmethod option:selected').text());
formData.append('pveredelung_id', $('#vmethod option:selected').val());
formData.append('pposition', $('#vposition option:selected').text());
formData.append('pposition_id', $('#vposition option:selected').val());
formData.append('pcolor', $('#vcolor option:selected').text());
formData.append('pcolor_id', $('#vcolor option:selected').val());
formData.append('pmuster', $('#muster option:selected').text());
formData.append('pmuster_id', $('#muster option:selected').val());
formData.append('peinzeldata', $('#einzeldata').val());
formData.append('peinzelfont', $('#einzelfont').val());
formData.append('pdruckflaechen', $('#druckflaechen').val());
xhr.send(formData);
return false;
});
$(document).ready(function()
{
/** ADD TO BASKET **/
$('#addToBasket').on('click', function()
{
/** DISABLE BUTTON **/
$('#addToBasket').attr('disabled',true);
$('.loaderBasket').show();
$('.addToBasketButtonText').hide();
/** GET ENTWURF **/
var jsondata='';
var pngdata='';
var uploadfile='';
if($('#lcWorkFile').val()!='')
{
var jsondata = JSON.stringify(canvas);
var pngdata = saveImageAs('png');
var parent = $('.imgDBActive:visible').closest('div');
var uploadfile = $(parent).prev('div').data('id');
}
var xhr = new XMLHttpRequest();
xhr.open('post', 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', true);
xhr.onload = function() { //console.log('Upload erfolgreich beendet!');
}
xhr.onreadystatechange = function ()
{
if(xhr.readyState == 4 && xhr.status == 200)
{
if(xhr.responseText.length > 0)
{
console.log(xhr.responseText);
}
else
{
// REDIRECT
location.href= window.location.href;
}
}
return false;
}
var formData = new FormData();
formData.append('com', 'addToBasket');
formData.append('id', $(this).data("id"));
formData.append('pqty', $('#qty').val());
formData.append('pvmethod', $('#vmethod option:selected').text());
formData.append('pvmethod_id', $('#vmethod option:selected').val());
formData.append('pposition', $('#vposition option:selected').text());
formData.append('pposition_id', $('#vposition option:selected').val());
formData.append('pcolor', $('#vcolor option:selected').text());
formData.append('pcolor_id', $('#vcolor option:selected').val());
formData.append('pmuster', $('#muster option:selected').text());
formData.append('pmuster_id', $('#muster option:selected').val());
formData.append('pdruckflaechen', $('#druckflaechen').val());
formData.append('peinzeldata', $('#einzeldata').val());
formData.append('peinzelfont', $('#einzelfont').val());
formData.append('jsondata', jsondata);
formData.append('pngdata', pngdata);
formData.append('uploadfile', uploadfile);
xhr.send(formData);
return false;
//$.ajax({type: "GET", url: "https://www.werbekollektion.de/scripts/shop.warenkorb-io.php", data: { com: 'addToBasket', id: id, sp: menge }}).done(function(ex)
// {
//});
//return false;
});
/** DELETE FROM BASKET **/
$('.delItemButton').on('click', function(event)
{
var id = $(this).attr('data-id');
var refID = $(this).attr('data-refid');
$('#delItemButtonOk').attr('data-id',id);
$('#delItemButtonOk').attr('data-refid',refID);
delItemWin.open();
});
/** CHECK INTEGER FOR BASKET AMOUNT, QTY, BUDGET IN SEARCH **/
var oldMenge=1;
$('.mengeBox').focus(function() { oldMenge = $(this).val(); });
$('.mengeBox').blur(function()
{
if(oldMenge!=$(this).val()) { if($(this).val()==0) { $(this).val(1); } //$('#wkRefresh').submit();
refreshBasket(0,$(this));
}
});
//$('.qtyfield, .budgetfield').focus(function() { oldMenge = $(this).val(); });
//$('.qtyfield, .budgetfield').blur(function()
//{
// if(oldMenge!=$(this).val()) { if($(this).val()==0) { $(this).val(1); }}
//
//});
$('.mengeBox, .qtyfield, .qtyfieldMobile, .budgetfield, .budgetfieldMobile').keydown(function (e) {
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
(e.keyCode == 65 && e.ctrlKey === true) ||
(e.keyCode == 67 && e.ctrlKey === true) ||
(e.keyCode == 88 && e.ctrlKey === true) ||
(e.keyCode >= 35 && e.keyCode <= 39)) {
return;
}
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
});
/** REFRESH BASKET ITEM EB 4 **/
$('.wkItemQty, .wkItemVmethod, .wkItemPosition, .wkItemColor, .wkItemMuster, .wkItemDruckflaechen, .wkItemKommentar').on('change', function()
{
var id = $(this).data('id');
var itemid = $(this).data('itemid');
var qty = $('#wkqty'+itemid).val();
var vmethod = $('#wkvmethod'+itemid+' option:selected').text();
var vmethod_id = $('#wkvmethod'+itemid+' option:selected').val();
var position = $('#wkposition'+itemid+' option:selected').text();
var position_id = $('#wkposition'+itemid+' option:selected').val();
var color = $('#wkcolor'+itemid+' option:selected').text();
var color_id = $('#wkcolor'+itemid+' option:selected').val();
var muster = $('#wkmuster'+itemid+' option:selected').text();
var muster_id = $('#wkmuster'+itemid+' option:selected').val();
var druckflaechen = $('#wkdruckflaechen'+itemid).val();
var logoimage = $('#wklogoimage'+itemid).val();
var logoentwurf = $('#wklogoentwurf'+itemid).val();
var einzeldata = $('#wkeinzeldata'+itemid).val();
var einzelfont = $('#wkeinzelfont'+itemid).val();
var kommentar = $('#wkkommentar'+itemid).val();
//alert(position + ',' + position_id + ',' + einzeldata +',' +einzelfont);
$.ajax({ url: 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', type: 'POST', cache: true, async: false, dataType: 'text', data: {'com': 'updateBasket', 'id': itemid, sp: 'update', 'refID': '', 'qty': qty, 'vmethod': vmethod, 'vmethod_id': vmethod_id, 'position': position, 'position_id': position_id, 'color': color, 'color_id': color_id, 'muster': muster, 'muster_id': muster_id, 'druckflaechen': druckflaechen, 'logoimage': logoimage, 'logoentwurf': logoentwurf, 'einzeldata': einzeldata, 'einzelfont': einzelfont, 'kommentar': kommentar},
success: function(cs)
{ top.location.href = 'https://www.werbekollektion.de/warenkorb/';
//alert('ok');
},
error: function(em)
{ window.parent.location.reload(); return true;
//alert('error');
}
});
});
/** REFRESH BASKET FUNCTION **/
function refreshBasket(mode,data)
{
if(mode==0)
{
var id = $(data).attr('data-id');
var menge = $(data).val();
$.ajax({ url: 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', type: 'POST', cache: true, async: false, dataType: 'text', data: {'com': 'updateBasket', 'id': id, sp: 'update', 'refID': menge},
success: function(cs) { top.location.href = 'https://www.werbekollektion.de/warenkorb/'; },
error: function(em) { window.parent.location.reload(); return true; }
});
}
else
{
top.location.href = mode==1 ? 'https://www.werbekollektion.de/warenkorb/adressen/':'https://www.werbekollektion.de/warenkorb/';
}
}
/* REFRESH EINZELNAMEN BASKET */
$('#wkRefresh').on('change','.einzelnamenDataWK,.einzelnamenFontWK',function()
{
var id = $(this).attr('data-itemid');
var loader = $(this).parent().find('.loader2'); loader.show();
$.ajax({url:'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', type: 'post', cache: false, dataType: "text", data: {'com': 'refreshWKEinzelnamen', 'id': id, 'einzelnamenData': $('.einzelnamenData'+id).val(), 'einzelnamenFont': $('.einzelnamenFont'+id).val()},
error: function(em)
{
return true;
},
success: function(em)
{
//console.log(em);
loader.hide();
return false;
}})
});
/* IMAGE UPLOAD BASKET */
$('#wkRefresh').on('change','.imageUploadWK', function()
{
var id = $(this).attr('data-id');
var ext = this.files[0].name.substr((this.files[0].name.lastIndexOf('.') +1)).toLowerCase();
// size check
//if(this.files[0].size>8388608)
if(this.files[0].size > 16777216)
//if(this.files[0].size>2097152)
{
alert('Die angegebene Datei ist größer als 16MB.\nBitte beachten Sie die maximale Dateigröße.');
}
else if(ext!='eps' && ext!='jpg' && ext!='jpeg' && ext!='png' && ext!='svg') //&& ext!='pdf'
{
//error=1;
//errmess = "
alert('Derzeit können nur Dateien vom Typ "EPS", "JPEG", "PNG" und "SVG" heraufgeladen werden.'); //, "PDF"
}
else
{
var filename = '';
var loader = $(this).parent().find('.loader3'); loader.show();
var upText = $(this).parent().find('.imgUploadtext'); upText.hide();
var imgDB = $(this).parent().parent().find('.imgDBWarenkorb');
var imgDBInput = $(this).parent().parent().find('.imgDBWarenkorbInputField');
var imgUploadButton = $(this).parent().parent().find('.imgUploadButton');
var imgRemoveButton = $(this).parent().parent().find('.imgRemoveButton');
var formData = new FormData();
formData.append('file', this.files[0]);
formData.append('generateID','1');
$.when($.ajax({ url:'https://www.werbekollektion.de/scripts/lc-image.php', type: 'POST', data: formData, cache: false, processData: false, contentType: false,
error: function(em) { },
success: function(em)
{
filename = em;
return false;
}})).done(function()
{
$.ajax({ url:'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', type: 'get', cache: false, dataType: "text", data: {'com': 'addWKImage', 'id': id, 'file': filename},
error: function(em)
{
//return true;
},
success: function(em)
{
loader.hide();
upText.show();
var data = em.split('|');
imgDBInput.val(data[1]);
imgDB.css({'background-image':'url(\"'+data[0] +'xuser/uploads/'+ data[1]+'\")','background-size':'contain'});
imgDB.show();
imgUploadButton.hide();
imgRemoveButton.show();
//alert(em);
return false;
}})
});
}
// reset upload input
$(this).val('');
});
/** REMOVE FROM BASKET **/
$('.imageRemoveWK').on('click', function()
{
var id = $(this).attr('data-id');
var parent = $(this).parent().parent().find('.imgDBWarenkorb');
var parentTitle = $(this).parent().parent().find('.imgUploadTitle');
var parentUpload = $(this).parent().parent().find('.imgUploadButton');
var parentRemove = $(this).parent().parent().find('.imgRemoveButton');
//alert($(parent).attr('class'));
$(parent).css({'background-image':'url(https://www.werbekollektion.de/xshop/icons/ajax-loader.gif)','background-size':'20px'});
$.ajax({url: 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', type: 'get', cache: false, dataType: 'text', data: {'com': 'removeWKImage', 'id': id },
error: function(em)
{
//window.parent.location.reload(); return true;
},
success: function(cs)
{
$(parentTitle).html('Bild / Logo hinzufügen:');
$(parentUpload).show(); // BUTTON
$(parentRemove).hide(); // BUTTON
$(parent).hide();
}
});
return false;
});
/** REMOVE FROM BASKET **/
function removeFromBasket()
{
var id = $('#delItemButtonOk').attr('data-id');
var refID = $('#delItemButtonOk').attr('data-refid');
$.ajax({ url: 'https://www.werbekollektion.de/scripts/shop.warenkorb-io.php', type: 'POST', cache: true, async: false, dataType: 'text', data: {'com': 'updateBasket', 'id': id, sp:'delete',refID:'' }, error: function(em) { window.parent.location.reload(); return true; },
success: function(cs)
{
window.parent.location.reload(); return true;
}});
return false;
}
/** CHOICE PAY METHOD AMAZON VS OTHER **/
$(document).on('click', '.chooseDBPayMethod', function(event)
{
if($(this).val() == 'classic')
{
$('#requestAmazonPayContainer').hide();
$('#requestClassicPay').show();
$('#amazonWidgetBlock').hide();
$('#classicWidgetBlock').show();
}
else
{
$('#requestAmazonPayContainer').show();
$('#requestClassicPay').hide();
$('#amazonWidgetBlock').show();
$('#classicWidgetBlock').hide();
var restoreAmazonError=0;
if($('#amazonWrongAddress').is(':visible')) { restoreAmazonError=1; }
$('.msgError').hide();
if(restoreAmazonError==1) { $('#amazonWrongAddress').show(); }
}
});
/** DELIVERY ADRESS + INVOICE ADRESSE ADD / SELECT **/
$('#raddress').on('change', function()
{
$.ajax({ url: "https://www.werbekollektion.de/scripts/shop.warenkorb-io.php", type: 'GET', cache: false, timeout: 30000, data: { com: 'updraddress', id: $("#raddress option:selected").val() },
error: function(){ return true; },
success: function(cp) { $('#raddressblock').html(cp); return true; }
});
$('#raddressform').hide(); $('#raddressblock').show();
$('#raddress0').prop("checked", true)
});
$('#raddress0').on('click', function() { $('#raddressform').hide(); $('#raddressblock').show(); });
$('#raddress1').on('click', function() { $('#raddressform').show(); $('#raddressblock').hide(); });
$('#daddress').on('change', function()
{
$.ajax({ url: "https://www.werbekollektion.de/scripts/shop.warenkorb-io.php", type: 'GET', cache: false, timeout: 30000, data: { com: 'upddaddress', id: $("#daddress option:selected").val() },
error: function(){ return true; },
success: function(cp) { $('#daddressblock').html(cp); return true; }
});
$('#daddressform').hide(); $('#daddressblock').show();
$('#daddress0').prop("checked", true)
});
$('#daddress0').on('click', function() { $('#daddressform').hide(); $('#daddressblock').show(); });
$('#daddress1').on('click', function() { $('#daddressform').show(); $('#daddressblock').hide(); });
/** MODAL CHOICE WIN **/
function showModalInfoWin(title,message)
{
$('#modalInfoTitle').html(title);
$('#modalInfoMessage').html(message);
/**window.scrollTo(0,0); **/
modalInfoWin.open();
}
//function choiceWin(title,message)
//{
// $('#modalInfoTitle').html(title);
// $('#modalInfoMessage').html(message);
// choiceWin.open();
//}
/** EINZELNAMEN FUNCTIONS */
function clearEinzelnamen()
{ $('.editEinzelnamenList').html(''); }
function addEinzelnamen(value,ezwin)
{
var qtyID = ezwin.source.data('qtyid');
if($('#'+qtyID).val() > getEinzelnamenRows()) // MAX AMOUNT REACHED
{
value = value.replace(/\'|\,/g,'');
value = value.substring(0,20);
$('.editEinzelnamenList').append('