$product = Mage::getModel('catalog/product')->load(123); $productId = $product->getId(); // returns the product ID
$customer = Mage::getSingleton('customer/session')->getCustomer(); $customerId = $customer->getId(); // returns the customer IDIn this example, we use the getSession method to retrieve the current customer session object, then use the getCustomer method to retrieve the customer object itself. Finally, we use the getId method to retrieve the customer's ID. Both of these examples demonstrate how the Varien_Object getIdentifier method can be used to retrieve a unique identifier from an object in Magento.