What is the difference between
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
and
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
Someone kindly explain.
categorymagento-1.9
What is the difference between
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
and
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
Someone kindly explain.
Best Answer
There are 2 different objects.
A category model is the mapping of a model to the category tables.
A category has a many to many link to the products.
A category usually appears in the top navigation menu.
A layer model does not have a table behind it and it is in charge of the layered navigation.
A layer model has filters associated to it and one of the filters is the list of subcategories for the current category you are viewing.
A layer model does not need a category to display products. It is also used in search results.