mhirdes / go_maps_ext

Google Maps Extension for TYPO3
MIT License
21 stars 30 forks source link

Not working in TYPO 3 v9.5.6 on all sites #57

Closed the-hotmann closed 4 years ago

the-hotmann commented 5 years ago

Workes in TYPO3 v9.5.5 but is not working anymore in TYPO3 v9.5.6. MAP is just not shown, but source-code contains the div <div class="js-map" id="gme-1"></div>

Getting a JS Error: (at the end of this line)

gme.ll={};gme.ll.alert="Bitte geben Sie eine gültige Adresse ein.";gme.ll.submit="Route berechnen";gme.ll.noSearchResults="Die Suche lieferte keine Ergebnisse.";gme.ll.infoWindowLinkText="Route berechnen

Getting this Error with 2 TYPO 3 Installations which I both updated to v9.5.6, had no problems before.

Tested on v3.1.0 and 3.1.1-dev

@mhirdes sorry for tagging but this problem now also occurs at a third installation by updating to 9.5.6

the-hotmann commented 5 years ago

Can someone aprove/disprove this issue???

the-hotmann commented 5 years ago

Justed tried it again in a Installation wich no other Extensions. What I have enabled: (But also had this in v9.5.5 and worked!)

  compressCss = 1
  concatenateCss = 1
  compressJs = 1
  concatenateJs = 1

The same error: unexpected end of JS File.

the-hotmann commented 5 years ago

Damn what a strange Error... found it!

This Line: https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Resources/Private/Partials/Map/Assign.html#L149

Change "jQuery" to "$" as recommended at resize() here: https://api.jquery.com/resize/

and the Error is gone. Maps works again as expected!!!

Pls fix this. I tested it in 4 installations and it works properly in all of them, even if they are not configured the same.

Not necessary but recomended: I would also do the same at L146

Also possible (but would not recommend it) Use noConflict() at jQuery Think this is a scope issue.

PascaleBeier commented 5 years ago

Are you using the jquery version bundled with go_maps_ext or another one?

the-hotmann commented 5 years ago

I'm not using the jQuery from the Extension. I use the one whioch comes with the Template (original Query 3.3.1.min.js)

On TYPO3 9.5.5 everything was normal and working, since 9.5.6 the Map is not showing up and a JS Error gets thrown untill you replace jQuery with $.

But the question is: does this Extension work for you on TYPO3 9.5.6? Try to flush all caches and test it in the frontend.

PascaleBeier commented 5 years ago

Yes, it does work for me.

Try entering jQuery into Browser Console. If this does not return the jQuery function Object, there is something wrong with the jQuery Library integration.

As long as the jQuery Browser Global is available, there are no issues with the JavaScript. Maybe we should add this to the Documentation.

the-hotmann commented 5 years ago

Hm I'm using TYPO3 9.5.6 in 4 Installations. One of them uses Bootstrap Package. (pretty well known Themplate/Extension) And also there it does not work at TYPO3 9.5.6 (but did (like at the 3 others aswell) at TYPO3 9.5.5.

The solution was to edit it how I said. The point is that if I do not edit it the gegenration of "ext/go_maps_ext/Resources/Private/Partials/Map/Assign.html" will stuck at: gme.ll.infoWindowLinkText = "<f:translate key="LLL:EXT:go_maps_ext/Resources/Private/Language/locallang.xlf:tx_gomapsext_partials_map_assign.infoWindowLinkText" />"; L145

Then a JS file gets generated which ends like this:

gme.ll.infoWindowLinkText="Route berechnen (even the closing " is missing)

I checked the File on the Server and it was a File which abrupt stopped after berechnen

mhirdes commented 5 years ago

ok. I now check if jQuery || $ is defined. please check.

the-hotmann commented 5 years ago

ok. I now check if jQuery || $ is defined. please check.

I updates to the lasted dev-version. But then I still got the same Error:

Unbenannt

