How to create Featured product in Magento home page?
-
zendnwar
-
March 23, 2015
-
Magento
-
236 Comments
Create new Featured attribute Create a new attribute by going to Catalog > Attributes > Manage Attributes > Add New Attribute. Attribute Properties Attribute Identifier: featured Scope: Store View Catalog Input Type for Store Owner: Yes/No Unique Value (not shared with other products): No Values Required: No Input Validation for Store Owner: None Apply To: All Product Types Front End …
Continue Reading
Explain class naming conventions and their relationship with the autoloader
-
zendnwar
-
March 23, 2015
-
Magento
-
0 Comments
Magento was developed based on the Zend Framework, so the rules of class naming in Magento were taken from the Zend Framework (read more here). Magento standardizes class names depending on their location in the file system. Such standardization enables automatic class loading (autoloader) instead of using require_once and include_once functions. Rather than the directory separator (‘/’ – invalid character …
Continue Reading
Describe Magento Codepools
-
zendnwar
-
March 23, 2015
-
Magento
-
0 Comments
Magento has three different codepools: Community Core Local Core pool First of all, this folder stores all the code that makes Magento so powerful, flexible and lovely. The chief rule of Magento development is that you should never make any changes in it. In other words, this folder belongs to Magento core developers only and if you are going to …
Continue Reading
Magento Sample Question & Answer
-
zendnwar
-
March 18, 2015
-
Magento
-
0 Comments
Q. How will you log current collection’s SQL query? A. $collection->printLogQuery(true); OR $collection->getSelect()->__toString(); Q. How to get first item or last item from the collection? A. $collection->getFirstItem() and $collection->getLastItem(); Q. Where is the relation between configurable product and it’s simple product stored in database? A. In the 2 tables: catalog_product_relation catalog_product_superlink_table Q. What are the commonly used block types? What …
Continue Reading
Mage_Core_Block_Text in Magento
-
zendnwar
-
March 18, 2015
-
Magento
-
0 Comments
It inherints directly from Mage_Core_Block_Abstract and extends its base class only with three methods: 1. public function setText($text) 2. public function addText($text, $before=false) {} 3. public function getText() The block only stores a text string (it could be plain or html of course), and during rendering phase, the block simply outputs the stored string. You could set the string to …
Continue Reading
Mage_Core_Block_Template in Magento
-
zendnwar
-
March 18, 2015
-
Magento
-
1 Comment
The most important feature of this type of block is of course that you can asign it a template file for rendering. That template will be a file stored on the theme level, so we could say this block is maybe the base block for Magento support of themes. When the block it’s going to be rendered, Magento looks for …
Continue Reading
What is a difference in rendering process for different types of blocks in Magento?
-
zendnwar
-
March 18, 2015
-
Magento
-
0 Comments
Mage_Core_Block_Text : This is a simple text block so it is not usual that it has child. If so, they will not be automatically rendered, and you would need to render it manually in code. Mage_Core_Block_Template : Childs of template based block renders when calling getChildHtml from template file. The block should be defined as child either by layout directive …
Continue Reading
Which class is responsible for creating an instance of the block in Magento?
-
zendnwar
-
March 18, 2015
-
Magento
-
0 Comments
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. public function generateBlocks($parent=null) { // some code here }
Continue Reading
Is it possible to have a block without a template in Magento?
-
zendnwar
-
March 18, 2015
-
Magento
-
0 Comments
Of course yes… in fact, the only predefined block class in Magento that uses a template file is Mage_Core_Block_Template. It is the most used, but not the only block class in Magento. Other classes in Magento like Mage_Core_Block_Text or Mage_Core_Block_Text_List doesn’t use a template file.
Continue Reading
How $this variable work inside the template file in Magento?
-
zendnwar
-
March 18, 2015
-
Magento
-
0 Comments
In Magento, the template file for each block is ‘included’ by a php include directive during the render phase, so it´s clear that $this inside a template file, always refer to the block class instance. The include is done in the fetchView() method of Mage_Core_Block_Template.
Continue Reading