Monday, November 3, 2014

filter product collection by multiple SKU's

$productSkuString = 'PROD001, PROD002, PROD003';
$productIds = explode(', ', $productSkuString);

$products = Mage::getResourceModel('catalog/product_collection')
    ->addAttributeToSelect('*') // <- careful with this
    ->addAttributeToFilter(
        'sku', array('in' => $productIds)
    )
    ->load();

// usage
foreach($products as $prod) {
    echo $prod->getName();
}

http://stackoverflow.com/questions/5121165/magento-filter-product-collection-by-multiple-skus

No comments: