Magento Expert Forum - Improve your Magento experience
-
URL key of a category in Magento
How can I get the URL key of a category in Magento. I have added this text in URL key field -
This is the code which I am trying -
$_categories = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('name')
->addAttributeToSelect('is_active');
<?php foreach($_categories as $_category): ?>
<a href="<?php echo $_category->getCategoryUrl($_category); ?>">
<?php endforeach; ?>
My output is showing like this -
<a href="">
<span>Manual Tile Cutters</span>
</a>
View more threads in the same category:
-
-
Junior Member
Try this, let me know for the further help.
Mage::getModel('catalog/category')->loadByAttribute('url_key', 'the-key-goes-here');
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks