I'm trying to add the Google Maps Javascript API to my Magento module.
The problem I'm having is that the core/text
block that I am including, that contains the external Javascript inclusion tag, only ever appears after all of the addJs
actions.
This means the script I have in pvtl_stores.js
that targets the google
object doesn't work as the google
object hasn't been initialized yet.
Here is my local.xml
file:
<layout>
<default>
<reference name="head">
<block type="core/text" name="google.maps" before="root">
<action method="setText">
<text><![CDATA[<script src="//maps.googleapis.com/maps/api/js"></script>]]></text>
</action>
</block>
<action method="addItem">
<type>skin_js</type>
<name>js/pvtl_stores.js</name>
</action>
</reference>
</default>
</layout>
Is there a way to have the core/text
block load before the addJs
actions?
By the way, if it isn't obvious by the question, I'm new to Magento programming!