We will write code to get current category details in magento, so we will get the below category information.

  • Id
  • Name
  • Url
  • Description
  • Level
  • Image Url
  • Thumbnail Image Url
  • Product Collection

First you will need to get current category id and after that load category model by this id, below is the code.

$cat_Id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();

$category = Mage::getModel('catalog/category')->load($cat_Id);

$catName = $category->getName();//get category name

$catUrl = $category->getUrl();// get category url

$catDesc = $category->getDescription();//get category descriptions

$catLevel = $category->getLevel();//get category level

$catImage = $category->getImageUrl();//get category image url

$catThumbnail = $category->getThumbnail();//get category thumbnail

Magento get products collection by category id

$cat_id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
$categoryProducts = Mage::getModel('catalog/category')->load($cat_id)
foreach( $categoryProducts as $product){
echo $product->getId()."<br>";
echo $product->getName()."<br>";
echo $product->getPrice()."<br>";