Magento Forum

   
Finding category by urlkey? How? 
 
loneregister
Jr. Member
 
Total Posts:  11
Joined:  2011-11-01
 

The code I am currently using is:

$cats Mage::getModel('catalog/category')
        ->
getCollection()
        ->
addFieldtoFilter('url_key',$url);

I have verified that the $url variable is an exact match for the url key of a category in the store I am currently active in.  However, the collection returns no results?

Any ideas as to why?

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
loneregister
Jr. Member
 
Total Posts:  11
Joined:  2011-11-01
 

The code above does work - in my case the storeId was messing with the collection returning results.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top