Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 17
Configurable Products? 
 
jwpadgett
Member
 
Total Posts:  69
Joined:  2007-09-05
 

I’ve successfully been able to load about 1800 simple products using DataFlow, but how do I tie create a configurable product programatically?

Can DataFlow do this? The screencasts and tutorials are not clear, actually, everything I have found regarding configurables indicates it’s a manual process. Please tell me I’m wrong here, and point me in the right direction with DataFlow.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
AnnaM
Guru
 
Avatar
Total Posts:  325
Joined:  2008-01-29
San Francisco
 

One thing you might try is manually creatre a couple configurable products, then export them, and see what it looks like in a spread sheet. I notice 1.0 seems to have pre written profiles for import/export for config products too.  But create a couple manually and export them and see what they look like in a spreadsheet, then try creating a new one, save it as a csv and import it and see if it works.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwpadgett
Member
 
Total Posts:  69
Joined:  2007-09-05
 

Hi, Anna

Thanks for the reply. I have exported a configurable, but haven’t yet tried to import one. One reason I was hesitant, was because I didn’t see anything in the data that would link the configurable product sku to it’s simple products. I’ll give it a whirl and see how she goes.

Jason

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwpadgett
Member
 
Total Posts:  69
Joined:  2007-09-05
 

Well, I have now tried to import some configurable products using the same format provided by the Export All Products profile that is included in 1.0. When I imported the configurable products, though, I get errors stating that the field “weight” is not provided. It was late last night, so I could be wrong, but I didn’t’ see a weight field. Funny thing is, I don’t remember setting a weight for the configurable products I had set up manually, and those loaded/updated fine, even from the DataFlow import.

Also, as mentioned before, there is no field(s) to tie simple products to the configurable product. Even if I manage to get the configurable products to import, I’ll still have to manually associate their simple products.

Surely Magento’s development team is working on a solution!?!

 
Magento Community Magento Community
Magento Community
Magento Community
 
ibrown
Jr. Member
 
Total Posts:  10
Joined:  2008-02-26
 

I added some lines of code at the end of the function “public function saveRow($importData)” in Catalog/Model/Convert/Adapter/product.php

// assign all the attributes from the set to the configurable product
        if ($product->isConfigurable()) {    

            Mage
::getSingleton('catalog/resource_Eav_Mysql4_Product')->saveAttributeProducts($product,array(55,65));
            
        
}

and here is the new function I use to add physically the attribute links in the database: (it is in Catalog/Model/Resource/Eav/Mysql4/attributes.php)

/**
     * save attribute products
     *
     * @param Mage_Catalog_Model_Attribute $attribute
     * @return Mage_Catalog_Model_Entity_Attribute
     */
    public function saveAttributeProducts($product,$attributes)
    
