Reputation: 38805
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<block type="catalog/product_list"...>
I have studyed http://magebase.com/magento-tutorials/demystifying-magentos-layout-xml-part-1/, it mention that a type attribute, which defines the block class name.
In the code above, catalog/product_compare_sidebar and catalog/product_list should be a block class, so, where is the location of the php file that declared these block(Any hint from "catalog/product_compare_sidebar" and "catalog/product_list")?
There are many block type, how can I know which block type is available and how to choose which block type is suitable for the existing block?
Thanks you
Upvotes: 1
Views: 568
Reputation: 23255
here is the association:
catalog/product_compare_sidebar => /app/code/core/Mage/Catalog/Block/Product/Compare/Sidebar.php
catalog/product_list => app/code/core/Mage/Catalog/Block/Product/List.php
If you use eclipse PDT, just press Ctrl+Shift+T and type: *Catalog*Product_Compare_Sidebar to find the first class.
UPDATE: Searching for "class Block" will give you all the available block types. If you use eclipse PDT, just press Ctrl+Shift+T and type: Block . The paragraph at the end of your link describes the most important one fairly well. Personnaly, I often create my own type and inherit from Mage_Core_Block_Template , or use it directly.
UPDATE_2: In Mage_Core_Block_Abstract, you can see this method
/**
* Set block attribute value
*
* Wrapper for method "setData"
*
* @param string $name
* @param mixed $value
* @return Mage_Core_Block_Abstract
*/
public function setAttribute($name, $value=null)
{
return $this->setData($name, $value);
}
I think it must be called on each xml attribute somewhere. To know where, simply put a breakpoint here, or die here and look at the stack trace.
Upvotes: 2