public function loadChildrens($productIds, $storeId)
    {
        $children = [];

        foreach ($this->catalogProductType->getCompositeTypes() as $productTypeId) {
            $typeInstance = $this->getProductTypeInstance($productTypeId);
            $relation = $typeInstance->getRelationInfo();

            if ($relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
                $select = $this->getRelationQuery($relation, $productIds, $storeId);
                $data   = $this->getConnection()->fetchAll($select);

                foreach ($data as $relationRow) {
                    $parentId = (int) $relationRow['parent_id'];
                    $childId  = (int) $relationRow['child_id'];
                    $sku      = (string) $relationRow['sku'];
                    $configurableAttributes = array_filter(explode(',', $relationRow["configurable_attributes"]));
                    $children[$childId][] = [
                        "parent_id"               => $parentId,
                        "configurable_attributes" => $configurableAttributes,
                        "sku"                     => $sku,
                    ];
                }
            }
        }

        return $children;
    }
public function loadChildrens($productIds, $storeId)
    {
        $children = [];

        foreach ($this->catalogProductType->getCompositeTypes() as $productTypeId) {
            $typeInstance = $this->getProductTypeInstance($productTypeId);
            $relation = $typeInstance->getRelationInfo();

            if ($relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
                $select = $this->getRelationQuery($relation, $productIds, $storeId);
                $data   = $this->getConnection()->fetchAll($select);

                foreach ($data as $relationRow) {
                    $parentId = (int) $relationRow['parent_id'];
                    $childId  = (int) $relationRow['child_id'];
                    $sku      = (string) $relationRow['sku'];
                    $configurableAttributes = array_filter(explode(',', $relationRow["configurable_attributes"]));
                    $children[$childId][] = [
                        "parent_id"               => $parentId,
                        "configurable_attributes" => $configurableAttributes,
                        "sku"                     => $sku,
                    ];
                }
            }
        }

        return $children;
    }
public function loadChildrens ( $ productIds , $ storeId ) { $ children = [ ] ; foreach ( $ this -> catalogProductType -> getCompositeTypes ( ) as $ productTypeId ) { $ typeInstance = $ this -> getProductTypeInstance ( $ productTypeId ) ; $ relation = $ typeInstance -> getRelationInfo ( ) ; if ( $ relation -> getTable ( ) && $ relation -> getParentFieldName ( ) && $ relation -> getChildFieldName ( ) ) { $ select = $ this -> getRelationQuery ( $ relation , $ productIds , $ storeId ) ; $ data = $ this -> getConnection ( ) -> fetchAll ( $ select ) ; foreach ( $ data as $ relationRow ) { $ parentId = ( int ) $ relationRow [ 'parent_id' ] ; $ childId = ( int ) $ relationRow [ 'child_id' ] ; $ sku = ( string ) $ relationRow [ 'sku' ] ; $ configurableAttributes = array_filter ( explode ( ',' , $ relationRow [ "configurable_attributes" ] ) ) ; $ children [ $ childId ] [ ] = [ "parent_id" => $ parentId , "configurable_attributes" => $ configurableAttributes , "sku" => $ sku , ] ; } } } return $ children ; }
Retrieve list of children ids for a product list.

Warning the result use children ids as a key and list of parents as value

@param array $productIds List of parent product ids.
@param int   $storeId    Store id.

@return array
Retrieve list of children ids for a product list .