Skip to content

Instantly share code, notes, and snippets.

@t10u
Created January 14, 2011 15:58
Show Gist options
  • Save t10u/779784 to your computer and use it in GitHub Desktop.
Save t10u/779784 to your computer and use it in GitHub Desktop.
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect('name');
$collection->addAttributeToFilter('my_custom_attribute', array('notnull' => ''));
foreach ($collection as $product) {
echo $product->getId(). ' '. $product->getName();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment