Magento have multi store functionality by default. I was working a project that have 4 store for different regions like USA, UK, EURO and AUS. Our client wanted to export all products for a single store and I have implemented this feature by following way:
[sourcecode]
<?php
$storeId=3; //Store Id
$productCollections = Mage::getModel(‘catalog/product’)->getCollection();
// If you need all attribute then replace ‘sku’ wtih ‘*’
$productCollections->addAttributeToSelect(‘sku’);
// If you need to show all status product then comment out this line
$productCollections->addAttributeToFilter(‘status’,array(
array(‘eq’=>’1’)
));
// set your store id
$productCollections->addStoreFilter($storeId);
// Count total products
$total_pcount=count($productCollections->getData());
if($total_pcount>0):
foreach($productCollections as $product):
// Get product details info
$_product = Mage::getModel(‘catalog/product’)->load($product->getId());
/* do your work here */
endforeach;
else:
echo "{$total_pcount} item found.";
endif;
?>
[/sourcecode]
Thank you.