Parece que los chicos de Zend Framework no se terminan de enterar, y muchos años después de la publicación de la primera versión de esta plataforma, nos seguimos encontrando con que los textos con formato moneda siguen apareciendo con el símbolo delante del precio. Por supuesto, en Magento tenemos el mismo problema, así que ahí […]
Magento certification: Which layout nodes correspond to certain URL
The way Magento loads the layout starts when the controller serving the current request calls to: $this->loadLayout(); This call starts the process of compiling and generating all the blocks that will be used in a later phase to generate the current page contents. The process of geting the proper nodes from the layout requires the […]
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 y el bug «El carrito está vacío» en Internet Explorer
Van ya tres años con este que por estas fechas recibo en la oficina algunas llamadas con lo que aquí llamamos el bug del verano de Magento. El proceso es siempre similar: El propietario de una tienda Magento al que su servicio de mantenimiento no hace caso, llama desesperado porque hace semanas que recibe llamadas […]
Custom variable programmatically in Magento
This post continues the previous one about using Custom Variables in Magento. This time we will create a new Custom Variable programmatically, which is useful if you develop a custom extension and need to save some data. Some people ask me sometimes, why not use config data, which also provides a similar way of storing […]
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 […]
Create custom variables in Magento
One of the less commented features in Magento are the Custom Variables. Much of the stores I see developed by others, don’t use this feature, but it’s the easiest way to store information from a custom extension or even custom data about our store. Let’s say for instance you need to put in the frontend […]
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 […]