I am a novice in magento but am trying to learn it in the least possible time. I Was going through: http://alanstorm.com/layouts_blocks_and_templates which says:
File: app/design/frontend/base/default/template/catalog/product/list.phtml contains :
<?php $_productCollection=$this->getLoadedProductCollection() ?> <?php if(!$_productCollection->count()): ?> <div class="note-msg">
<?php echo $this->__("There are no products matching the selection.") ?> </div>
<?php else: ?>
The getLoadedProductCollection method can be found in the Template’s Block, Mage_Catalog_Block_Product_List ... and from there:
File: app/code/core/Mage/Catalog/Block/Product/List.php
...
public function getLoadedProductCollection()
{
return $this->_getProductCollection();
}
...
After that , the aforementioned page writes : The block’s _getProductCollection then instantiates models and reads their data, returning a result to the template.
I am just at a loss here. _getProductCollection() has this line:
if (is_null($this->_productCollection))
1) Does _productCollection mean the protected variable $_productCollection ?
if (is_null($this->_productCollection)) {
$layer = $this->getLayer();
2) What is the explanation of $layer = $this->getLayer() plz?
After that I get:
if ($this->getShowRootCategory()) {
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
}
3) Where is the method getShowRootCategory() ?
4)What approach can help me understand the pros and cons of the line :
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
5) My questions may sound so easy to many. But can you refer to any online resource to learn all these things and others as a beginner of magento?
Good Luck