Mi primera decepción con Magento ha sido cuando he necesitado agregar una librería externa, en este caso era un pixel de seguimiento, pero podría haber sido algo tan trivial como meter jQuery en magento. En un principio intenté meterlo solo en las páginas que lo iba a necesitar usando el layout/page.xml pero al escribir:
1 |
<action method="addJs">https://ajax.googleapis.com/ajax/libs/jquery/x.x.x/jquery.js</action> |
Lo que me incluía era:
1 |
http://ruta_a_mi_website/https://ajax.googleapis.com/ajax/libs/jquery/x.x.x/jquery.js |
Investigando por google he encontrado en Inchoo:
Have you ever had a need for adding external files into your Magento layout? If you had then you know that you cannot do that from your xml layout files using methods/action. You could do that by hard-coding your “head.phtml” file, but then those external files will be loaded on all Magento pages.
Afortunadamente nos dan una opción que no es meter el script en el header, os recomiendo pasaros y echar un ojo a su artículo: How to add an external javascript/css file to Magento?
Comments are closed.