Post by ibuildit » Sat Jan 07, 2012 4:42 am

Hi, does any of you have any idea how to replace the spinning upload wheel with a progress bar?

Have googled to the moon and back but failed to find an answer.

many thanks!

Newbie

Posts

Joined
Fri Dec 16, 2011 6:48 am

Post by djfreebird » Fri Feb 01, 2013 7:51 am

BUMP

Newbie

Posts

Joined
Fri Sep 30, 2011 4:22 pm

Post by dideloo » Wed Dec 14, 2016 11:51 pm

I found a solution for this (and do not want to post a new topic because this one is the first you will find while searching for "opencart upload progess bar" or similar)...

The following is tested with 2.0.3.1!

Edit "template\product\product.tpl":

Add the following code between "processData: false," and "beforeSend: function() {" where the JavaScript file upload things are done:

Code: Select all

xhr: function() {
  var myXhr = $.ajaxSettings.xhr();
  if(myXhr.upload){
    myXhr.upload.addEventListener('progress',progressHandlingFunction, false);
  }
  return myXhr;
},
Do not forget/ignore the commas! Take a look on how they are placed in the other lines!

Add the following code before "$('.date').datetimepicker({":

Code: Select all

function progressHandlingFunction(e){
  if(e.lengthComputable){
    $('progress').attr({value:e.loaded,max:e.total});
  }
}
Now you need to add the following HTML stuff at the position where you want the progress bar to be shown (for example right under the upload button):

Code: Select all

<progress class="progress-bar" role="progressbar" style="width:100%;background-color:#EFEFEF;" value="0"></progress>
Upload the modified product.tpl and do not forget to click the "Refresh" button in the backend (Extensions -> Modifications).

That's it!

PS: I am not a programmer, I found some suggestions in this stackoverflow topic (http://stackoverflow.com/questions/1662 ... chronously) and did some try-and-error. It seems that there are some problems with "older" IE versions.

Newbie

Posts

Joined
Wed Dec 14, 2016 11:29 pm
Who is online

Users browsing this forum: No registered users and 76 guests