Display all SKU combinations on Configurable Product page
-
11-10-2020 - |
Question
how do I go about displaying all possible SKU combinations on a Configurable Product page?
Solution
<?php
$simple_collection = Mage::getModel('catalog/product_type_configurable')->setProduct(Mage::registry('current_product'))
->getUsedProductCollection()
->addAttributeToSelect('sku')
->addFilterByRequiredOptions();
$id_to_sku = array();
foreach ($simple_collection as $_item)
{
$id_to_sku[$_item->getId()] = $_item->getSku();
}
print_r($id_to_sku);
?>
Hope it helps :)
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange