0

I'm building a tree view for my magento site. Its all working fine. But the only problem is that When I go into 4th level categories the URL path of the category is not coming properly.

for example.

Lets say I have the following url path

testsite.com/index.php/accessories/interior-accessories/electronic/

this is my 3rd level category url. The problem is that I would have another sub category under electronic like,

testsite.com/index.php/accessories/interior-accessories/electronic/sub-cat

, but magento does not give me this path. it will only give upto the 3rd level category.

This is the code that I am using.

$cat = Mage::getModel('catalog/category')->load($category->getId());
echo Mage::getUrl($cat->getUrlPath());

any ideas?

  • Try with echo $cat->getUrl(); – Marius Jul 28 '14 at 5:55
0

Based on the comments...
You can get the url of a category like this:

$cat = Mage::getModel('catalog/category')->load($category->getId());
$url = $cat->getUrl();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.