getStatus() returns wrong value from configurable product child
Taking a closer look at the getUsedProducts you will see that the result that it returns when null is passed through is a just a simple collection result. What this means is that the full product model is not loaded but only a very small subset of data. In this result status is not return. Then reason that you always get a result saying the product is enabled is due that in Mage_Catalog_Model_Product there is a getStatus function that if status is not set it will return that the product is enabled.
A quick solution to your problem is to include the attributes that you would like when calling the getUsedProducts function. I have include some sample code below. If you need any other attributes be sure to include them in the array
$entityId = Mage::getModel('eav/entity_type')
->loadByCode('catalog_product');
$attribute_id = Mage::getModel('eav/entity_attribute')
->loadByCode($entityId, 'status');
$allProducts = $this
->getProduct()
->getTypeInstance(true)
->getUsedProducts(array($attribute_id), $this->getProduct());
foreach ($allProducts as $product){
$status = $product->getStatus();
}
This issue was plaguing me briefly as well. Since upgrading an install to EE 1.14, child products that formerly were hidden began showing up even though their status was set to “disabled”. The way I was able to solve the problem was inspired by an answer on a related question. Once I explicitly added status
to configurable child products like this, everything started working as expected:
<config>
<frontend>
<product>
<configurable>
<child>
<attributes>
<status/>
</attributes>
</child>
</configurable>
</product>
</frontend>
</config>