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.

  • which version are you use? – Bilal Usean Apr 23 '16 at 13:20
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

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, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.