$product = Mage::getModel('catalog/product')->load(1234); $entityId = $product->getEntityId(); echo "Product entity ID: $entityId";
$productCollection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToFilter('attribute_code', 'attribute_value'); foreach ($productCollection as $product) { $entityId = $product->getEntityId(); // do something with the entity ID }This code retrieves a collection of products that have a certain attribute value and iterates over them, retrieving each product's entity ID and using it in some way. The Mage_Catalog_Model_Product class belongs to the catalog package/library in Magento.