I've created Virtuemart parent and child products using BreakDesigns 'Custom Fields For All' and 'Stockable Custom Fields' plugins. I have a few modal popups in the parent product description (anchor tags with class="modal_link") which are inherited by the child products (I've also tried setting descriptions for the child products too). When a child product is loaded on the page (after different options/buttons are selected on the parent product), the modal links open in the browser window instead of in popups. The modals work ok on the parent product page.
BreakDesigns have told me that any javascript related functionality needs to be instantiated after the page update.
The same that happens after the page load. They've told me the place I need to trigger any js function, but I don't understand js so I don't know how to get the modals to work. . The file is in components/com_virtuemart/assets/js/dynupdate.js
This is an extract from the file, with what should be the correct position shown for the js to be inserted:
Code: Select all
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);
}
});
}
/*********** INSERT JS HERE ***********/
}
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;
}
Many thanks for your time!