0

I have too many child products. I would like to see all child product's sku.

Any one help me to get all simple product sku.

2
  • In which format you want the list of SKUs? Commented Jan 23, 2017 at 12:06
  • please check the answer and let me know Commented Jan 23, 2017 at 12:14

2 Answers 2

1

You can try below code

$childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($ConfigurableProductId);
foreach($childIds as $pid){
    $product = Mage::getModel('catalog/product')->load($pid);
    echo $product->getSku(); 
}

2nd way also this code also works

$configurableProduct = Mage::getModel('catalog/product')->load(1); //here 1 is productId 
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$configurableProduct);   
foreach($childProducts as $child) {
    echo $child->getSku();
}

3Rd option

$configurableProduct = Mage::getModel('catalog/product')->load(1); //here 1 is productId 
$childProducts = Mage::getModel('catalog/product_type_configurable')                        
            ->getUsedProductCollection($configurableProduct)
            ->addAttributeToSelect('*');
foreach($childProducts as $product){
   echo $product->getSku(); 
}  
4
  • thanks bro. please can You let me know where i have to create file to write this code . so i can get sku of All Simple product thanks Commented Jan 23, 2017 at 12:50
  • @Grace Where you have written rest of the code ?? Commented Jan 23, 2017 at 12:52
  • i mean where can i past this code. I am new in magento I haven't idea about it Commented Jan 23, 2017 at 12:54
  • 1
    Your first method has one small error. foreach($childIds as $pid) { .. } should be: foreach($childIds[0] as $pid) { .. }
    – duttyman
    Commented Jun 20, 2017 at 16:45
1
  1. You can get the all products's sku's by exporting method. for that,
  2. Goto admin->system->import/export->dataflows->export all products

You can see the sku's in downloaded file in csv format of all products.

3
  • thanks for reply. I need Just all simple product sku name csv file format Commented Jan 23, 2017 at 12:46
  • yes. thats y i gave this answer. check my updated answer. Commented Jan 23, 2017 at 13:08
  • @ Teja bhagavan Kollepara thanks but i would like to get only simple product sku by programming Commented Jan 24, 2017 at 13:05

Your Answer

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

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