Magento Coding Solutions

get simple produt collection not associative product

$collection = Mage::getResourceModel('catalog/product_collection')
//->addAttributeToFilter('type_id', array('eg'=>'configurable'))
->addAttributeToFilter('type_id', array('eg'=>'simple'))
->addAttributeToSelect('*'); //or just the attributes you need

$collection->getSelect()->joinLeft(array('link_table' => 'catalog_product_super_link'),
'link_table.product_id = e.entity_id',array('product_id')
);

$collection->getSelect()->where('link_table.product_id IS NULL');
$notAssocative=array();
foreach($collection->getData() as $notAss){
array_push($notAssocative,$notAss['entity_id']);
}

print_r($notAssocative);

No comments:

Post a Comment