Hi Meia,
Sure, please see below. The funny thing is the map was working just fine until last week when I accidentally erased my code…so just trying to figure it out again. Suggestions appreciated!
Thanks,
Josh
$w.onReady( function () {
$w(“#dynamicDataset”).onReady( () => {
let currentItem = $w(“#dynamicDataset”).getCurrentItem();
$w(“#googleMaps1”).location = {
“latitude”: currentItem.latitude,
“longitude”: currentItem.longitude,
“description”: currentItem.mapdescription
};
} );
} );
Liran (or others), do you think you might please see why the code above for my dynamic google map is not working? Thanks. : )
Update: it’s working now! : ) For any others who are wondering the solution, just use the code that Meia Ponta Capezio kindly provided above. Thank you, Meia.
Hello
I have a similar Dynamic page, but some times we don’t have a the values for
“latitude”: currentItem.latitude,
“longitude”: currentItem.longitude,
How would we create an if statement to hide/remove the google map?
I’m using this code and it works great when I have the values.
$w.onReady( function () {
$w(" #dynamicDataset “).onReady( () => {
let currentItem = $w(” #dynamicDataset “).getCurrentItem();
$w(” #googleMaps1 ").location = {
“latitude”: currentItem.latitude,
“longitude”: currentItem.longitude,
“description”: currentItem.mapdescription
};
} );
} );
Any help would be appreciated.
I have a WIX website for rental properties (vivaagusto.com). I am converting it to work off dynamic pages (to reduce the maintenance overhead in adding new properties i.e. to add a new property I only need to add items to the properties database).
The bulk of it is converted, but I am stumped by the embedded google map. There does not seem to be a way to do this through WIX directly.
I find this frankly astonishing since anybody working with property would want to do this, and really it ought to be trivial to pull the latitude and longitude out of a database.
Looking online, there are lots of people having the same problem. (This is how I ended up here). Everyone seems to be solving this problem by coding in Corvid? A lot of people seem to be struggling with the code. I´m not surprised as WIX is “sold” on the idea that you can set up websites without having coding skills. It is in fact why I chose WIX.
The piece of code that is provided by Meia Ponta Capezio is only a few lines which I could cut and paste, but I have no idea where to cut and paste it to. Is there a Corvid tutorial for people who actually don´t want to code, but just want to cut and paste a sample to get something going and forget about it? Corvid for Dummies? Or should that be Corvid for Lazy Dummies?
Any help would be much appreciated.
OK. With a bit of inspired clicking I sorted it out for myself in 10 minutes by cutting and pasting Meia´s code. I´ll grant it is not that complicated. However, I still think it´s such a basic thing that it ought to be provided as “standard” within the main WIX product.
And just in case someone like me ends up here, these are the simple steps needed to cut´n´paste the code.
- At the top of the WIX editor, there is a horizontal menu. Click on “Dev Mode”. Chose “Enable Corvid”.
- There should now be a horizontal menu at the bottom of the page for Corvid. Click on “xxxx Page Code” where “xxxx” is your page name I guess.
- You should see something that starts $w.onReady( function () and ends with }); You copy Meia´s code here, though you don´t need the first and last lines, because those are already in the editor. 4) Make sure that “latitude”, “longitude” etc are as spelled in your database. (Or do as I did to test it, just put some random numbers in and see where you end up!)
- Preview the website in the normal way.