RegularLabs.Modals.init();
Virtuemart.updateContent = function(url, callback) {
if(Virtuemart.isUpdatingContent) return false;
Virtuemart.isUpdatingContent = true;
urlSuf='tmpl=component&format=html&dynamic=1';
var glue = '&';
if(url.indexOf('&') == -1 && url.indexOf('?') == -1){
glue = '?';
}
url += glue+urlSuf;
$(this).vm2front("startVmLoading");
$.ajax({
url: url,
dataType: 'html',
success: function(data) {
var title = $(data).filter('title').text();
$('title').text(title);
var el = $(data).find(Virtuemart.containerSelector);
if (! el.length) el = $(data).filter(Virtuemart.containerSelector);
if (el.length) {
Virtuemart.container.html(el.html());
Virtuemart.updateCartListener();
Virtuemart.updateDynamicUpdateListeners();
if (Virtuemart.updateImageEventListeners) Virtuemart.updateImageEventListeners();
if (Virtuemart.updateChosenDropdownLayout) Virtuemart.updateChosenDropdownLayout();
if (typeof vm2tabs === 'function') {
vm2tabs($("#ui-tabs .tabs"));
}
//Virtuemart.product($("form.product"));
if(Virtuemart.recalculate) {
$("form.js-recalculate").each(function(){
if ($(this).find(".product-fields").length && !$(this).find(".no-vm-bind").length) {
var id= $(this).find('input[name="virtuemart_product_id[]"]').val();
Virtuemart.setproducttype($(this),id);
}
});
}
}
Virtuemart.isUpdatingContent = false;
if (callback && typeof(callback) === "function") {
callback();
}
$(this).vm2front("stopVmLoading");
RegularLabs.Modals.init();
},
error: function(datas) {
alert('Error updating page');
Virtuemart.isUpdatingContent = false;
$(this).vm2front("stopVmLoading");
},
statusCode: {
404: function() {
Virtuemart.isUpdatingContent = false;
$(this).vm2front("stopVmLoading");
alert( "page not found" );
}
}
});
Virtuemart.updateContent = function(url, callback) {
if(Virtuemart.isUpdatingContent) return false;
Virtuemart.isUpdatingContent = true;
urlSuf='tmpl=component&format=html&dynamic=1';
var glue = '&';
if(url.indexOf('&') == -1 && url.indexOf('?') == -1){
glue = '?';
}
url += glue+urlSuf;
$(this).vm2front("startVmLoading");
$.ajax({
url: url,
dataType: 'html',
success: function(data) {
var title = $(data).filter('title').text();
$('title').text(title);
var el = $(data).find(Virtuemart.containerSelector);
if (! el.length) el = $(data).filter(Virtuemart.containerSelector);
if (el.length) {
Virtuemart.container.html(el.html());
Virtuemart.updateCartListener();
Virtuemart.updateDynamicUpdateListeners();
if (Virtuemart.updateImageEventListeners) Virtuemart.updateImageEventListeners();
if (Virtuemart.updateChosenDropdownLayout) Virtuemart.updateChosenDropdownLayout();
if (typeof vm2tabs === 'function') {
vm2tabs($("#ui-tabs .tabs"));
}
//Virtuemart.product($("form.product"));
if(Virtuemart.recalculate) {
$("form.js-recalculate").each(function(){
if ($(this).find(".product-fields").length && !$(this).find(".no-vm-bind").length) {
var id= $(this).find('input[name="virtuemart_product_id[]"]').val();
Virtuemart.setproducttype($(this),id);
}
});
}
RegularLabs.Modals.init();
}
Virtuemart.isUpdatingContent = false;
if (callback && typeof(callback) === "function") {
callback();
}
$(this).vm2front("stopVmLoading");
},
error: function(datas) {
alert('Error updating page');
Virtuemart.isUpdatingContent = false;
$(this).vm2front("stopVmLoading");
},
statusCode: {
404: function() {
Virtuemart.isUpdatingContent = false;
$(this).vm2front("stopVmLoading");
alert( "page not found" );
}
}
});
Virtuemart.isUpdatingContent = false;
}