Same Error same place in the document is getting force quited

EDIT: I'm on TYPO3 v9.5.7 now, but this I think will not change anything

mhirdes commented 5 years ago

What happens if you remove the line with "Route berechnen" in the Assign.html?

the-hotmann commented 5 years ago

Already tried it. Nothing happens.

The .js File which gets generated stucks after this and the error makes it break there.

I also wrote what fixed this issue. Thats the only thing fixing it (yet). Do you also encounter this problem? I got this on 4 Installations. One of them is based on bootstrap_package. (version 9.1.2)

contechno commented 5 years ago

I´m having the same issue here using Typo3 9.5.8 and go_maps_ext 3.1.0.

The JS generation stops after the line 145 in go_maps_ext/Resources/Private/Partials/Map/Assign.html: gme.ll.infoWindowLinkText = "<f:translate key="LLL:EXT:go_maps_ext/Resources/Private/Language/locallang.xlf:tx_gomapsext_partials_map_assign.infoWindowLinkText" />";

So the line 146 var $element = jQuery("#" + gme.mapSettings.id); seems to throw the error.

Replacing jQuery with $ didn´t work (And "jQuery" returns something when put in the console). Also, I changed the variable name "element", didn´t worked out neither.

Any idea how to fix that? I really like the extension and use it quite often because of it´s great functionality, it´d be a pity if it´s not working anymore

benjaminmeissner commented 5 years ago

First of all: Can reproduce this error with own Jquery Version (hat installed latest few weeks back) and same Typo3 Version. Obviously you have to ensure your own Jquery version loads before the scripts included by this Plugin.

Damn what a strange Error... found it!

This Line: https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Resources/Private/Partials/Map/Assign.html#L149

Change "jQuery" to "$" as recommended at resize() here: https://api.jquery.com/resize/

After that I ran into another JS error

VM1253 vhs-assets-jquery-js.js:3818 jQuery.Deferred exception: $element.gomapsext is not a function TypeError: $element.gomapsext is not a function
    at HTMLDocument.<anonymous> (http://my-customer.tld/typo3temp/assets/js/b57b9e9d53.js?1566900130:99:14)
    at mightThrow (http://my-customer.tld/typo3temp/assets/vhs-assets-jquery-js.js?1566900292:3534:29)
    at process (http://my-customer.tld/typo3temp/assets/vhs-assets-jquery-js.js?1566900292:3602:12) undefined

Problem was Located a few lines above https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Resources/Private/Partials/Map/Assign.html#L146

Replaced jQuery with $ here and maps load. This is strangely not working for @contechno . (does the stacktrace stay the same for you after applieng the Fix?)

Unfortunately cant look into this in more depth right now. My Map is loading right now wich was my immediate goal. Maybe i can have a look into it in the future, cant promise though

the-hotmann commented 5 years ago

Unfortunately cant look into this in more depth right now. My Map is loading right now wich was my immediate goal.

Happy the fix is working for you. I think I know what causes the main problem.

I will provide a screenshot soon

The Errorcode is the following:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/domain.tld/httpdocs/hafen/typo3_src-9.5.9/vendor/typo3fluid/fluid/src/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php line 180 | TYPO3\CMS\Core\Error\Exception thrown in file /var/www/vhosts/domain.tld/httpdocs/hafen/typo3_src-9.5.9/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 124. Requested URL: https://domain.tld/kontakt

go_map_ext error

the-hotmann commented 5 years ago

https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Resources/Private/Partials/Map/Assign.html#L146

Replaced jQuery with $ here and maps load. This is strangely not working for @contechno . (does the stacktrace stay the same for you after applieng the Fix?)

Thats exactly what I said, but for me it worked (with erros) in life-mode, if I'm in debug-mode it still thow errors. Thats why I wrote:

Not necessary but recomended: I would also do the same at L146

Now it is working but the problem is not even the jQuery versiopn or anything else, but the generation of the JS File! Fluid just stuck there and noone knows why.

I personaly made a Version from 3.1.1-dev which got that fix: go_maps_ext.zip

Just upload it to typo3/typo3conf/ext and overwritethe existing files

the-hotmann commented 5 years ago

@mhirdes will this be fixed? As go_maps_ext is said to be TYPO3 9.5.0-9.5.99 compatible but v3.1.0 (the official one) is not working on any TYPO3 9 Versions

benjaminmeissner commented 5 years ago

Happy the fix is working for you. I think I know what causes the main problem.

I will provide a screenshot soon

The Errorcode is the following:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/domain.tld/httpdocs/hafen/typo3_src-9.5.9/vendor/typo3fluid/fluid/src/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php line 180 | TYPO3\CMS\Core\Error\Exception thrown in file /var/www/vhosts/domain.tld/httpdocs/hafen/typo3_src-9.5.9/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 124. Requested URL: https://domain.tld/kontakt

Okay. This seems to be a different error than we were talking about (at least i was). We were talking about map Frame Rendering but no map Loading due to an JS Error, didn't we? If not apologies for assuming it.

Also: ist this the Full Stacktrace? Surly a screenshot of a stacktrace can be very big. You alternatively could save the stacktrace as HTML. Replace Your clients name in the whole HTML File and provide the full stacktrace as HTML.

I'm Guessing all of your installations happen to be installed in Composer mode? Your Stacktrace kind of suggests that, at least for this installation. Does this error also appear with a non composer Installation too?

Are all your Installations located on the same Server? If so: does the error persist when copying the installation to a local test enviroment?

the-hotmann commented 5 years ago

Yes we are talking about the same issue, the error I posted is the main problem and shows that the JS-Generation stuck because of this error I posted.

Just reproduce the error and check the generated JS File. It just ends where it should not. That is causing the JS Error and the not loaded Map

NormenKD commented 4 years ago

Hey, i'm currently dealing with the same issue on a TYPO3 9.5.9 / Apache 2.4.18 / PHP 7.3.9 system.

1476107295 TYPO3\CMS\Core\Error\Exception

PHP Warning: Invalid argument supplied for foreach() in /home/XXX/typo3/typo3_src-9.5.9/vendor/typo3fluid/fluid/src/Core/Parser/TemplateProcessor/NamespaceDetectionTemplateProcessor.php line 180

I can't really explain the root cause at the moment, but i also found a workaround (and a really weird one, too). Just deleting at least 3 or more leading spaces in a line in the partial "Assign.html" i can get it to work (adding them back and flushing the cache also brings the error back). Specifically here seems to do the trick for me: https://github.com/mhirdes/go_maps_ext/blob/fc464d2ec4838add7748b4273e7f8b2a458aad79/Resources/Private/Partials/Map/Assign.html#L150

I know this seems really weird, but i thought maybe this could lead to a better understanding of the underlying cause. Might be some kind of string parsing/allocation issue with ViewHelpers, and the "Change jQuery to $" thing from earlier was related to changing the string around that area slightly instead of having something to do with JavaScript syntax. But this is pure conjecture on my part, i currently have no further evidence on this.

the-hotmann commented 4 years ago

Yeah this issue is open now for monthes and they dont care about.

But interesting fact, will try it.

mhirdes commented 4 years ago

Hi, sry, but we couldn't reproduce the error. If you add a pull request we will integrate your solution.

mhirdes commented 4 years ago

Recommended solutions of this thread are now integrated, feel free to test and sry for the late response.

the-hotmann commented 4 years ago

Its working now. Also the other multilanguage Bug is gone #55

Maybe releasing the next Version (maybe 3.1.1?) with this fixes would be a good idea. Also the Version 3.1.0 should be marked as "not working properly" in the TYPO3 Extension-Repo ( https://extensions.typo3.org/extension/go_maps_ext/ )

Gonna test this extension on TYPO3 v10.x soon and report back