How to get the id of associated products in magento from the array of associated products?

Get the id of associated products in magento from the array of associated products.
i was getting rid that i have array of associated product but unable to get the id of associated product.
after so much search i found this solution

check this it will works for you ....


$associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
foreach($associatedProducts as $assoc_id)
{
$aid = $assoc_id->getId();
echo "id of associated products is = ".$aid;
echo "<br/>";

}

Comments