:::: MENU ::::
Articulos en: Magento Certification

Magento certification: Describe various ways to add and customize JavaScript to specific request scopes

Which block is responsible for rendering JavaScript in Magento? Both, css and js files in Magento, are managed by the block Mage_Page_Block_Html_Head. This block has methods for adding files to the html head section of any page in a Magento store. The main method to add files is the following: function addItem($type, $name, $params=null, $if=null, […]

Magento certification: Create and add code to pages

How can code be modified or added to Magento pages using the following methods? Magento is known by its great flexibility to add custom code or modifying the existing one. For that you can explore multiple possibilities. The next sections shows some of them, but there are much more you can explore by yourself. Template […]

Magento certification: Register layout XML files

How can layout XML files be registered for the frontend and adminhtml areas? In Magento, you may register a new Layout XML file with layout updates by adding this piece of XML to your module config.xml <layout> <updates> <anyuniquename> <file>nv/homelayout.xml</file> </anyuniquename> </updates> </layout> If you need the layout file to apply to the Magento frontend, […]

Magento Certification: Describe the elements of Magento’s layout XML schema

The directive <update> in the Magento Layout The update tag is used to combine a particular layout handle into other. Let’s see an example: <my_custom_handle> <reference name="content"> <block type="core/template" name="myblock" template="myblock.phtml" /> </reference> </my_custom_handle> <other_hanlde> <update handle="my_custom_handle" /> <reference name="content"> <block type="core/template" name="otherblock" template="otherblock.phtml" /> </reference> </other_handle> The previous fragment would be in fact, as […]

Magento Certification: Rendering Blocks (part 7)

Explain different mechanisms for disabling block output In which ways can block output be disabled in Magento? There are some ways you can disable the block output in Magento. Remove a block from the layout in Magento In the layout files, you can set a remove node to disable the block. This will not only […]

Magento Certification: Rendering Blocks (part 5)

Identify different types of blocks in Magento In this article we will check for the main characteristics of some of the pre-defined blocks in Magento. What is the purpose of each of the following block types Mage_Core_Block_Template Mage_Core_Block_Text_List Mage_Core_Block_Text Mage_Core_Block_Template It is for sure the most used block in Magento. The most important feature of […]

Magento Certification: Rendering Blocks (part 4)

Describe events fired in blocks How can block output be caught using an observer? During the render phase, Magento calls the method toHtml for each block that is needed in the page being generated. If you take a look at the Mage_Core_Block_Abstract::toHtml method, you’ll see that Magento fire a couple of events, one at the […]

Magento Certification: Rendering Blocks (part 6)

Describe block instantiation Block instantation in Magento takes place when the controller calls the method loadLayout. public function loadLayout($handles = null, $generateBlocks = true, $generateXml = true) { . . . // add default layout handles for this action $this->addActionLayoutHandles(); $this->loadLayoutUpdates(); if (!$generateXml) { return $this; } $this->generateLayoutXml(); if (!$generateBlocks) { return $this; } $this->generateLayoutBlocks(); […]

Magento Certification: Rendering Blocks (part 3)

Describe the stages in the lifecycle of a block Which class is responsible for creating an instance of the block? In Magento, the whole block hierarchy during a page generation is created by the class Mage_Core_Model_Layout. The method generateBlocks is responsible of that. Let’s take a look… public function generateBlocks($parent=null) { if (empty($parent)) { $parent […]

Magento Certification: Rendering Blocks (part 2)

Describe the relationship between templates and blocks Can any block in Magento use a template file? The template file usage in Magento is restricted to Mage_Core_Block_Template and blocks inheriting from it. Other blocks in Magento like Mage_Core_Block_Text does not inherit from it but from Mage_Core_Block_Abstract so it cannot use a template file for rendering. How […]