John Dugan
John Dugan

Reputation: 789

Echo Specific Category Description on Magento Frontend

I want to create a page in the Magento CMS, then echo specific category descriptions on it. What is the code snippet i will need to accomplish this. I am assuming I will need to reference the categories' unique id within the database to echo their description...

thanks for the help!

john

Upvotes: 1

Views: 1865

Answers (1)

Vitamin
Vitamin

Reputation: 1526

Using PHP:

$categoryId = 15;
$category = Mage::getModel('catalog/category')->load($categoryId);
if($category->getId()) {
    echo $category->getDescription(); // Should escape this, blocks have $this->escapeHtml()
}

I don't know how to do this using magentos email/cms template markup (I don't think its possible) - unless you create a block or widget.

Upvotes: 3

Related Questions