In Magento I am trying to display all the SKU's for associated simple products on the product page of the configurable product. I have used the below code to display all colors but for some reason it doesn't work for all SKU's (I changed attribute text to SKU):
<?php
$styles = array();
if($_product->isConfigurable()){
$allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
foreach ($allProducts as $subproduct) {
$styles[] = '<li>' . $subproduct->getAttributeText('color') . '</li>';
}
if(count($styles)>0) {
sort($tyles);
?>
<ul class="style-list">
<? echo implode("", $styles); ?>
</ul>
<?
}
}
?>
Anyone know how to achieve this?
$subproduct->getSku()- subroutines