0

we want to import group products in our website through CSV , Pleas guide us what will be the format of CSV to import group products.

1
  • which version are you use? Apr 23, 2016 at 13:20

2 Answers 2

0

If you are using magento 2 u can just go to system--> import and u can generate a sample csv there. Another method is to create a couple of products and then export them and adjust that list. it takes some knowledge but i can advise u this :

-> when u use excel --> open again in notepad++ and convert to UTF8 with DOM before uploading

2
0

This code works for me. Please refer the tutorial for the full code. https://www.pearlbells.co.uk/import-grouped-products-magento-2/

$associated = array();
$position = 0;

foreach($childrenIds as $productId) {
    $position++;
    $productRepository = $objectManager->create('\Magento\Catalog\Api\ProductRepositoryInterface');
    $linkedProduct = $productRepository->getById($productId);
    $productLink = $objectManager->create('Magento\Catalog\Api\Data\ProductLinkInterface');
    $productLink->setSku($product->getSku())
        ->setLinkType('associated')
        ->setLinkedProductSku($linkedProduct->getSku())
        ->setLinkedProductType($linkedProduct->getTypeId())
        ->setPosition($position)
        ->getExtensionAttributes()
        ->setQty(0);
    $associated[] = $productLink;     
}
$product->setProductLinks($associated);
$product->save();

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.