VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Miku on March 06, 2015, 08:40:03 AM

Title: Product reloading seems to doesn't work on IE9
Post by: Miku on March 06, 2015, 08:40:03 AM
Hi,
I have a big issue with Virtuemart 3 (specifically product details page) on IE9. In my case I'm not able to use the Generic child variant - variants are simply not loading and not able to move between the products using product navigation (top of the product page). It seems that it has something to do with reloading of the productdetails by an ajax call. I'm not a programmer and waiting for a feedback from someone in the know. I know IE9 is a very old one, but people still use it.
https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&qpcustomd=0 (https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&qpcustomd=0)

Is there any way to fix that?

VM 3.0.6
J! 3.4.0
Title: Re: Ajax call seems to doesn't work on IE9
Post by: GJC Web Design on March 06, 2015, 09:28:53 AM
a link to your page where this is happening perhaps?
Title: Re: Ajax call seems to doesn't work on IE9
Post by: Miku on March 06, 2015, 09:42:34 AM
Here you go
Link to the page (http://www.testowa2.asik.ogicom.pl/en/product-catalogue-en/portable-sound-systems/battery-powered-speaker-systems/pss-mini-8-detail)
Title: Re: Ajax call seems to doesn't work on IE9
Post by: GJC Web Design on March 06, 2015, 10:19:33 AM
open file http://www.testowa2.asik.ogicom.pl/components/com_virtuemart/assets/js/dynupdate.js

and around line 28 & 79 comment out

console.log("UpdateContent URI "+url);

console.log('updateDynamicUpdateListeners '+nodeName, el);

so

//console.log("UpdateContent URI "+url);

//console.log('updateDynamicUpdateListeners '+nodeName, el);

this is only console logging but I know early IE's hate this and fail on it

I assume you have a IE9 to test on?

actually in vm3.0.6.2 this has already been done... you should update as there are other bug fixes in this release as well
Title: Re: Ajax call seems to doesn't work on IE9
Post by: GJC Web Design on March 06, 2015, 10:25:07 AM
also in IETester on IE9 I get a JS error

see screenshot

this isn't from VM
Title: Re: Ajax call seems to doesn't work on IE9
Post by: Miku on March 06, 2015, 10:31:27 AM
Thank you for indicating this JS error. I'll report the matter to the developer.

-------------------
It turned out that it's an issue with 3rd party extension - search module. Sorry that I had been bothering you.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 06, 2015, 19:33:11 PM
Hmm...the solution is not so simple as I thought :(. Indeed the ploblem lay in 3rd party extension but only for IE 8. When it comes to IE9 it still exists. Looking into developer tool of IE I have the following issue

SCRIPT438: Object doesn't support property or method 'pushState'

in /components/com_virtuemart/assets/js/dynupdate.js?vmver=8740, line 102 character 9

Please for any advice.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: GJC Web Design on March 07, 2015, 01:18:15 AM
http://stackoverflow.com/questions/19634513/using-history-js-with-ie9

plus a lot of linked answers using history in <IE10

Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 18, 2015, 11:40:02 AM
So do you mean it's only my personal issue, not general with VM (issue lies in Vm core file) on IE?
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Studio 42 on March 18, 2015, 14:55:29 PM
I don't understand why tha ajax feature don't use https://github.com/browserstate/history.js, but it's own way, to handel browser history.
or perhaps this is a better solution
https://github.com/devote/HTML5-History-API
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Studio 42 on March 18, 2015, 15:27:02 PM
Now the solution in same file as before(components/com_virtuemart/assets/js/dynupdate.js):
history.pushState(stateObj, "", url);
to
if (typeof history.pushState != 'undefined') {
    history.pushState(stateObj, "", url);
}


This is not the best solution, because this does not add page to browser history in ie 9 and before, but must work in all case.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 18, 2015, 19:08:52 PM
Hi,
Your solution resolved the problem with "frozen" child variants on IE9 - that's a good thing, thank you :) The bad thing is that now I have another issue with js. I mean that now I'm not able to use fancybox (enlarge image), 'recommend to a friend' and 'ask a question ' forms for example... :(
The following error appears:
SCRIPT5007: Unable to get property 'hide': object is null or undefined in /components/com_virtuemart/assets/js/fancybox
jquery.fancybox-1.3.4.pack.js?vmver=8740, line 18 character 282


Ehh...if it's not one thing it's another...
Could anyone help?
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Studio 42 on March 18, 2015, 22:52:03 PM
Yes , sorry, i don't know which was writing this script, but this is very buggy.

it would be so simple when using triggers in the script and not so spagetti code.
add :
else Virtuemart.updateContent(url);
now the replacement code is:
if (typeof history.pushState != 'undefined') {
    history.pushState(stateObj, "", url);
} else Virtuemart.updateContent(url);


Hum, sorry, i'm not sure this resolve your problem. because window.onpopstate cannot be used for ie9

As i said, you have javascript library doing this for you, but in virtuemart 3.0, this is done internally without real fallback for old browsers.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 19, 2015, 14:28:33 PM
Thank you for trying to help. Indeed the new code didn't help. Still the same issue. ..  The worst thing is there's no any feedback in that matter from VM team.  Maybe I'm (we) wrong... Maybe the ajax reloading works well for them in elderly releases of IE. Or maybe not...Would be nice if anyone from VM team expressed his opinion about that.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 24, 2015, 12:25:48 PM
I know that now VM team has been struggling with numerous bugs related to new J! release but I'd like to ask once again for any feedback in the matter of ajax feature. Does the 'ajax reloading' work well in elderly releases of IE (8/9)? Do the child variants work fine for you in those browsers? Does anyone have the following errors trying to choose one of Generic child variants or using fancybox?

SCRIPT438: Object doesn't support property or method 'pushState'
in /components/com_virtuemart/assets/js/dynupdate.js?vmver=8740, line 102 character 9

SCRIPT5007: Unable to get property 'hide': object is null or undefined in /components/com_virtuemart/assets/js/fancybox
jquery.fancybox-1.3.4.pack.js?vmver=8740, line 18 character 282

It looks like the common issue for Virtuemart but I need someone to confirm (or deny) it. So if someone has an opportunity to check that I give any feedback I'll appreciate.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Studio 42 on March 24, 2015, 23:22:05 PM
Hi miku,
You have many solution for this problem.
one is (remove ajax and go to page)  after :
QuoteVirtuemart.updateContent = function(url) {
add
Quoteif (document.all && !window.atob) window.location.href = url;
to detect IE9 and lower
See here for more possibility :
http://stackoverflow.com/questions/10964966/detect-ie-version-prior-to-v9-in-javascript
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 25, 2015, 09:47:43 AM
Thanks for a hint but it looks like I'm not able to make use of it - it doesn't work for me. Should the code look like below after the modification? It's not that I'm too lazy to make some effort to do something by myself, it's simply because I'm not a programmer at all  :-[
Virtuemart.updateContent = function(url) {
if (document.all && !window.atob) window.location.href = url;
        if(Virtuemart.isUpdatingContent) return false;
        Virtuemart.isUpdatingContent = true;
        url += url.indexOf('&') == -1 ? '?tmpl=component' : '&tmpl=component';
        console.log("UpdateContent URI "+url);
        $.ajax({
            url: url,
            dataType: 'html',
            success: function(data) {
                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();
                    //Virtuemart.updateCartListener();

if (Virtuemart.updateImageEventListeners) Virtuemart.updateImageEventListeners();
if (Virtuemart.updateChosenDropdownLayout) Virtuemart.updateChosenDropdownLayout();
}
Virtuemart.isUpdatingContent = false;
            }
        });
        Virtuemart.isUpdatingContent = false;
    }

By the way indeed the best solution for me would be complete getting rid of the 'ajax reloading for product details', but how to do this?
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 25, 2015, 11:00:03 AM
Miku, I think Patrick meant it that way. Our problem is that there are not a lot people with an IE9. My personal statistic is that there are 2% developers with a real IE9, the rest tries with emulations, which have their own problems.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Studio 42 on March 26, 2015, 02:25:06 AM
I have look for statistic. IE8+9. Usage is +/- 7%, depending the stat counters you look.
Milbo, I think, it would be nice that your developpers do something.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 08:40:18 AM
Quote from: Studio 42 on March 26, 2015, 02:25:06 AM
Milbo, I think, it would be nice that your developpers do something.
I agree, if not just for IE then maybe some option to completely disable the ajax reloading...
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 26, 2015, 08:50:44 AM
Quote from: Studio 42 on March 26, 2015, 02:25:06 AM
I have look for statistic. IE8+9. Usage is +/- 7%, depending the stat counters you look.
Milbo, I think, it would be nice that your developpers do something.
I did already something and tested your ideas, but without luck. So my solution is a try/catch now.


        try {
            history.pushState(stateObj, "", url);
        }
        catch(err) {
            // Fallback for IE
            window.location.href = url;
            return false;
        }


and a config to disable the dynupdate (hmm should be called reload, actually) is already there. jdynupdate, and here the tutorial how to set http://forum.virtuemart.net/index.php?topic=128956.0

But others asked also for an option, not any developer for customplugins or joomla content plugins knows how to add the right js.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 26, 2015, 09:07:57 AM
Quote from: Studio 42 on March 26, 2015, 02:25:06 AM
I have look for statistic. IE8+9. Usage is +/- 7%, depending the stat counters you look.
Milbo, I think, it would be nice that your developpers do something.

You did not read correctly, I did not say that there are only 2% using it. What I said is, that I asked 50 people and only ONE has a real IE9. So the statistic within this forum is 2% and the reason that it is so hard to check for it, because there is no developer using such an old browser.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Studio 42 on March 26, 2015, 12:20:07 PM
Look here :
5% > http://www.h3xed.com/web-development/should-your-new-website-support-internet-explorer-8-in-2015
25% > http://www.w3counter.com/globalstats.php
25% > https://www.netmarketshare.com/browser-market-share.aspx?qprid=2&qpcustomd=0

The problem is the Microsoft ie8 update policy for windows 98,XP and Xbox.
I know 25% is not real, but i think the 7% is real !
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 26, 2015, 12:27:40 PM
Paatrick, wake up. I am NOT talking about the percentages in the wild.

I talk about developers! in special VirtueMart developers!
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 14:49:52 PM
Quote from: Milbo on March 26, 2015, 08:50:44 AM
I did already something and tested your ideas, but without luck. So my solution is a try/catch now.

        try {
            history.pushState(stateObj, "", url);
        }
        catch(err) {
            // Fallback for IE
            window.location.href = url;
            return false;
        }

Indeed, it seems to work ;)
Quote from: Milbo on March 26, 2015, 08:50:44 AM
and a config to disable the dynupdate (hmm should be called reload, actually) is already there. jdynupdate, and here the tutorial how to set http://forum.virtuemart.net/index.php?topic=128956.0
Yes, jdynupdate helps but it causes another problem - facybox doesn't work :(
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 26, 2015, 15:25:27 PM
what about the facebox?
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 15:34:19 PM
Quote from: Milbo on March 26, 2015, 15:25:27 PM
what about the facebox?
When we use jdynupdate in config there's an issue with 'Recommend to a friend', 'Print' and 'Ask a question' forms
They are loaded in the new page instead of the pop-up window, respectively:
/recommend?tmpl=component
?tmpl=component&print=1
/askquestion?tmpl=component
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 15:48:11 PM
Quote from: Milbo on March 26, 2015, 15:25:27 PM
what about the facebox?
And of course, above all, there is an issue with images which load itself  in a new page instead of pop-up...So we have something like /images/stories/virtuemart/product/image.jpg in the url.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 17:17:07 PM
Now when the reload works thanks to your 'try/catch' solution I see another issue - issue with sub-menu items (rolling out items). The menu levels are distorted after we choose some of the variant of a product. By distorted I mean the sub-menu is in the same line as the main one (it's not rolling out outside)  When I took a look at the case thoroughly it looks like issue appears only for central variants of a product - when we choose the first one or the last one of the variants everything works fine... Very strange but it works that way...
Title: Re: Product reloading seems to doesn't work on IE9
Post by: AH on March 26, 2015, 19:30:29 PM
MOVE ON please !

Yes there are stats out there on users with IE8

Stick a banner up like the very well visited BBC.co.uk does if a visitor uses an outdated browser -

If they are still using XP or IE8 then it is time they progressed into the 21st century, they can always stick firefox on their machine and have an updated browser.

Why on Earth should the team waste time looking back at a browser that should be dead?



Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 19:54:25 PM
Yes, it should be but is not. IE still exists, many people use it, so you really thing the best solution is to MOVE ON? Do you think it's pleasure for me wasting my (and your time) to things like that? I just report bugs counting it manage to solve them. That's the idea of forum... If it's not possible, ok I will live further, but if it's possible why not to use of it? Do you think a banner will do the trick? I don't think so...
If VM devs' don't intend to deal with issues occurring on older browsers, please say it...
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 20:14:13 PM
Quote from: Milbo on March 26, 2015, 15:25:27 PM
what about the facebox?
I don't see facebox option in virtuemart configuration....
Title: Re: Product reloading seems to doesn't work on IE9
Post by: AH on March 26, 2015, 20:32:33 PM

Regarding Fancybox vs facebox

admin/configuration/templates

bottom right

Use Fancybox

untick to use facebox.




QuoteDo you think a banner will do the trick? I don't think so...
If VM devs' don't intend to deal with issues occurring on older browsers, please say it...

My aim is to say what I feel - not what will work for you and your clients.

And yes a banner would have some impact (better than not putting anything at all)  In fact I intend to add one on my site as soon as I finish typing this. 

I would like things to work for IE9 possibly, but I am not suffering the issues you are clearly having.

I appreciate that we all provide help and request help in these forums - but I hope the devs are looking forwards - not peering back into the mists of time
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 26, 2015, 20:45:02 PM
Quote from: Hutson on March 26, 2015, 20:32:33 PM
And yes a banner would have some impact (better than not putting anything at all)  In fact I intend to add one on my site as soon as I finish typing this. 
I definitelly agree: it would have some impact, but it doesn't resolve the issue completely.

Quote from: Hutson on March 26, 2015, 20:32:33 PM
I would like things to work for IE9 possibly, but I am not suffering the issues you are clearly having.
Do you mean ajax update work well for you on IE?
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 26, 2015, 22:33:28 PM
He is my tester and got my file. the ajax reload does not work, but a proper fallback.
Title: Re: Product reloading seems to doesn't work on IE9
Post by: AH on March 27, 2015, 00:23:26 AM
QuoteHe is my tester

I tested things to help out the project - I do not work for Milbo as a tester - LMAO

Hmmmm... Muhh

I also used IE8 not IE9
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Milbo on March 27, 2015, 09:53:12 AM
Hutson, I just removed the chains from you and directly you become cheeky. :-P
Title: Re: Product reloading seems to doesn't work on IE9
Post by: Miku on March 27, 2015, 13:21:33 PM
Quote from: Milbo on March 27, 2015, 09:53:12 AM
Hutson, I just removed the chains from you and directly you become cheeky. :-P
;D ;D ;D ;D ;D ;D ;D

Leaving the whole things not related to the issue...  The issue with ajax reload for IE8/9 was solved thanks to Milbo's fix.

        try {
            history.pushState(stateObj, "", url);
        }
        catch(err) {
            // Fallback for IE
            window.location.href = url;
            return false;
        }

Thank you

Two things:

1. As I wrote  -  when the ajax reload finally had started to work it turned out that (at least for me) there's an issue with joomla sub-menu items...

2. There's also unclear question of disable the feature of ajax reloading (in product details) by jdynupdate command in VM config which also seems to not working properly (at least for me ).
Quote from: Milbo on March 26, 2015, 08:50:44 AM
and a config to disable the dynupdate (hmm should be called reload, actually) is already there. jdynupdate, and here the tutorial how to set http://forum.virtuemart.net/index.php?topic=128956.0

Anyway the main issue was solved.