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

A suggestion to import configurable products + categories
 
Ed.Madrigal
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2010-06-29
 

Has anyone gotten this script to work with multiple select attributes, that need more than 1 attribute?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Roach
Jr. Member
 
Total Posts:  3
Joined:  2010-03-27
 

Is anyone out there left in the Magento community? I agree with the sentiments of the users in the last few pages - it’s now 30 pages long and there’s no real updated files for the later versions of Magento, and it makes the Wiki almost useless referencing to files so, so old. Are we able to get an update on the process so one of the more critical Magento processes that have been left out are resolved?

 
Magento Community Magento Community
Magento Community
Magento Community
 
eatblueorange
Member
 
Avatar
Total Posts:  34
Joined:  2010-03-22
Philippines
 

Awesome script!  For this to work on Magento 1.4.1.1 ,follow these changes:

If you got an error: Call to a member function getName() on a non-object in...on line 359

go to line 359 of ProductImport.php and change:

$name $collection->getItemById$pathArr[$i] )->getName();
 
$namePath .= ( empty( $namePath ) ? '' '/' ) . trim$name );

to this one:

$name $collection->getItemById$pathArr[$i] );
$namePath .= ( empty( $namePath ) ? '' '/' ) . trim$name['name');

And if you got an sql error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘value’ cannot be null

got o line 113 of ProductImport.php and change:

if ( !empty( $usingAttributeIds ) ) {
    $product 
-> getTypeInstance() -> setUsedProductAttributeIds$usingAttributeIds );
    
$product -> setConfigurableAttributesData$product -> getTypeInstance() -> getConfigurableAttributesAsArray() );
    
$product -> setCanSaveConfigurableAttributestrue );
    
$product -> setCanSaveCustomOptionstrue );
}

to this one:

if ( !empty( $usingAttributeIds ) ) {
    $product 
-> getTypeInstance() -> setUsedProductAttributeIds$usingAttributeIds );
    
$attributes_array $product->getTypeInstance()->getConfigurableAttributesAsArray();
    foreach(
$attributes_array as $key => $attribute_value{
        $attributes_array[$key][
'label'$attribute_value['frontend_label'];
    
}
    $product 
-> setConfigurableAttributesData($attributes_array);
    
$product -> setCanSaveConfigurableAttributestrue );
    
$product -> setCanSaveCustomOptionstrue );
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
narrok
Jr. Member
 
Total Posts:  29
Joined:  2010-05-31
 

I did what you suggested but now I have the following error:

ROW 1SKU 1073512 SQLSTATE[42000]Syntax error or access violation1064 You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near ' 0)' at line 1

Any idea ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
moomoo
Sr. Member
 
Avatar
Total Posts:  192
Joined:  2009-07-10
 
Ed.Madrigal - 31 August 2010 07:25 AM

Has anyone gotten this script to work with multiple select attributes, that need more than 1 attribute?

Do you mean, where there are two eg. dropdown options for each product, or multiple selections of each attribute?

If the first, yes, it works for me, 1.4.1.0. Make sure that all the admin values for each attribute are set, refresh indexes after import, and it should work.

Also, it imports images successfully, as long as they are in the /media/import folder.

 
Magento Community Magento Community
Magento Community
Magento Community
 
eatblueorange
Member
 
Avatar
Total Posts:  34
Joined:  2010-03-22
Philippines
 

Here is my modified version that works with 1.4.1

http://www.deepcodeonline.com/blog/magento/how-to-import-configurable-and-simple-products-in-magento-1-4-1/

File Attachments
magento1.4.1.zip  (File Size: 8KB - Downloads: 489)
 
Magento Community Magento Community
Magento Community
Magento Community
 
internetoutfitters
Jr. Member
 
Total Posts:  5
Joined:  2008-09-02
 
eatblueorange - 22 September 2010 07:36 AM

Here is my modified version that works with 1.4.1

