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: 487)
 
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: 678)
 
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
 
upakarti
Sr. Member
 
Avatar
Total Posts:  264
Joined:  2008-06-25
Denpasar, Bali Indonesia
 
Petr Lebe - 04 October 2009 10:38 PM

f3ze - 04 October 2009 06:10 AM
Petr Lebe - 04 October 2009 05:47 AM
Hi guys, great work making that product import I want to ask if there is an option how to import simple product with some custom options. I need to import some furniture and it has some options like type of leather, textile type, color. Different products has different custom options.

One sofa has leather type drop down, other sofa has textile type drop down, other have both etc. There are more custom options.

Is it posible to customize CSV file to import simple products with custom options or there is other way to acomplish my needs ?

Yeh I think you would create attributes in the backend, then assign them to product groups, then make a column with the name of that attribute in your csv, and import. I think you can then get the info from that column like this:

echo $product->getData('your_attribute');

There’s probably a better way of doing it though.

Thanks for the reply. I think this wont be a solution because i need another options for lot of sofas

For example:

Sofa1: I need drowdown box for leather type: -Alcatraz leather +0$, -Black leather +300$, -White leather + 600$

Sofa2: dropdown for metal parts type: common metal: +0$, chrome +40$

I need dropdown boxes with options and additional prices to appear in product detail. If I make attributes in the background and assign them to product group, then every product from that group will have it, but my products are different from each other.

I dont know if i took right direction, maybe there is better way of doing this instead of simple product with custom options.

Answer for Sofa 1:
CSV Header must be==> Leather Type:drop_down:1:0
Where==>
Leather Type is Custom Option Title Name
drop_down is field type (You can use other field type as well like: field and etc.
1=is_required (Yes), where 0 (No), better to set up 1=Yes.
0=sort_order

CSV values must be==> Alcatraz Leather:fixed:0000:itemSKU:0|Black Leather:fixed:300:itemSKU:1|White Leather:fixed:600:itemSKU:2
Where==>
Alcatraz Leather is value for your custom option name (Black Leather and White Leather as well)
fixed is price_type (valid values: fixed or percentage whatever you like)
0000 is item’s price (300 and 600)
itemSKU is SKU (replace with your item’s SKU)
0 is sort_order
and delimit by |

Generally vallue is= Custom Option Value Name:price_type:price:SKU:sort_order

Please refer to Column M in the attached file. Add your custom option column wherever you like in your CSV file.

Answer for Sofa 2:
Try above steps.
It is working in Magento 1.3 and 1.4 as long as your product import is working well.

File Attachments
custom_option.txt  (File Size: 1KB - Downloads: 236)
 
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
Magento Community
Magento Community
Back to top