Get category collection from specific store
In Magento store has relationship with only root category and all categories belong to this root category are belong to particular store. To load store categories you should use store root category id, and you can load all categories of this root. See these:
$rootId = Mage::app()->getStore($storeId)->getRootCategoryId();
$categories = Mage::getModel('catalog/category')
->getCollection()
->addFieldToFilter('path', array('like'=> "1/$rootId/%"));
echo $categories->count();
In Magento 1.9
$rootCategoryId = Mage::app()->getStore($storeId)->getRootCategoryId();
$categories = Mage::getModel('catalog/category')
->getCollection()
->setStoreId($storeId)
->addFieldToFilter('is_active', 1)
->addAttributeToFilter('path', array('like' => "1/{$rootCategoryId}/%"))
->addAttributeToSelect('*');
foreach($categories as $categorie)
{
$catid=$cat->getId();
$catname=$categorie->getName();
$catp=catp$categorie->getParent_id();
}
Instead of store filter, try with root category filter.
$rootcatID = Mage::app()->getStore()->getRootCategoryId();
$productCollection = Mage::getResourceModel('catalog/product_collection')
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
->addAttributeToFilter('category_id', array('in' => $rootcatID))
->addAttributeToSelect('*');
$productCollection->load();