{                 
        
if (is_array($attributes)) {
            $insertSql 
= array();
            
$insertSql = array();
            foreach (
$attributes as $attributeId{                        
                $insertSql[] 
'('.(int)$product->getId().','.(int)$attributeId.',0)';                
            
}
            
            $this
->_getWriteAdapter()->query("insert into {$this->_attributeTable} (product_id, attribute_id, position) values ".join(','$insertSql));
        
}
     
    }

I added this code and therefore you will have to bear in mind further version of Magento may handle the problem differently. Also, as you may have notice, I hard code the attribute code 55 and 65 that are my attributes code for color and manufacturer on my system.. you will have to work out your own attribute codes.

I suppose all of this is a bit technical, if you need more info, let me know.

Herve

 
Magento Community Magento Community
Magento Community
Magento Community
 
ibrown
Jr. Member
 
Total Posts:  10
Joined:  2008-02-26
 

Hi all,

For people who want to link simple products to the configurable product, please find a small function that you can adjust for your data.

I had to use a notation for my import: all my skus are linked.. For instance, sku1000 may be a sku for a configurable product and I named all its simple products skus sku1000-color1,sku1000-color2 and so on..

I made sure that my excel spreadsheet used for the import shows the configurable product after all its simple products rows. Hence, the code below fetch all the simple products to link to a configurable product and the link is created.

Hope this makes sense!

Herve

/**
     * save linked products
     *
     */
    public function saveLinkedProducts($product)
    
{                 
        $linkedProducts 
$this->_getReadAdapter()->fetchAll("select entity_id from  catalog_product_entity where sku like '%".$product->getSku()."%' and type_id='simple'");
            
        if (
is_array($linkedProducts)) {
            
foreach ($linkedProducts as $productInfo{
                $productIds[] 
$productInfo['entity_id'];
            
}
            Mage
::getResourceModel('catalog/product_type_configurable')->saveProducts($product->getId(), $productIds);
        
}
     
    }
 
Magento Community Magento Community
Magento Community
Magento Community
 
marcel st
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2007-12-06
 

Hi ibrown

I like to import configurable products liked to simple.

So I was happy to see your solution.

I add the code you show in post 4 and 5
but configurable product not linked to the simple product.

Do I have to use the code for both postings 4 and 5?

Do I have to add the code from 5 to Catalog/Model/Resource/Eav/Mysql4/attributes.php?

Do I have to do more than import?

Please explain your solution a little bit more

Many thanks

marcel

 
Magento Community Magento Community
Magento Community
Magento Community
 
Shane
Jr. Member
 
Total Posts:  6
Joined:  2008-05-05
 

Hello,

Anyone have any success with this?

Thanks,

Shane

 
Magento Community Magento Community
Magento Community
Magento Community
 
jwpadgett
Member
 
Total Posts:  69
Joined:  2007-09-05
 

After having upgraded to the latest Magento release, I was able to get the importer to load 153 configurable products without error. BUT, when I go to manage the products, the admin presents me with the same screen you get when you opt to create a configurable product manually (screen shot provided). When selecting the options and submitting the form, the system just reloads the form. All of the items show up on the site, without any configurable options - makes sense because no products have been associated with them.

Seems the Magento team have made some improvements with the upgrade, but dataflow is still unusable for configurable products.

Image Attachments
Magento Admin_1211137297355.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
jwpadgett
Member
 
Total Posts:  69
Joined:  2007-09-05
 

I managed to correct the problem mentioned above by manually adding the necessary attribute id’s to the ‘catalog_product_super_attribute’ table for each configurable product.

In order to link the simple products to the parent product, I can now either manually relate them using the admin tool, or add the relations to the ‘catalog_product_super_link’ table. I can write a small app to do the later.

Surely, dataflow should be capable of making these attribute and product relations. Would these functions be done through a custom profile?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gabrielk
Sr. Member
 
Avatar
Total Posts:  83
Joined:  2007-11-30
 

I posted a script that I use for this here: http://www.magentocommerce.com/boards/viewreply/28623/ (post #47 in the thread).

However, I haven’t looked at the dataflow functions yet, after seeing some of the code posted here I’m sure the same kind of logic could be applied to DataFlow.

(My biggest question with the functions posted above, is duplicate record handling...if I import a CSV through the DataFlow interface it updates existing records, adds new ones automatically.  I’d cry if I saw a super product link created each time I imported a product.)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Greven
Member
 
Total Posts:  36
Joined:  2007-08-31
Florence, AL
 
jwpadgett - 18 May 2008 10:04 AM

After having upgraded to the latest Magento release, I was able to get the importer to load 153 configurable products without error. BUT, when I go to manage the products, the admin presents me with the same screen you get when you opt to create a configurable product manually (screen shot provided). When selecting the options and submitting the form, the system just reloads the form. All of the items show up on the site, without any configurable options - makes sense because no products have been associated with them.

Seems the Magento team have made some improvements with the upgrade, but dataflow is still unusable for configurable products.

I’m still getting this problem even with version 1.0.19870.  How do they expect us to import / export products?  Any help would be great. 

@Magento team, are you guys still alive and reading these forums?

 
Magento Community Magento Community
Magento Community
Magento Community
 
multipasko
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2008-03-04
 

I’ve got the same problem. I hope it will be fixed at soon.

Have you sent email to magento team with this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Greven
Member
 
Total Posts:  36
Joined:  2007-08-31
Florence, AL
 

I have not no.  I also found that you can not do up-sells and so on in the CSV or excel import.  To me it feels as if Data Flow was rushed out the door to be fixed later on.

 
Magento Community Magento Community
Magento Community
Magento Community
 
the311guy
Sr. Member
 
Avatar
Total Posts:  120
Joined:  2007-10-18
 

I’m getting the same problem as jwpadgett.  Imported all configurable products successfully, but when I try to edit them in the admin, it does not go past the attributes screen.  Oh, the products also dont show up on the frontend of my site.  Whats going on?

 
Magento Community Magento Community
Magento Community
Magento Community
 
the311guy
Sr. Member
 
Avatar
Total Posts:  120
Joined:  2007-10-18
 
jwpadgett - 18 May 2008 03:55 PM

I managed to correct the problem mentioned above by manually adding the necessary attribute id’s to the ‘catalog_product_super_attribute’ table for each configurable product.

In order to link the simple products to the parent product, I can now either manually relate them using the admin tool, or add the relations to the ‘catalog_product_super_link’ table. I can write a small app to do the later.

Surely, dataflow should be capable of making these attribute and product relations. Would these functions be done through a custom profile?

jwpadgett, could you elaborate a little more on how you got your configurable products up and running?  I am confused
thanks

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 17