Magento Forum

   
Page 1 of 35
A suggestion to import configurable products + categories
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Hi,

I have merged this two different adapters (maked with php-genius) ...and it works fine!

You need to put it in app/code/core/Mage/Catalog/Model/Convert/Adapter, then create an advanced profile, like this:

Profile Name:

Productwithconfigurablesandcategories

Actions XML:

<action type="dataflow/convert_adapter_io" method="load">
    <var 
name="type">file</var>
    <var 
name="path">var/import</var>
    <var 
name="filename"><![CDATA[name_of_my_impor_file.csv]]></var>
    <var 
name="format"><![CDATA[csv]]></var>
</
action>

<
action type="dataflow/convert_parser_csv" method="parse">
    <var 
name="delimiter"><![CDATA[,]]></var>
    <var 
name="enclose"><![CDATA["]]></var>
    <var name="
fieldnames">true</var>
    <var name="
store"><![CDATA[0]]></var>
    <var name="
number_of_records">1</var>
    <var name="
decimal_separator"><![CDATA[.]]></var>
    <var name="
adapter">catalog/convert_adapter_productwithconfigurablesandcategories</var>
    <var name="
method">parse</var>
</action>

Hope this helps!

smile

UPDATE: A little bug solved, new file uploaded!

2011 UPDATE: You can try the new 1.5 script here: http://www.magentocommerce.com/boards/viewthread/227005/#top

Regards!

File Attachments
Productwithconfigurablesandcategories.php  (File Size: 14KB - Downloads: 2510)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

That is very good and definitely helps me next week - worthy of a wiki entry too (hint, hint!).

 
Magento Community Magento Community
Magento Community
Magento Community
 
MrFang
Jr. Member
 
Total Posts:  5
Joined:  2009-03-04
 

While trying to import i get this Notice: Undefined index: config_attributes in /home/aaaa/public_html/magento/app/code/core/Mage/Catalog/Model/Convert/Adapter/Productwithconfigurablesandcategories.php on line 109. It appears after each record is imported.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jeffrey2
Member
 
Total Posts:  38
Joined:  2009-02-09
 

Can you upload your CSV file so we can see an example?

 
Magento Community Magento Community
Magento Community
Magento Community
 
FDA_HH
Jr. Member
 
Total Posts:  13
Joined:  2008-12-18
Hamburg
 

Hi,
I’m having some problems, i added the needed attributes and as far as i can tell the entries look fine in the DB (magento_catalog_product_super_link,magento_catalog_product_super_attribute) after the import. But still in the Admin Panel the Simple Products are not associated with the Configurable products, i cant even associated them with the admin because in the Associated Products tab the search wont find them (tried filter yes,no,any). Is there another place in the database?

What i find even stranger is, that if i add an one with the Quick product creation, that one is shown in the search. I looked at the entry in the magento_catalog_product_super_link and it looks like the one’s generated with the import function.

So my question is, how do configurable and simple products get linked on database level.

i added the import csv, maybe there is a problem with it.

cu
FDA

I’m using Magento ver. 1.2.1.2

File Attachments
cj_data._spikes.csv.txt  (File Size: 10KB - Downloads: 1543)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Hi again,

This is a valid .CSV sample, with “simple” and “configurable” products (the lines are separated with a breakline for human-read)

I use only one image for all the products asociated.

Please note the “associated” field:

"sku","store","attribute_set","config_attributes","type","news_from_date","categories","name","image","small_image","thumbnail","options_container","status","visibility","price","weight","description","qty","is_in_stock","shoe_size","associated" 

"CODIGO_ARTICULO_1"
,"default","Shoes","shoe_size","simple","","PUBLICIDAD","La descripcion 1","","","","Product Info Column","Enabled","Nowhere","0","3","La descripcion 1","848","1","M",""

"CODIGO_ARTICULO"
,"default","Shoes","shoe_size","configurable","27-03-2009 00:00:00","PUBLICIDAD","La descripcion","/IMG.jpg","/IMG.jpg","/IMG.jpg","Product Info Column","Enabled","Catalog, Search","0","3","La descripcion","848","1","","CODIGO_ARTICULO_1"

Regards!

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 
MrFang - 19 March 2009 01:07 AM

While trying to import i get this Notice: Undefined index: config_attributes in /home/aaaa/public_html/magento/app/code/core/Mage/Catalog/Model/Convert/Adapter/Productwithconfigurablesandcategories.php on line 109. It appears after each record is imported.

Your .CSV appears to be invalid.

In addition, please go to Catalog -> Attributes -> Manage Attributes and mark “Required” to “No” in all fields you are not including in your .CSV (example: I assign as “No” required “color”, “short_description” and some more, because they aren’t important to me)

Regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
MrFang
Jr. Member
 
Total Posts:  5
Joined:  2009-03-04
 

I think I almost have it.....now getting this error???

Recoverable Error: Argument 1 passed to Mage_Catalog_Model_Product_Type_Configurable::canUseAttribute() must be an instance of Mage_Eav_Model_Entity_Attribute, boolean given, called in /home/XXXXXX/public_html/magento/app/code/core/Mage/Catalog/Model/Convert/Adapter/Productwithconfigurablesandcategories.php on line 113 and defined in /home/kath5284/public_html/magento/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line 120

The Simple items imported, the Configurable items returned the above error for every instance

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Uhm… do you look into Catalog -> Attributes -> Manage Attributes? and Catalog -> Attributes -> Manage Attributes Set?

Please confirm that there isn’t required attributes that you are not including in the .CSV.

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Another consideration:

If you want to make the imported articles “active” ("in stock") then “purchable” by automatic way yo need to add a “status” row, with “Enabled” or “Disabled” (to appear as in_stock or out_of_stock)

Regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Another step… I try to make the import process totally automated, but… I find some errors…

The selected method is very simple: a cron job launch a local web-browser that update the store daily.

00  8 * * *   root /root/scripts/actualiza.sh

What is the problem? Any unix-text-browser I know supports javascript/ajax ejecution (I’m triying elsewhere with elinks2)

All of this methods directly dead in “Finished profile execution” :(

· wget --post-data="somedata" --save-cookies=/tmp/somefile.txt --keep-session-cookies -O /tmp/result.html http://url_of_magento_system_convert_gui/run/id/1/

· lynx --accept_all_cookies -cmd_script=/tmp/some_previous_saved_script http://url_of_magento_system_convert_gui/run/id/1/

· elinks http://url_of_magento_system_convert_gui/run/id/1/ (not automatized yet)

· w3m… the same

Now… somebody can help me about it?  hmmm

Thank you very much !!

The complete result are:

[note_msg_icon.gif] Starting profile executionplease wait...
[fam_bullet_error.gif] WarningPlease dont close window during importing/exporting data
[fam_bullet_success.gif] Starting Mage_Dataflow_Model_Convert_Adapter_Io :: load
[fam_bullet_success.gif] Loaded successfully"/var/import/myfile.csv"
[fam_bullet_success.gif] Starting Mage_Dataflow_Model_Convert_Parser_Csv :: parse
[fam_bullet_success.gif] Found 68 rows
[fam_bullet_success.gif] Starting catalog/convert_adapter_productwithconfigurablesandcategories :: parse
[note_msg_icon.gif] Finished profile execution.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MrFang
Jr. Member
 
Total Posts:  5
Joined:  2009-03-04
 

I found the errors and the file imported fine. The simple items are still not associated with their configurable counterpart HELP!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Please note that you need to fill correctly the “associated” row, there was a comma-separated list of the simple products sku’s ¿can you try it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MrFang
Jr. Member
 
Total Posts:  5
Joined:  2009-03-04
 

A sample of my csv file I’m using to import product

File Attachments
mycsvlayout.csv.txt  (File Size: 2KB - Downloads: 1372)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Dear friend,

As you know, CSV is a comma-separated-values file, like “aaa”,"bbb" (I think your .txt is only a sample)

Well, you don’t have any “associated” column, please read the entire post to know how to make a correct .csv, thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
taylors
Jr. Member
 
Total Posts:  3
Joined:  2009-03-30
 


Thanks for this importer, amartinez.  I like the way it creates categories for each product and can import attributes, etc.  I uploaded a large catalog yesterday and noticed, however, that the image importer has some funny behavior.  For many of the products, the real image was imported, but the image was set to a blank spacer image.  I looked through the code and you seem to be dumping all of the exceptions that come back from the image import. 

Is there something I’m missing?  Is there a specific switch or a file structure for the images that makes more sense?  Have you run into this problem before?

Thanks again for this great importer, though.  It has really made uploading our 2700 product catalog easier.

T

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