Magento Expert Forum - Improve your Magento experience

Results 1 to 2 of 2

URL key of a category in Magento

  1. #1
    New member
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post 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:


  2. #2
    Junior Member Ocodewire's Avatar
    Join Date
    Jan 2014
    Location
    India
    Posts
    244
    Thanks
    10
    Thanked 16 Times in 15 Posts

    Default

    Try this, let me know for the further help.
    Mage::getModel('catalog/category')->loadByAttribute('url_key', 'the-key-goes-here');

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •