Google Static Map does not seem to work

Topics: General, Troubleshooting, Writing modules
Jul 20, 2013 at 5:16 AM
It installed properly. But I tried to add the widget to my homepage, it supposed to display the map fields such as latitude, longitude, etc. but it didn't. I tried to debug the code by adding a breakpoint at the Editor method of the driver but it did not stop there. The code looks OK. How to troubleshoot the problem?

Bernard
Developer
Jul 20, 2013 at 1:41 PM
Anything in the log files (App_Data/Logs)?
Jul 21, 2013 at 4:41 AM
orchard-debug-2013.07.09.log and orchard-error-2013.07.09.log are both empty. I see a lot of log files and they are empty. This module is pretty similar to the Maps module except that it has more map fields. By comparing the two modules, I noticed the GoogleStaticMap view in the Google Static Map module uses the T() method for each map field, whereas the Map view in the Map module doesn't. Does it require a PO file or something?
Developer
Jul 21, 2013 at 12:03 PM
No, if there's no PO file it will simply render the specified string.
Try this:
  1. Add the module to your Orchard solution file.
  2. Rebuild solution.
  3. Launch the site using CTRL+F5 and navigate to the page where you added the widget.
  4. In Visual Studio, go to Debug -> Exceptions and tick the "Thrown" checkbox for "Common Language Runtime Exceptions".
  5. Set a breakpoint in the Display method of your widget's driver.
  6. Attach the debugger to the web server process you're using.
  7. Switch back to your browser and refresh the page.
You should either hit the breakpoint or see an exception being thrown (or both).
If not, then something's not right with the module, but it's impossible to tell what without looking at all of its code.

Did you contact the owner of the module?
Jul 22, 2013 at 5:14 AM
I created a test page, add the GoogleStaticMap widget and put a breakpoint on the Display method and another one on the Editor method of the GoogleStaticMapDriver and refreshed the page. Both breakpoints don't get hit. However, when I put a breakpoint on the Display method and Editor method of the Maps module, they both get hit. I noticed when I add the GoogleStaticMap widget, it displays the Maps fields instead (Latitude and Longitude). Of course, when I display the test page, the Google Maps gets rendered and not the Google Static Map. I'm going to create my own version of Google Map and see what happens. It's really weird.
Jul 23, 2013 at 5:23 AM
I found the cause of the problem in the Migration file:
    public int UpdateFrom1()
    {
        // Create a new widget content type with our map
        ContentDefinitionManager.AlterTypeDefinition("GoogleStaticMapWidget", cfg => cfg
            .WithPart("MapPart")
            .WithPart("WidgetPart")
            .WithPart("CommonPart")
            .WithSetting("Stereotype", "Widget"));

        return 2;
    }
"MapPart" should be replaced with "GoogleStaticMapPart" because MapPart belongs to the Maps module.
I thought the problem is going to be solved by making that change. But it didn't change anything because the migration has already been run.
So, I added the following lines to the migration file:
    public int UpdateFrom3()
    {
        // Create a new widget content type with our map
        ContentDefinitionManager.AlterTypeDefinition("GoogleStaticMapWidget", cfg => cfg
            .WithPart("GoogleStaticMapPart")
            .WithPart("WidgetPart")
            .WithPart("CommonPart")
            .WithSetting("Stereotype", "Widget"));

        return 4;
    }
Now, I see the extra fields from the GoogleStaticMapPart in addition to the fields from the MapPart. How to fix this mess? Should I remove the GoogleStaticMap module and reinstall it or just fix the tables?
Jul 25, 2013 at 8:40 PM
I actually removed the module, fixed the GoogleStaticMap module package and reinstalled it. It works great now.