If you just need an array containing the category id and skus array ...
$skuArray = array(); $categoryCollection = Mage::getModel('catalog/category')->getCollection(); foreach ($categoryCollection as $category) { $skuArray[$category->getId()] = $category->getProductCollection()->getColumnValues('sku'); }
Alternatively, add a new field to each collection object containing skus ...
$categoryCollection = Mage::getModel('catalog/category')->getCollection(); foreach ($categoryCollection as $category) { $skus = $category->getProductCollection()->getColumnValues('sku'); $category->setData('skus', $skus); }
This will be an option if you still have to continue working on the collection later in your code, and you still need to access the sku array of the product.
foreach($categoryCollection as $category) { $categorySkus = $category->getData('skus'); }
source share