magento sort array product IDs

$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();			
$collection = Mage::getModel('catalog/product')
	->getCollection()
	->addAttributeToFilter('entity_id', array('in' => $productIds))
	->addAttributeToSelect($attributes);
	
$collection->getSelect()->order(new Zend_Db_Expr('FIELD(e.entity_id, ' . implode(',', $productIds).')'));



你可能感兴趣的:(magento sort array product IDs)