We recently helped a client with their Magento website. They were wanting to show a grid while on a configurable products page of all the associated simple products. This is an easy way to quickly show the customer what products are available along with their price.
The first step is to determine if the product is a configurable type, otherwise we don’t want to show the grid. We’ll assume you’re using the default template/catalog/product/view.phtml file and that you’ve already got your product object ($_product). Below is the code to check if the current product is configurable.
if($_product->getTypeId() == "configurable"):
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product){
echo $simple_product->getSku() . " - " . $simple_product->getName() . " - " . Mage::helper('core')->currency($simple_product->getPrice()) . "<br>";
}
endif;