Closed (fixed)
Project:
Google Places for Drupal
Version:
7.x-1.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2018 at 14:16 UTC
Updated:
3 May 2018 at 05:04 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
hargobindCan you please post a screenshot of your "Manage fields" page for your content type? That will help me determine which modules you are using to add the data to each field.
Comment #3
hiramanpatilI have followed the readme file to create required fields. When I save or update the node, the title of the node gets updated with place name. And also few terms gets added in taxonomy field.
There is no data in rest of the fields. No errors in error log as well.
Attached is the screen shot of manage-fields page of the content type.
Comment #4
hargobindDid you enter your Google Places API Key as listed in step # 3 of the instructions? If you need an API key, follow this guide.
If you are using a Geofield to store the Latitude/Longitude, you'll need to enter your API key on the configuration screen of that module too.(Nevermind that last sentence, it was incorrect.)Can you also post a screenshot of the field configuration page for your Google Place ID field?
Please also type out the Place ID that you are trying to look up so I can test it on my end.
Can you also test out both of these place IDs and see if they work for you? They seem to fill all of the fields on my end.
NYC Health + Hospitals/Metropolitan (New York, USA) - ChIJG1z-2KhYwokRhPmjewNNWcc
Fortis Healthcare Limited (Delhi, India) - ChIJz3GebiACDTkRtGjNGCZUlrA
Comment #5
hiramanpatilYes, I have entered Google Places API key with the help instructions given here - Get API Key.
I have tried both places which you have given but only title of the node gets updated when node is saved.
1) NYC Health + Hospitals/Metropolitan -
ChIJG1z-2KhYwokRhPmjewNNWcc2) Fortis Healthcare Limited (Delhi, India) -
ChIJz3GebiACDTkRtGjNGCZUlrAI am using Geofield but didnt find configuration page for this module. Checking/Debugging Geofield to get configuration page to save Google Places API Key.
Please find attached screenshots of Google Place id field settings.
Thanks,
Comment #6
hargobindAre any of the other fields even partially filled in? If so, that might tell us where it is failing.
The original screenshot shows "Malaysia" as the country, so I'm wondering if maybe that address field is configured in a way that is causing the problem. Can you show me your configuration of the address field? Also, maybe try and remove the address field temporarily and see if the other fields get populated.
You could also try debugging the return values to see if that holds an answer. First, go to the config page and change "Cache results" to "Disabled". Next, on roughly line 524 of
gp.module, there's a line that says//watchdog('gp', '<pre>' . print_r($place, true) . '</pre>');. Remove the//from the beginning of that line. Then edit the node and just press Save. Then check your log and paste the "Message" contents of that log entry. Then re-add those slashes to disable the log message.Comment #7
hargobindMore questions to help figure this out...
Are your fields assigned to a standard node, or a custom entity, or something else?
Is your site multilingual? Are you using any content translation modules to to translate entities or fields?
I may have found the source of this when I was testing using fields on a custom entity and $entity->language was set to a custom language. I'm going to test it further try out a change to the code.
Comment #8
hargobindI ran into a bug with my own testing on a custom entity where the
$entity->languagewas set to a value likeen. Then when the other fields were populated, they were using the entity language rather than the$langcodewhich was being passed togp_field_presave().This is how the code appears when assigning a value to the other fields:
$entity->{$field_name}[$entity->language] = array(...some value...);And this is what I changed to get it working on my end:
$entity->{$field_name}[$langcode] = array(...some value...);I don't have time to create a multilingual installation and test it all, but I have attached patches which you can apply against the 1.2 stable release or the latest 1.x-dev version to test. Please let me know if this solves the issue for you. Also let me know if you cannot apply the patch and I'll send you a modified copy of the module file.
Comment #9
hargobindFound a couple of bugs with my last approach, so please try these patches instead.
Comment #10
hargobindComment #11
maxchock commentedComment #12
maxchock commentedI've uploaded the manage field per request.
Comment #13
hargobindThanks Max. Can you try one of the patches that I attached above and let me know if it works for you?
Comment #14
hargobindMy testing indicates that the issue appeared specifically on multilingual sites. Fields were being set using the wrong language variable.
I updated the code to see if the field is translatable, and store the values in the correct language index.
I know I'm jumping the gun on this by committing changes, but I never heard back from anyone regarding the proposed patches. I'll offer a release candidate (1.3-rc1) for people to test out. If anyone finds issues with the changes, please reopen the issue and let me know ASAP.