Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.59 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class Demac_Childsku_Model_Observer
  2. {
  3.     public function addChildSkus()
  4.     {
  5.         $productConfig = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('type_id', 'configurable');
  6.         foreach ($productConfig as $parent){
  7.              $singleConfig = Mage::getModel('catalog/product_type_configurable')->setProduct($parent);
  8.              $simpleCollection = $singleConfig->getUsedProductCollection()->addAttributeToSelect('*');
  9.  
  10.              foreach($simpleCollection as $simple){
  11.              //Do something here to modify your parent product.
  12.              }
  13.         }
  14.     }
  15. }