Author Topic: Add a loader icon when Virtuemart updates content  (Read 787 times)


  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1435
Add a loader icon when Virtuemart updates content
« on: August 25, 2015, 13:36:34 pm »
I can see that the Virtuemart.updateContent  function (dynupdate.js) could takes some time to update the product's page after a variant is selected.

Though the user is unaware of that and could continue selecting variants or interacting with the product which will have no effect until the 1st request is finished

I suggest adding a loader image until the ajax call returns results.
We can do that over the Virtuemart.containerSelector which is the place to load the results.

The code could be something like that:
Code: [Select]
            url: url,
            dataType: 'html',
            beforeSend: function(){
            //Set loader code
            success: function(data) {
                //Unset loader code
                var el = $(data).find(Virtuemart.containerSelector);
if (! el.length) el = $(data).filter(Virtuemart.containerSelector);
if (el.length) {

if (Virtuemart.updateImageEventListeners) Virtuemart.updateImageEventListeners();
if (Virtuemart.updateChosenDropdownLayout) Virtuemart.updateChosenDropdownLayout();
Virtuemart.isUpdatingContent = false;
if (callback && typeof(callback) === "function") {