Magento front end developer certification is an exam that requires a clear understanding of Magento’s components and the ability to operate with them in order to modify the user interface according to the recent trends. By passing the exam, the developer proves his level of knowledge and shows how familiar he is with Magento.
We represent FAQs about Magento 1 front end components to help developers get knowledgeable about the topic.
How to include custom JavaScript on all pages
In order to add a custom JS file on all pages, you need to include the script file (for example, test.js) in the local.xml file app/design/frontend/our_package/our_theme/layout/local.xml with the commands:
If we add the script for some certain theme, then we use the following command:
1 |
<action method="addItem"><type>skin_js</type><name>js/test.js</name></action> |
and the script file must be located in skin/design/frontend/our_package/our_theme/js/test.js
The file will be as follows:
1 2 3 4 5 6 7 8 9 10 |
<?xml version="1.0"?> <layout version="0.1.0"> <default> <reference name="root"> <reference name="head"> <action method="addItem"><type>skin_js</type><name>js/test.js</name></action> </reference> </reference> </default> </layout> |
Where “default” is a handle specifying that the file is added to all pages.
If we add the script globally, then we use the following command:
1 |
<action method="addJs"><script>test.js</script></action> |
and the script file must be located in magento root directory/js/test.js
How to include custom JavaScript on specific pages
In order to add a custom JS file on specific pages, you need to include the script file (for example, test.js) in the local.xml file app/design/frontend/our_package/our_theme/layout/local.xml with the commands:
If we add the script for some certain theme, then we use the following command:
1 |
<action method="addItem"><type>skin_js</type><name>js/test.js</name></action> |
and the script file must be located in skin/design/frontend/our_package/our_theme/js/test.js
Here is an example of adding a JS file on the product page:
1 2 3 4 5 6 7 8 9 10 |
<?xml version="1.0"?> <layout version="0.1.0"> <catalog_product_view> <reference name="root"> <reference name="head"> <action method="addItem"><type>skin_js</type><name>js/test.js</name></action> </reference> </reference> </catalog_product_view> </layout> |
Where “catalog_product_view” is a handle specifying that the file is added to all product pages.
If we add the script globally, then we use the following command:
1 |
<action method="addJs"><script>test.js</script></action> |
and the script file must be located in magento root directory/js/test.js
More FAQs you can find in the articles to be published soon. Subscribe to stay tuned.
Magento Custom Development
Take your online store to the next level with BelVG Magento custom development
Visit the pageNeed expert Magento audit services? Turn to BelVG!