0

I need to get all varient products(IDs) assigned to a specific configurable product

pls help, THanks.

2 Answers2

0

Do you want all products without any filters, but it is showing only a part of the result set?

There may be several cases:

  • Some inner limitation, like 100 at all.
  • Some paging limitation. Products per page(in db abstract)
  • Some lazyload limitation

Most of the cases, it is inner limit which restricts.

Again, found a very similar thread here. Hope this helps.

Community
  • 1
  • 1
Mayukh Roy
  • 1,815
  • 3
  • 19
  • 31
  • I get all configurable products by: $collectionConfigurable = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('type_id', array('eq' => 'configurable')); -- now i need to get all varient product ID's which are assigned to each of above conf. product – Jeewantha68 Mar 06 '13 at 08:00
  • I Found the solution $product = Mage::getModel('catalog/product')->load($_productID); $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product); – Jeewantha68 Mar 06 '13 at 08:13
0

One another better way to do the same

     $productsCollection = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToSelect('*')
                ->addAttributeToFilter('type_id','configurable') //load only configurable products
                ->load();

     foreach($productsCollection as $product):
     /*Get Associated Simple Products*/
      $associatedSimpleProducts = $product->getTypeInstance()->getUsedProductIds();
      print_r($associatedSimpleProducts);
     endforeach;

I think this is the better one because it removes the necessity to load your product model again , as you already have that in your collection ;-)

Haijerome
  • 1,540
  • 16
  • 21