Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

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