In my store I have grouped products and asociated simple products.

Is there a way to set simple products to a grouped product with importing file (csv, xslx,...)?

  • I don't think that default import profiles can do that. I am sure it could be added as customization – Petar Dzhambazov Apr 6 '16 at 10:32

If you are familiar with magento code - you can try next:

1) Extend/overwrite core class Mage_Catalog_Model_Convert_Adapter_Product

modify method public function saveRow

  • add constants at the beggining of class

    const CSV_KEY_RELATED = 'related';

    const CSV_KEY_GROUPED = 'groupped';

    const CSV_KEY_CROSSSELL = 'crosssells';

    const CSV_KEY_UPSELL = 'upsells';

  • add

        if (isset($importData[self::CSV_KEY_UPSELL]) && trim($importData[self::CSV_KEY_UPSELL]))
            $this->setRelations($product, $importData[self::CSV_KEY_UPSELL], 'upsell');
        if (isset($importData[self::CSV_KEY_CROSSSELL]) && trim($importData[self::CSV_KEY_CROSSSELL]))
            $this->setRelations($product, $importData[self::CSV_KEY_CROSSSELL], 'crossell');
        if (isset($importData[self::CSV_KEY_RELATED]) && trim($importData[self::CSV_KEY_RELATED]))
            $this->setRelations($product, $importData[self::CSV_KEY_RELATED], 'related');
        if (isset($importData[self::CSV_KEY_GROUPED]) && trim($importData[self::CSV_KEY_GROUPED]))
            $this->setRelations($product, $importData[self::CSV_KEY_GROUPED], 'grouped');

before line $product->setIsMassupdate(true);

  • add new method:

public function setRelations($product, $data, $key) {

    $skus = explode(',', $data);
    $collection = Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToFilter('sku', $skus);    
    $ids = $collection->getAllIds();
    if (count($ids)) {
        $ready = array();
        foreach($ids as $id)
            $ready[$id] = array('position' => '');

            case 'upsell': $product->setUpSellLinkData($ready); break;
            case 'crossell': $product->setCrossSellLinkData($ready); break;
            case 'related': $product->setRelatedLinkData($ready); break;
            case 'grouped': $product->setGroupedLinkData($ready); break;
            default: return false;

    return true;

After all you can use columns 'related', 'crossells', 'upsells' - for any type of product. and column 'grouped' - for Grouped products. which should contain list of Simple SKUs, separated by comma

| improve this answer | |

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