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 2 of 2
Configurable Product Automatic Import SOLUTION
 
nasha
Sr. Member
 
Avatar
Total Posts:  138
Joined:  2009-04-15
 

now i got it.here is the solution

$data = array(’2219’=>array(’0’=>array(’attribute_id’=>’76’),’1’=>array(’attribute_id’=>’498’)),
‘2211’=>array(’0’=>array(’attribute_id’=>’76’),’1’=>array(’attribute_id’=>’498’)),
‘1990’=>array(’0’=>array(’attribute_id’=>’76’),’1’=>array(’attribute_id’=>’498’)));

$product->setConfigurableProductsData($data);

$data = array(’0’=>array(’id’=>NULL,’label’=>’color’,’position’=> NULL,
‘values’=>array(’0’=>array(’value_index’=>0,’label’=>’color’,’is_percent’=>0,
‘pricing_value’=>’0’,’attribute_id’=>$color)

),’attribute_id’=>$color,’attribute_code’=>’color’,’frontend_label’=>’color’,
‘html_id’=>’config_super_product__attribute_0’),

‘1’=>array(’id’=>NULL,’label’=>’size’,’position’=> NULL,
‘values’=>array(’0’=>array(’value_index’=>0,’label’=>’size’,’is_percent’=>0,
‘pricing_value’=>’0’,’attribute_id’=>’498’),
),
‘attribute_id’=>498,’attribute_code’=>’size’,’frontend_label’=>’size’,
‘html_id’=>’config_super_product__attribute_1’)
);

$product->setConfigurableAttributesData($data);
$product->setCanSaveConfigurableAttributes(1);

 
Magento Community Magento Community
Magento Community
Magento Community
 
PaulE
Member
 
Avatar
Total Posts:  43
Joined:  2008-12-09
 
resonance - 02 February 2009 12:16 PM

First off, I found a bug, where the script will continue using the attribute options from the first attribute set found and never update to the next one found. To fix it, move these two lines:

$eavAttributeModel        Mage::getModel('eav/entity_attribute');
$attributeOptionsModel    Mage::getModel('eav/entity_attribute_source_table') ;

Into this loop:
// Create products
echo '<br>Creating products...<br>';
foreach(
$configurable_products as $cp)
{
    
// <<< PUT THE TWO LINES HERE
    
echo 'Processing sku ' $cp['sku'.'<br>';

Instead of reloading the model you can better call unsetData();
This will erease all the loaded data in de model smile

So in the loop:

$eavAttributeModel -> unsetData();
$attributeOptionsModel -> unsetData();
 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

possibly another solution -> http://www.magentocommerce.com/extension/1894

 
Magento Community Magento Community
Magento Community
Magento Community
 
VortexCommerce
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-08-06
Harrogate, UK
 

Hi,

I have a script that can import these:

simple product
configurable products
grouped products

Categories as names

gallery images

related items
cross sell items
upsell items
and any attribute you require.

I am going to be releasing it shortly at $50 one off fee. PM me for details

 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

my module does all of these

simple product
configurable products
grouped products

Categories as names

gallery images

related items
cross sell items
upsell items
and any attribute you require.

as well as custom options / tier pricing and bundle products

 
Magento Community Magento Community
Magento Community
Magento Community
 
bolasevich
Sr. Member
 
Avatar
Total Posts:  235
Joined:  2008-03-04
Newington, CT USA
 

my module does all of these

simple product
configurable products
grouped products

Categories as names

gallery images

related items
cross sell items
upsell items
and any attribute you require.

as well as custom options / tier pricing and bundle products

http://www.magentocommerce.com/extension/1894

 
Magento Community Magento Community
Magento Community
Magento Community
 
xer0x
Jr. Member
 
Total Posts:  9
Joined:  2009-05-19
 

I just found this thread very helpful when putting together my own script to load products. A big thanks to all the folks that added to this thread.blakew, resonance, et al

 
Magento Community Magento Community
Magento Community
Magento Community
 
videohead
Jr. Member
 
Total Posts:  22
Joined:  2010-10-14
 

This is a total hack, and not useful for a catalog other than your catalog.
Customized to your individual product attributes.
We need an object oriented approach to this.

 
Magento Community Magento Community
Magento Community
Magento Community
 
videohead
Jr. Member
 
Total Posts:  22
Joined:  2010-10-14
 

This is very nice, but like you said in your post, it needs a lot of customizations and I found that I had to drill into the attribute tables and do a lot of discovery work to get it close to working.
It’s a great start, I’d love to be able to extend this using SOAP, so that is what I will be working on.
Thanks for sharing your code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nabler
Sr. Member
 
Total Posts:  80
Joined:  2010-07-27
 
bolasevich - 06 September 2009 11:23 AM

possibly another solution -> http://www.magentocommerce.com/extension/1894

we need some free here....

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2