http://www.deepcodeonline.com/blog/magento/how-to-import-configurable-and-simple-products-in-magento-1-4-1/

Thanks so much for posting the 1.4.x version of the code - saved me a ton of time!

 
Magento Community Magento Community
Magento Community
Magento Community
 
eatblueorange
Member
 
Avatar
Total Posts:  34
Joined:  2010-03-22
Philippines
 

Hi, I made an update to the code that imports also the label of the images and link the simple products to the configurable products and also set custom price on the super product attributes configuration

This one works with Magento 1.4.1

http://www.deepcodeonline.com/blog/update-how-to-import-configurable-and-simple-products-in-magento-1-4-1-with-label-on-the-images-and-super-products-attribute-linking/

File Attachments
magento1.4.1.zip  (File Size: 22KB - Downloads: 679)
 
Magento Community Magento Community
Magento Community
Magento Community
 
buzzjoe
Jr. Member
 
Total Posts:  4
Joined:  2008-07-23
 
eatblueorange - 04 October 2010 09:26 AM

Hi, I made an update to the code that imports also the label of the images and link the simple products to the configurable products and also set custom price on the super product attributes configuration

This one works with Magento 1.4.1

http://www.deepcodeonline.com/blog/update-how-to-import-configurable-and-simple-products-in-magento-1-4-1-with-label-on-the-images-and-super-products-attribute-linking/

Great. Thank you!

But I still got this silly error when trying to import some products that are already there. In other words: when I try to update them:

SQLSTATE[23000]Integrity constraint violation1048 Column 'value' cannot be null

