Skip to content

Magento : Get product collection has tier price only

here my script get product collection who has tier price only!!!!!!!!!!!!!!!!!!

of course also in stock :p

$prefix = Mage::getConfig()->getTablePrefix();

$sql = 'select distinct  entity_id from '.$prefix.'catalog_product_entity_tier_price';
		
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$results = $readConnection->fetchCol($sql);
		
/* base collection */
		
$mod = Mage::getModel('catalog/product')
		      ->getCollection()
		      ->addAttributeToFilter('entity_id',array('in'=>$results))
				
				;
$mod->joinField('is_in_stock', 'cataloginventory/stock_item', 'is_in_stock', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
$mod->addAttributeToFilter('is_in_stock', array('eq' => 1));
		
print_r($mod->getData());

 

Comments are closed.