Hi, I'm posting here first in the hopes that this is something I have overlooked using the Views_PHP module.

I have created two custom PHP fields, one for Lat data, the other for Long. I have written the correct SQL to pull the information I need for these two fields and indeed I am able to get the data to show in the output tables that I created for the view.

My problem is getting the custom PHP fields to "pass" their values to the GMap module. Within the views GUI, the GMap module add-on GUI is made available, and the drop-down lists allow the selection for these two custom fields I have created for the latitude and longitude data. Unfortunately, it seems the data isn't being passed to the Gmap module, although the HTML output block shows the correct information.

I'm hoping my noobness is the problem here. I have tried converting the string to the decimal integer using floatval(), I have written the code into the Value box and Output box with the same results: that is, my HTML block displays correctly but the GMap is receiving nothing. I have spent so much time at this and I cannot figure this one out. If anyone has any suggestions, it would be greatly appreciated. BTW, I have tested the module using the latitude and longitude fields straight from the db and the map displays correctly. But I need to do a tricky SQL pull that requires me to use the Views_PHP fields.

Thanks!

Comments

I know this has been posted a long time ago but I stumbled upon this while searching for the solution to the same problem.

Anyway the problem seems to be that PHP values are not set in a row and you have to use computed fields module. Be sure to check the box for saving value to database. Without that it won't work for GMap (at least not as a marker set field).

If you already added some nodes then you can use views bulk operations module to re-save (node_save_action) all your nodes of given type. This will re-compute all your computed fields.