I am trying to pull category that belongs to current store only but it doesn\'t seem to work. Can anyone see any issue in my code?
$categoryCollection = Mage
Neither setStoreId()
nor addAttributeToFielter('store_id', $storeId)
don't work because there's no store_id
in the category tables. The code below works perfectly:
$storeId = 21; // your store id
$rootCategoryId = Mage::app()->getStore($storeId)->getRootCategoryId();
$categories = Mage::getModel('catalog/category')->getCollection();
$categories->addAttributeToFilter('path', array('like' => "1/{$rootCategoryId}/%"));