0
votes

I want bulk import grouped products. Below is the csv format iam using:

sku     _type       _associated_sku     _associated_position
123456  grouped      sku1,sku2,sku3       3,2,1 

It says Import done successfully.But Its not importing anything when I check through admin end for this product(sku=123456) under associated product.

What should I do?

1

1 Answers

0
votes

Please use the following import code : https://www.pearlbells.co.uk/import-grouped-products-magento/

function setGroupedProducts( $product, $simpleProdSkus ) {

try {

    $grpProducts = array();
    $simpleProductSkus = explode(',',$simpleProdSkus);
    $i = 0;

    foreach ($simpleProductSkus as $simpleProdSku) {

        $simple_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $simpleProdSku);

        if (is_object($simple_product)) {

            $grpProducts[$i++] = $simple_product->getId();

        }
    }

    $products_links = Mage::getModel('catalog/product_link_api');

    foreach($grpProducts as $id) {
        $products_links->assign ("grouped",$product->getId(),$id);
    }

    return $product;
} 
catch (Exception $ex) {
    Mage::log($ex->getMessage(),null,'grp.log');
}

 }