I want to have in the product view page and in the category page a list with all size attribute and price for each configurable product. I use this code to display the size and is work perfect but I need to get the price too. How I can add the price for associated products in the following code.
Thank you
$ids = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($_product->getId()); //get the children ids through a simple query
$attrs = $_product->getTypeInstance(true)->getConfigurableAttributesAsArray($_product);
foreach($attrs as $attr) {
if(0 == strcmp("size", $attr['attribute_code'])) {
$options = $attr['values'];
foreach($options as $option) {
print "{$option['store_label']}<br />";
}
}
}
I need to be something like in this image:
Edit: I can get simple products prices with the following code but how I can have Size and Price foreach simple product?
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 Mage::helper('core')->currency($simple_product->getPrice());
}
endif;