Happens with simple products that belong to configurable ones. The configurable product itself updates fine :(

Don’t get behind it. Almost thinking I’m stupid :(

Running on stock Magento 1.4.1.1, don’t import Images, just the products itself, got some own attributes and color + size for configuring.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gegerino
Jr. Member
 
Total Posts:  29
Joined:  2010-07-06
 

Hi, I am new in importing Products an got this ERROR:
Notice: Undefined property: Mage_Catalog_Model_Convert_Adapter_Productimport::$_inventorySimpleFields in D:\gruscht\xampplite\htdocs\magento\app\code\local\Mage\Catalog\Model\Convert\Adapter\Productimport.php on line 227

Can you help me?

Got it fixed:
http://www.magentocommerce.com/boards/vi/viewthread/35865/P390/#t245912

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gegerino
Jr. Member
 
Total Posts:  29
Joined:  2010-07-06
 

@ Ed.Madrigal
I got the same Problem with the Options, they will not appear.
Do you got the Problem fixed?

I also have this problem solved:
There must be an entry in the CSV at options_container.

 
Magento Community Magento Community
Magento Community
Magento Community
 
steverino1
Jr. Member
 
Total Posts:  15
Joined:  2010-01-05
 

This post is for those whose options don’t show up on the front end.

For some reason when I put container1 in options_container in the csv, it did not import.  Valid values (unless you have created a custom container) are container1 and container2 for a vanilla install of Magento 1.4.1 . The container defines which layout is used for the dropdown display.  I found that the options would show up if I saved the sku thru the admin interface but I have way too many skus to do this practically.

I have found a work around by doing an update to the catalog_product_entity_varchar table in the Magento database as follows:

UPDATE catalog_product_entity_varchar AS cpev
INNER JOIN eav_attribute ea ON cpev.attribute_id= ea.attribute_id
INNER JOIN catalog_product_entity cpe ON cpev.entity_id= cpe.entity_id
SET cpev.value=’container1′
WHERE cpe.type_id=’configurable’ and ea.attribute_code=’options_container’
and (cpev.value IS NULL OR RTRIM(cpev.value)=”)

Note that the value must be set to ‘container1′ ‘container2′ depending on the desired layout).

Note that this query restricts the update to the ‘options_container’ attribute and to configurable products. It will update products that don’t have their options_container already set.

You can test this on a single product by adding

and cpe.entity_id=77

to the end of the query. Replace 77 with the id of the product you want. Then look at the product in the front end to see if the dropdown has been added. You can also review the catalog_product_entity_varchar table for changes.

The query is quick and provides an alternative for those who can’t get the options to show up in the front end immediately after importing.

I am new to Magento and have customized many e-commerce products including some very expensive ones. Personally I am amazed that the import of configurable products is not part of the built in functionality as needing the ablity to display options such as size, color,etc. is fundamental.

Many thanks to amartinez for doing this work.  Thanks to eatblueorange for the update to 1.4.1.  I have used eatblueorange’s code revision at http://www.deepcodeonline.com/blog/update-how-to-import-configurable-and-simple-products-in-magento-1-4-1-with-label-on-the-images-and-super-products-attribute-linking/

Steve

 
Magento Community Magento Community
Magento Community
Magento Community
 
isumi
Jr. Member
 
Total Posts:  21
Joined:  2010-09-13
 

I used the zip file of eatblueorange and his exaple csv files and all php-files, but somehow the values for qty and is_in_stock are just ignored :(
can you help me, please? What could be wrong?
Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Webshopdealer
Jr. Member
 
Total Posts:  2
Joined:  2010-06-03
NL
 

Hi thank you all for make this script and eatblueorange for changes to get it work in 1.4.1.1 with image labels.

Answer to Isumi Config products don’t have stock, to import stocks for simple use the standard magento “import stock” profile.

I just have 2 questions as a user of configurable products with 100\’s of associated simple producs.

1st question: Will this script work with xml parser

<action type=\"dataflow/convert_adapter_io\" method=\"load\">
<var name=\"type\">file</var>
<var name=\"path\">var/import</var>
<var name=\"filename\"><![CDATA[YOUR_Filename.XML]]></var>
<var name=\"format\"><![CDATA[xml]]></var>
</action>

<action type=\"dataflow/convert_parser_xml_excel\" method=\"parse\">
<var name=\"single_sheet\"><![CDATA[]]></var>
<var name=\"fieldnames\">true</var>
<var name=\"store\"><![CDATA[0]]></var>
<var name=\"number_of_records\">3</var>
<var name=\"decimal_separator\"><![CDATA[.]]></var>
<var name=\"adapter\">catalog/convert_adapter_productimport</var>
<var name=\"method\">parse</var>
</action>

2nd Question
In excell the opposite way; now I associate the needed simple products in the associated column, so if I have 1000 simple products that I need to associate to 1 config product I have to make a extremely long line with SKU\’s sku1,sku2,sku3,sku4,sku5........,sku1000
If you have a few of config products like this, wow man it can break you up, one mistake in , \”; or whatever and you get the big E\’s for Error

QUESTION
Is it possible to make the script work the opposite way, I mean associating in the excell worksheet the simple product to the config product, instead of associating the config to the simples.  So I can write (copy paste) the associated SKU in line with the simple product in excell.

Simple product -> associated config SKU

instead of

config product-> associated simple SKU1, Asso. simple SKU2, Asso simple SKU3 .............

Somebody can give me some advise how to do this .
Thanks in advance.

Maybe this will help others to associate the prices, I use the free extension for simple config products, no more config prices rules, it just associates the price of the original simple sku after selecting the options.

the extension http://www.magentocommerce.com/magento-connect/Matt+Dean/extension/596/simple-configurable-products#overview

 
Magento Community Magento Community
Magento Community
Magento Community
 
Wajking
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2010-04-15
 

Hi!

I have upgraded to 1.4.1.1 and now my import script fails. It fails when it should save the configurable products and with it\’s associated products.

$product -> setConfigurableProductsData($productsIds) -> save();

This line gives the error:
\"Uncaught exception \’Zend_Db_Statement_Exception\’ with message \’SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`shop/catalog_product_super_link`, CONSTRAINT `FK_SUPER_PRODUCT_LINK_ENTITY` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON UPDATE CA)\’\”

Please help!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top