Skip to content

Instantly share code, notes, and snippets.

@Modicrumb
Created June 27, 2013 15:41
Show Gist options
  • Save Modicrumb/5877535 to your computer and use it in GitHub Desktop.
Save Modicrumb/5877535 to your computer and use it in GitHub Desktop.
//---------------------- GET THE PRODUCTS
$products = Mage::getModel ( 'catalog/product' )->getCollection ();
$products->addAttributeToFilter ( 'status', 1 ); //enabled
$products->addAttributeToFilter ( 'visibility', 4 ); //catalog, search
$products->addFieldToFilter(array(
array('attribute'=>'cost','gt'=>0)));
$products->addFieldToFilter(array(
array('attribute'=>'type_id','eq'=>'simple')));
$products->addAttributeToSelect ( '*' );
$prodIds = $products->getAllIds ();
//echo 'Product filter: '.memory_get_usage(false).'<br>';
//flush();
foreach ( $prodIds as $productId )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment