1

how can i display the sku from simple products on configurable product page?

i have tried:

$_product->getSku()

$item->setSku($product->getSku())

$simpleOption->getProduct($product)->getSku()

$simple->getSku()

2 Answers 2

2
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;

inspire from this. here

1
1
 /**
     * Get child products id (only ids)
    $childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product->getId());

    /**
     * Get children products (all associated children products data)
     */
    $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);

foreach($childProducts  as $childproduct ) {
    $childproduct->getSku();
}

above function is just sketch you can look for perfect function.

hope this will work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.