http://www.syncdev.eu
* Phone: 075SYNCDEV / 0340401183
*
* All rights reserved. Changing this code without the author's
* and / or SYNCDEV SRL-D's consent is strictly prohibited.
*
* @package SyncShop
*/
/**
* Access URI GET parameters values by parameter name
*
* Usage: $.urlParam('GET_PARAMETER_NAME')
*/
$.urlParam = function(name){var results = new RegExp('[\?&]' + name + '=([^]*)').exec(window.location.href);return results[1] || 0;}
/**
* System main functionalities
*
* Usage: Syncshop.dummyHelper();
*/
var Syncshop = function () {
/**
* Private functions & variables
*/
var dymmy_function = function() {
alert('Dummy function called!');
}
var remember_active_tab = function() {
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e){
$.cookie('last_tab', $(e.target).attr('href'));
});
var lastTab = $.cookie('last_tab');
if(lastTab) {
if($('a[href='+ lastTab +']').length) {
$('ul.nav-tabs').children().removeClass('active');
$('a[href='+ lastTab +']').parents('li:first').addClass('active');
$('div.tab-content').children().removeClass('active');
$(lastTab).addClass('active');
} else {
$('.nav-tabs a:first').tab('show');
}
}
}
var block_ui = function() {
$(".block-ui").click(function() {
Metronic.blockUI({
boxed: true,
message: 'Se procesează...'
});
});
}
var billing_list = function () {
var table = $('#billing_list');
table.find('.group-checkable').change(function () {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
if (checked) {
$(this).attr("checked", true);
} else {
$(this).attr("checked", false);
}
});
jQuery.uniform.update(set);
});
}
var delete_selected_billing = function () {
$("#delete-selected-billing").click(function () {
var section = $(this).data("section");
var checkBoxes = $("input[name=id]");
var id_list = [];
$.each(checkBoxes, function() {
if($(this).is(":checked")){
id_list.push($(this).val());
}
});
var final_list = id_list.join(',');
if(final_list == '') {
bootbox.alert('Selectează adresele pe care vrei să le gestionezi!');
} else {
bootbox.confirm("Ai ales să ștergi adresele selectate. Ești sigur?", function(result) {
if(result === true) {
Metronic.blockUI({
boxed: true,
message: 'Se procesează...'
});
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=bulk_delete_address&ids=' + final_list,
success: function(html){
var remove_array = final_list.split(',');
for(var i = 0; i < remove_array.length; i++) {
$("#row-" + remove_array[i]).remove();
}
$.unblockUI();
}
});
}
});
}
});
}
var shipping_list = function () {
var table = $('#shipping_list');
table.find('.group-checkable').change(function () {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
if (checked) {
$(this).attr("checked", true);
} else {
$(this).attr("checked", false);
}
});
jQuery.uniform.update(set);
});
}
var delete_selected_shipping = function () {
$("#delete-selected-shipping").click(function () {
var section = $(this).data("section");
var checkBoxes = $("input[name=id]");
var id_list = [];
$.each(checkBoxes, function() {
if($(this).is(":checked")){
id_list.push($(this).val());
}
});
var final_list = id_list.join(',');
if(final_list == '') {
bootbox.alert('Selectează adresele pe care vrei să le gestionezi!');
} else {
bootbox.confirm("Ai ales să ștergi adresele selectate. Ești sigur?", function(result) {
if(result === true) {
Metronic.blockUI({
boxed: true,
message: 'Se procesează...'
});
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=bulk_delete_address&ids=' + final_list,
success: function(html){
var remove_array = final_list.split(',');
for(var i = 0; i < remove_array.length; i++) {
$("#row-" + remove_array[i]).remove();
}
$.unblockUI();
}
});
}
});
}
});
}
var whish_list = function () {
var table = $('#whish_list');
table.find('.group-checkable').change(function () {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
if (checked) {
$(this).attr("checked", true);
} else {
$(this).attr("checked", false);
}
});
jQuery.uniform.update(set);
});
}
var buy_selected_whishlist = function () {
$("#buy-selected-whishlist").click(function () {
var section = $(this).data("section");
var checkBoxes = $("input[name=id]");
var id_list = [];
$.each(checkBoxes, function() {
if($(this).is(":checked")){
id_list.push($(this).val());
}
});
var final_list = id_list.join(',');
if(final_list == '') {
bootbox.alert('Selectează produsele pe care vrei să le adaugi în coș!');
} else {
Metronic.blockUI({
boxed: true,
message: 'Se procesează...'
});
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=bulk_buy&ids=' + final_list,
success: function(html){
window.location.reload(false);
}
});
}
});
}
/**
* Product list search
*/
var handleTwitterTypeahead = function() {
var product_list_search = new Bloodhound({
datumTokenizer: function(d) { return d.tokens; },
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: site_url + 'ajax/search_product.php?query=%QUERY'
});
product_list_search.initialize();
$('.product-list-search').typeahead(null, {
name: 'daproduct-list-search',
displayKey: 'value',
source: product_list_search.ttAdapter(),
hint: true,
limit: '500',
templates: {
suggestion: Handlebars.compile([
''
].join(''))
}
});
}
var reserved_list = function () {
var table = $('#reserved_list');
table.find('.group-checkable').change(function () {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function () {
if (checked) {
$(this).attr("checked", true);
} else {
$(this).attr("checked", false);
}
});
jQuery.uniform.update(set);
});
}
var buy_selected_reserved = function () {
$("#buy-selected-reserved").click(function () {
var section = $(this).data("section");
var checkBoxes = $("input[name=id]");
var id_list = [];
$.each(checkBoxes, function() {
if($(this).is(":checked")){
id_list.push($(this).val());
}
});
var final_list = id_list.join(',');
if(final_list == '') {
bootbox.alert('Selectează produsele pe care vrei să le adaugi în coș!');
} else {
Metronic.blockUI({
boxed: true,
message: 'Se procesează...'
});
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=reserved_bulk_buy&ids=' + final_list,
success: function(html){
window.location = site_url + 'cos/';
}
});
}
});
}
var date_picker = function() {
if(jQuery().datepicker) {
$('#date_rent_from').datetimepicker({
format: "YYYY-MM-DD",
minDate: new Date(),
locale: "ro"
});
$('#date_rent_to').datetimepicker({
format: "YYYY-MM-DD",
locale: "ro",
useCurrent: false
});
$("#date_rent_from").on("dp.change", function (e) {
$('#date_rent_to').data("DateTimePicker").minDate(e.date);
});
$("#date_rent_to").on("dp.change", function (e) {
$('#date_rent_from').data("DateTimePicker").maxDate(e.date);
});
}
}
/**
* Public functions
*/
return {
/**
* Private functions & variables initialization
*/
init: function() {
/* dymmy_function(); */
remember_active_tab();
block_ui();
billing_list();
delete_selected_billing();
shipping_list();
delete_selected_shipping();
whish_list();
buy_selected_whishlist();
handleTwitterTypeahead();
reserved_list();
buy_selected_reserved();
date_picker();
},
/**
* Helper functions
*/
dummyHelper: function() {
alert('Dummy helper called!');
},
blockui: function () {
Metronic.blockUI({
boxed: true,
message: 'Se procesează...'
});
},
openStore: function() {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/app.php",
type: 'POST',
data: 'action=auto_open_store',
success: function(html){
window.location.reload(true);
}
});
}
};
}();
var defaultPlotOptions = {
colors: ['#e25856'],
legend: {
show: true,
labelBoxBorderColor: "", // border color for the little label boxes
backgroundOpacity: 0.95 // set to 0 to avoid background
},
series: {
points: {
show: false,
radius: 3,
lineWidth: 2, // in pixels
fill: true,
fillColor: "#ffffff",
symbol: "circle" // or callback
},
lines: {
// we don't put in show: false so we can see
// whether lines were actively disabled
show: true,
lineWidth: 2, // in pixels
fill: false,
fillColor: {
colors: [ { opacity: 0.4 }, { opacity: 0.1 } ]
}
},
bars: {
lineWidth: 1, // in pixels
barWidth: 1, // in units of the x axis
fill: true,
fillColor: {
colors: [ { opacity: 0.7 }, { opacity: 1 } ]
},
align: "left", // or "center"
horizontal: false
},
pie: {
show: false,
radius: 1,
label: {
show: false,
radius: 2/3,
formatter: function(label, series){
return ''+label+'
'+Math.round(series.percent)+'%
';
},
threshold: 0.1
}
},
shadowSize: 0
},
grid: {
show: true,
borderColor: "#efefef", // set if different from the grid color
tickColor: "rgba(0,0,0,0.06)", // color for the ticks, e.g. "rgba(0,0,0,0.15)"
labelMargin: 10, // in pixels
axisMargin: 8, // in pixels
borderWidth: 0, // in pixels
minBorderMargin: 10, // in pixels, null means taken from points radius
mouseActiveRadius: 5 // how far the mouse can be away to activate an item
},
tooltipOpts: {
defaultTheme: false
},
selection: {
color: '#54728c'
}
};
;function browserBLockerExtensionAlert() {
if(!$("#ablockercheck").is(":visible")) {
$('.ad-placement').before('');
} else {
$(".blocker-alert").remove();
}
}
function showTab(tab_name) {
$('.nav-tabs a[href="#' + tab_name + '"]').tab('show');
}
function showChartTooltip(x, y, xValue, yValue) {
$('' + xValue + ': ' + yValue + '<\/div>').css({
position: 'absolute',
display: 'none',
top: y - 40,
left: x - 40,
border: '0px solid #ccc',
padding: '2px 6px',
'background-color': '#fff'
}).appendTo("body").fadeIn(200);
}
function setProductQuantity(direction, max, pid, vid) {
switch(direction) {
case "increase":
var actual = parseInt($('#qty').val());
/**
* Disabled if Bootstrap TouchSpin is in use
*/
//var max_value = actual + 1;
var max_value = actual;
if(max_value <= max) {
Syncshop.blockui();
/**
* Disabled if Bootstrap TouchSpin is in use
*/
//$('#qty').val(max_value);
$.ajax({
url: site_url + "ajax/product.php",
type: 'POST',
data: 'action=set_final_price&pid=' + pid + '&qty=' + max_value + '&vid=' + vid,
success: function(html){
$("#final-price").html(html);
$.unblockUI();
}
});
}
break;
case "decrease":
var actual = parseInt($('#qty').val());
/**
* Disabled if Bootstrap TouchSpin is in use
*/
//var var minimum_value = actual - 1;
var minimum_value = actual;
if(minimum_value > 0) {
Syncshop.blockui();
/**
* Disabled if Bootstrap TouchSpin is in use
*/
//$('#qty').val(minimum_value);
$.ajax({
url: site_url + "ajax/product.php",
type: 'POST',
data: 'action=set_final_price&pid=' + pid + '&qty=' + minimum_value + '&vid=' + vid,
success: function(html){
$("#final-price").html(html);
$.unblockUI();
}
});
}
break;
}
}
function setProductQuantityId(direction, max, id) {
switch(direction) {
case "increase":
var actual = parseInt($('#qty-' + id).val());
var max_value = actual + 1;
if(max_value <= max) {
$('#qty-' + id).val(max_value);
}
break;
case "decrease":
var actual = parseInt($('#qty-' + id).val());
var minimum_value = actual - 1;
if(minimum_value > 0) {
$('#qty-' + id).val(minimum_value);
}
break;
}
}
function saveReferer(referer) {
$.ajax({
url: site_url + "ajax/app.php",
type: 'POST',
data: 'referer=' + referer,
success: function(html){}
});
}
function clearCart(id) {
bootbox.confirm("Ai ales să golești coșul tău de cumpărături. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=clear_cart&id=' + id,
success: function(html){
window.location.reload(false);
}
});
}
});
}
function clearCartSilent(id) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=clear_cart&id=' + id,
success: function(html){
window.location.reload(false);
}
});
}
function accountPersonType(type) {
$.each(['fizica', 'juridica'], function(index, value) {
if(type == value) {
$('#' + value).show();
} else {
$('#' + value).hide();
}
});
switch(type) {
case "fizica":
$('#cui').val('');
$('#reg_com').val('');
$('#company').val('');
break;
case "juridica":
$('#cnp').val('');
break;
}
}
function loadLocalitiesProfile(county) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality').html(html);
$("#idLocality").select2("destroy");
$("#idLocality").select2();
$.unblockUI();
}
});
}
function loadLocalitiesBilling(county) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality-billing').html(html);
$("#idLocality-billing").select2("destroy");
$("#idLocality-billing").select2();
$.unblockUI();
}
});
}
function loadLocalitiesShipping(county) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality-shipping').html(html);
$("#idLocality-shipping").select2("destroy");
$("#idLocality-shipping").select2();
$.unblockUI();
}
});
}
function loadLocalitiesProfileCart(county) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality-profile').html(html);
$("#idLocality-profile").select2("destroy");
$("#idLocality-profile").select2();
$.unblockUI();
}
});
}
function loadLocalitiesNewAddress(county, type) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality-new-' + type).html(html);
$('#idLocality-new-' + type).select2("destroy");
$('#idLocality-new-' + type).select2();
$.unblockUI();
}
});
}
function loadLocalitiesOnAddressEdit(county, id) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality-edit-' + id).html(html);
$('#idLocality-edit-' + id).select2("destroy");
$('#idLocality-edit-' + id).select2();
$.unblockUI();
}
});
}
function loadLocalities(county) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality').html(html);
$("#idLocality").select2("destroy");
$("#idLocality").select2();
$.unblockUI();
}
});
}
function loadLocalitiesAddress(county) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/geolocation.php",
type: 'POST',
data: 'county=' + county,
success: function(html){
$('#idLocality_address').html(html);
$("#idLocality_address").select2("destroy");
$("#idLocality_address").select2();
$.unblockUI();
}
});
}
function deleteAddress(id) {
bootbox.confirm("Ai ales să ștergi această adresă. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'id=' + id + '&action=delete_address',
success: function(html){
$('#row-' + id).remove();
$.unblockUI();
}
});
}
});
}
function buyProduct(id, qty, vid) {
Syncshop.blockui();
var qty_buy = qty != '' ? qty : $('#qty').val();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'id=' + id + '&qty=' + qty_buy + '&vid=' + vid + '&action=buy',
success: function(html){
var response_parts = html.split("^");
$('#cart-total-qty').html(response_parts[0]);
$('#cart-total-qty-mobile').html(response_parts[0]);
$('#quick-cart').html(response_parts[1]);
$('#quick-cart').show();
if(parseInt(response_parts[0]) > 0) {
$('#empty-cart-message').hide();
$('#cart-total-amount-value').html(response_parts[2]);
$('#cart-total-amount').show();
}
$('#qty').val('1');
$('#final-price').html($('#initial-price').html());
$.unblockUI();
bootbox.alert({
message: 'Produsul a fost adaugat in cos'
});
}
});
}
function getCartTotal() {
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=total',
success: function(html){
$('#quick-cart-total').html(html);
$('#cart-total-amount-value').html(html);
if($('input[name=billing_method]:checked').val() == '2' || $('input[name=billing_method]:checked').val() == '3' || $('input[name=billing_method]:checked').val() == '4' || $('input[name=shipping_method]:checked').val() == '2') {
var cart_total_check = parseInt(html);
} else {
var cart_total_check = parseInt(html) - parseInt(st);
}
if(parseInt(cart_total_check) >= parseInt(fof)) {
$("#finish-order-container").show();
$("#no-finish-order-container").hide();
$("#no-finish-order-container-top").hide();
} else {
$("#finish-order-container").hide();
$("#no-finish-order-container").show();
$("#no-finish-order-container-top").show();
}
}
});
}
function deleteFromCartBlock(id, is_bundle, pid) {
if(is_bundle === true) {
var msg = 'Ai ales sa stergi acest pachet din cos.
Esti sigur?';
var bundle = '1';
} else {
var msg = 'Ai ales sa stergi acest produs din cos.
Esti sigur?';
var bundle = '0';
}
bootbox.confirm(msg, function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'id=' + id + '&action=delete&is_bundle=' + bundle + '&pid=' + pid,
success: function(html){
if(html == '0') {
$('#cart-row-' + id).remove();
$('#empty-cart-message').show();
$('#cart-total-amount').hide();
} else {
$('#cart-row-' + id).remove();
}
$('#cart-total-qty').html(html);
$('#cart-total-qty-mobile').html(html);
getCartTotal();
$.unblockUI();
}
});
}
});
}
function deleteFromCartBlockSilent(id, is_bundle, pid) {
if(is_bundle === true) {
var bundle = '1';
} else {
var bundle = '0';
}
$('#loading-delete-' + id).show();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'id=' + id + '&action=delete&is_bundle=' + bundle + '&pid=' + pid,
success: function(html){
if(html == '0') {
$('#cart-row-' + id).remove();
$('#empty-cart-message').show();
$('#cart-total-amount').hide();
} else {
$('#cart-row-' + id).remove();
}
$('#cart-total-qty').html(html);
$('#cart-total-qty-mobile').html(html);
getCartTotal();
}
});
}
function deleteFromCart(id, is_bundle, pid) {
if(is_bundle === true) {
var msg = 'Ai ales sa stergi acest pachet din cos.
Esti sigur?';
var bundle = 'true';
} else {
var msg = 'Ai ales sa stergi acest produs din cos.
Esti sigur?';
var bundle = 'false';
}
bootbox.confirm(msg, function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'id=' + id + '&action=delete&is_bundle=' + bundle + '&pid=' + pid,
success: function(html){
window.location.reload(false);
}
});
}
});
}
function deleteFromCartSilent(id, is_bundle, pid) {
if(is_bundle === true) {
var bundle = 'true';
} else {
var bundle = 'false';
}
$('#loading-delete-' + id).show();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'id=' + id + '&action=delete&is_bundle=' + bundle + '&pid=' + pid,
success: function(html){
if(html == '0') {
window.location.reload(true);
} else {
$('#full-cart-row-' + id).remove();
}
$('#cart-total-qty').html(html);
$('#cart-total-qty-mobile').html(html);
getCartTotal();
}
});
}
function getTotalQty() {
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=total_qty',
success: function(html){
$('#cart-total-qty').html(html);
$('#cart-total-qty-mobile').html(html);
}
});
}
function getVoucherTotal() {
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=total_voucher',
success: function(html){
$('#voucher-total-amount').html(html);
$('#voucher_amount').html(html);
}
});
}
function getProductTotal(id) {
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=product_total&id=' + id,
success: function(html){
$('#product-total-' + id).html(html);
}
});
}
function setCartProductQuantity(direction, max, id, zone) {
if(zone == 'client') {
var form_data = $("#f-order").serialize();
}
if(zone == 'quick') {
var form_data = $("#f-quick").serialize();
}
switch(direction) {
case "increase":
var actual = parseInt($('#qty-' + id).val());
/**
* Disabled if Bootstrap TouchSpin is in use
*/
//var max_value = actual + 1;
var max_value = actual;
if(max_value <= max) {
var final_value = max_value;
}
break;
case "decrease":
var actual = parseInt($('#qty-' + id).val());
/**
* Disabled if Bootstrap TouchSpin is in use
*/
//var var minimum_value = actual - 1;
var minimum_value = actual;
if(minimum_value > 0) {
var final_value = minimum_value;
}
break;
}
if(final_value > 0) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'id=' + id + '&action=update_qty' + '&qty=' + final_value + '&' + form_data,
success: function(html){
window.location.reload(false);
}
});
}
}
function deleteVoucher(id) {
bootbox.confirm('Ai ales sa nu mai aplici acest cupon de reducere.
Esti sigur?', function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=delete_voucher',
success: function(html){
window.location.reload(false);
}
});
}
});
}
function sortCategory(value, id, alias) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=sort&sortvalue=' + value + '&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function sortCategoryBrand(value, id, alias) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=brand_sort&sortvalue=' + value + '&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function setCategoryStock(id, alias, value) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=stock_sort&sortvalue=' + value + '&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function setCatFilter(filter_pair, id, alias) {
Syncshop.blockui();
var filter_data = filter_pair.split(':');
if($('#filter_value_' + filter_data[1]).attr('checked')) {
var todo = 'set';
} else {
var todo = 'unset';
}
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=filter_sort&filter_pair=' + encodeURIComponent(filter_pair) + '&cid=' + id + '&todo=' + todo,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function removeCatFilters(id, alias) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_filters&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function removeCatFiltersCat(id, alias) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_filters_cat&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function removeCatFilter(fid, vid, id, alias) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_filter&fid=' + fid + '&vid=' + vid + '&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function setCategoryUnsealed(id, alias) {
Syncshop.blockui();
if($('#unsealed').attr('checked')) {
var value = '1';
} else {
var value = '';
}
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=unsealed&sortvalue=' + value + '&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function setCategoryClearing(id, alias) {
Syncshop.blockui();
if($('#clearing').attr('checked')) {
var value = '1';
} else {
var value = '';
}
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=clearing&sortvalue=' + value + '&cid=' + id,
success: function(html){
window.location = site_url + alias + '/';
}
});
}
function sortBrand(value, id, alias) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/brand.php",
type: 'POST',
data: 'action=sort&sortvalue=' + value + '&bid=' + id,
success: function(html){
window.location = site_url + 'produse-' + alias + '/';
}
});
}
function setBrandStock(id, alias) {
Syncshop.blockui();
if($('#in-stock').attr('checked')) {
var value = '1';
} else {
var value = '';
}
$.ajax({
url: site_url + "ajax/brand.php",
type: 'POST',
data: 'action=stock_sort&sortvalue=' + value + '&bid=' + id,
success: function(html){
window.location = site_url + 'produse-' + alias + '/';
}
});
}
function toWishlist(id, vid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=to_wishlist&id=' + id + '&vid=' + vid,
success: function(html){
$.unblockUI();
if(html == 'success') {
var msg = 'Produsul a fost adaugat cu succes in Wishlist-ul tau!';
}
if(html == 'exists') {
var msg = 'Produsul se regaseste deja in Wishlist-ul tau!';
}
bootbox.alert({
message: msg
});
}
});
}
function deleteFromWishlist(id) {
bootbox.confirm("Ai ales să ștergi acest produs din lista ta de dorințe. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=remove_from_wishlist&id=' + id,
success: function(html){
$('#wishlist-' + id).remove();
$.unblockUI();
}
});
}
});
}
function stockAlert(id, vid) {
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=stock_alert&id=' + id + '&vid=' + vid,
success: function(html){
if(html == 'success') {
var msg = 'Alerta de stoc a fost creata!
Te vom anunta imediat ce avem produsul pe stoc.';
}
if(html == 'exists') {
var msg = 'Ai creat deja o alerta de stoc pentru acest produs';
}
bootbox.alert({
message: msg
});
}
});
}
function deleteAlert(id) {
bootbox.confirm("Ai ales să ștergi anulezi această alertă de stoc. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=delete_alert&id=' + id,
success: function(html){
$('#alert-' + id).remove();
$.unblockUI();
}
});
}
});
}
function toNewsletter() {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=to_newsletter&email=' + encodeURIComponent($('#newsletter-email').val()),
success: function(html){
$("#newsletter-email").val('');
$.unblockUI();
if(html == 'success') {
var msg = 'Adresa de email a fost adaugată în Newsletter-ul nostru.
Îți mulțumim!';
}
if(html == 'exists') {
var msg = 'Ești deja abonat la Newsletter-ul nostru!';
}
bootbox.alert({
size: 'small',
message: msg
});
}
});
}
function buyBundle(id) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=add_bundle&id=' + id,
success: function(html){
$.unblockUI();
bootbox.confirm("Pachetul a fost adăugat în coș", function(result) {
if(result === true) {
Syncshop.blockui();
window.location.reload(false);
}
});
}
});
}
function applyRangePrice(cid) {
Syncshop.blockui();
var price_range = $('#price_range_min').val() + ';' + $('#price_range_max').val();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=price_range&cid=' + cid + '&range=' + price_range,
success: function(html){
window.location.reload(false);
}
});
}
function scrollToElement(id) {
$('html, body').animate({
scrollTop: $("#" + id).offset().top
}, 1000);
}
function checkAWB(awb, pid) {
Syncshop.blockui();
$("#awb-status").hide();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'awb=' + awb + '&action=check_awb_status&pid=' + pid,
success: function(html){
$("#awb-status-response").html(html);
$("#awb-status").show();
$.unblockUI();
}
});
}
function getOrderTotal() {
var jqXHR = $.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=total',
async: false
});
return jqXHR.responseText;
}
function finishQuickOrder() {
Syncshop.blockui();
if($("#f-quick").validationEngine('validate') === false) {
$.unblockUI();
} else {
var form_data = $("#f-quick").serialize();
var order_total = getOrderTotal();
var map = {};
$.each(form_data.split("&"), function () {
var nv = this.split("="),
n = decodeURIComponent(nv[0]),
v = nv.length > 1 ? decodeURIComponent(nv[1]) : null;
if(!(n in map)) {
map[n] = [];
}
map[n].push(v);
})
if(map['billing_method'] == '3') {
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: form_data + '&action=finish_quick_order',
success: function(html){
$("#f-quick").submit();
}
});
} else {
$("#f-quick").submit();
}
}
}
function finishOrder() {
Syncshop.blockui();
if($("#f-order").validationEngine('validate') === false) {
$.unblockUI();
} else {
var form_data = $("#f-order").serialize();
var order_total = getOrderTotal();
var map = {};
$.each(form_data.split("&"), function () {
var nv = this.split("="),
n = decodeURIComponent(nv[0]),
v = nv.length > 1 ? decodeURIComponent(nv[1]) : null;
if(!(n in map)) {
map[n] = [];
}
map[n].push(v);
})
if(map['billing_method'] == '3') {
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: form_data + '&action=finish_order',
success: function(html){
$("#f-order").submit();
}
});
} else {
$("#f-order").submit();
}
}
}
function deleteProfilePicture() {
bootbox.confirm("Ai ales să ștergi imaginea ta de profil. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=delete_profile_picture',
success: function(html){
$('#profile-picture-container').remove();
$.unblockUI();
}
});
}
});
}
function setProductVariant(variant_id, pid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/product.php",
type: 'POST',
data: 'action=set_active_variant&vid=' + variant_id + '&pid=' + pid,
success: function(html){
window.location.reload(false);
}
});
}
function setBillingMethod(id, zone) {
Syncshop.blockui();
if(zone == 'client') {
var form_data = $("#f-order").serialize();
}
if(zone == 'quick') {
var form_data = $("#f-quick").serialize();
}
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=set_billing_method&bid=' + id + '&' + form_data,
success: function(html){
window.location.reload(false);
}
});
}
function setShippingMethod(id, zone) {
Syncshop.blockui();
if(zone == 'client') {
var form_data = $("#f-order").serialize();
}
if(zone == 'quick') {
var form_data = $("#f-quick").serialize();
}
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=set_shipping_method&sid=' + id + '&' + form_data,
success: function(html){
window.location.reload(false);
}
});
}
function setShippingProvider(id, zone) {
Syncshop.blockui();
if(zone == 'client') {
var form_data = $("#f-order").serialize();
}
if(zone == 'quick') {
var form_data = $("#f-quick").serialize();
}
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=set_shipping_provider&pid=' + id + '&' + form_data,
success: function(html){
window.location.reload(false);
}
});
}
function setCartAddress(id, type) {
Syncshop.blockui();
var form_data = $("#f-order").serialize();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=set_cart_address&id=' + id + '&address_type=' + type + '&' + form_data,
success: function(html) {
window.location.reload(false);
}
});
}
function setQuickOrderForm(type) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=set_quick_order_form&type=' + type,
success: function(html){
$.unblockUI();
}
});
}
function loadAutoModels(auto_brand) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/auto.php",
type: 'POST',
data: 'auto_brand=' + auto_brand,
success: function(html){
$('.row #idAutoModel').html(html);
$(".row #idAutoModel").select2("destroy");
$(".row #idAutoModel").select2();
$.unblockUI();
}
});
}
function loadAutoVariants(auto_model) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/auto2.php",
type: 'POST',
data: 'auto_model=' + auto_model,
success: function(html){
$('.row #variant').html(html);
$(".row #variant").select2("destroy");
$(".row #variant").select2();
$.unblockUI();
}
});
}
function loadAutoButton(){
$(function(){
$('#go-src-advanced').show(1000);
})
}
function setToPayNow(to_pay) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/cart.php",
type: 'POST',
data: 'action=set_to_pay_now&to_pay=' + to_pay,
success: function(html){
window.location.reload(false);
}
});
}
function deleteReservation(id) {
bootbox.confirm("Ai ales să anulezi rezervarea acestui produs. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=delete_reservation&id=' + id,
success: function(html){
$('#alert-' + id).remove();
$.unblockUI();
}
});
}
});
}
function reserveProduct(id, vid) {
$.ajax({
url: site_url + "ajax/customer.php",
type: 'POST',
data: 'action=reserve&id=' + id + '&vid=' + vid,
success: function(html){
if(html == 'success') {
var msg = 'Produsul ți-a fost rezervat pentru 24 de ore';
}
if(html == 'exists') {
var msg = 'Ai rezervat deja acest produs';
}
bootbox.alert({
message: msg,
callback: function () {
Syncshop.blockui();
window.location.reload(false);
}
});
}
});
}
function setCatBrandFilter(bid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&bid=' + bid + '&cid=' + cid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function removeCatBrandFilter(bid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_cat_filter&bid=' + bid + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function setCatModelFilter(mid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&mid=' + mid + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function setCatFuelFilter(fid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&fid=' + fid + '&cid=' + cid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setCatTransmissionFilter(tid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&tid=' + tid + '&cid=' + cid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setCatYearFilter(year, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&year=' + year + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function removeCatModelFilter(mid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_cat_filter&mid=' + mid + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function removeCatFuelFilter(fid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_cat_filter&fid=' + fid + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function removeCatTransFilter(tid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_cat_filter&tid=' + tid + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function removeCatYearFilter(year, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_cat_filter&year=' + year + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function setCatPartFilter(pid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&pid=' + pid + '&cid=' + cid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function removeCatPartFilter(pid, cid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_cat_filter&pid=' + pid + '&cid=' + cid,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(true);
}
});
}
function removeCatAutoFilters(id, alias) {
bootbox.confirm("Ai ales sa anulezi toate filtrele active in aceasta categorie. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=remove_auto_filters&cid=' + id,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location = site_url + alias + '/';
}
});
}
});
}
function applyRangeYear(cid) {
Syncshop.blockui();
var year_range = $('#year_range_min').val() + ';' + $('#year_range_max').val();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=year_range&cid=' + cid + '&range=' + year_range,
success: function(html){
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
});
}
function clearRentalCartSilent(id) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/rent.php",
type: 'POST',
data: 'action=clear_cart&id=' + id,
success: function(html){
window.location.reload(false);
}
});
}
function clearRentCart(id) {
bootbox.confirm("Ai ales să anulezi această comandă. Ești sigur?", function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/rent.php",
type: 'POST',
data: 'action=clear_cart&id=' + id,
success: function(html){
window.location.reload(false);
}
});
}
});
}
function setBrandModelFilter(mid, cid, bid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&mid=' + mid + '&cid=' + cid + '&bid=' + bid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setBrandFuelFilter(fid, cid, bid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&fid=' + fid + '&cid=' + cid + '&bid=' + bid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setBrandTransmissionFilter(tid, cid, bid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&tid=' + tid + '&cid=' + cid + '&bid=' + bid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setBrandPartFilter(pid, cid, bid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&pid=' + pid + '&cid=' + cid + '&bid=' + bid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setBrandModelFuelFilter(fid, cid, bid, mid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&fid=' + fid + '&cid=' + cid + '&bid=' + bid + '&mid=' + mid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setBrandModelTransmissionFilter(tid, cid, bid, mid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&tid=' + tid + '&cid=' + cid + '&bid=' + bid + '&mid=' + mid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function setBrandModelPartFilter(pid, cid, bid, mid) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/category.php",
type: 'POST',
data: 'action=set_cat_filter&pid=' + pid + '&cid=' + cid + '&bid=' + bid + '&mid=' + mid,
success: function(html){
if($("#sidebar-filters-redirect").length) {
window.location = site_url + $("#sidebar-filters-redirect").html() + '/';
} else {
$(window).on('beforeunload', function() {
$(window).scrollTop(0);
});
window.location.reload(false);
}
}
});
}
function deleteRentOption(id) {
bootbox.confirm('Ai ales să ștergi această opțiune.
Ești sigur?', function(result) {
if(result === true) {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/rent.php",
type: 'POST',
data: 'id=' + id + '&action=delete_option',
success: function(html){
window.location.reload(false);
}
});
}
});
}
function savePickup() {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/rent.php",
type: 'POST',
data: 'id=' + $("#pickup_from").val() + '&action=save_pickup',
success: function(html){
window.location.reload(false);
}
});
}
function saveReturn() {
Syncshop.blockui();
$.ajax({
url: site_url + "ajax/rent.php",
type: 'POST',
data: 'id=' + $("#return_to").val() + '&action=save_return',
success: function(html){
window.location.reload(false);
}
});
}
$(function(){
$(window).scroll(function(){
if ($(document).scrollTop() > 300) {
$("#silviu-adv-src-pop:hidden").fadeIn(500);
} else {
$("#silviu-adv-src-pop:visible").fadeOut(500);
}
})
})
Warning: Unknown: open(/tmp/sess_1a206ua3kig2nq126b3ismn8s5, O_RDWR) failed: No space left on device (28) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0