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

Export & import categories
 
dafencun
Jr. Member
 
Total Posts:  2
Joined:  2008-12-02
 

Hi,

For a store with multiple store views (e.g., Magento’s sample store with English, French and German), with Santhosh’s scripts, the imported categories go to all the store views, no matter what store codes (default, or french, or german) are set in the csv input file. Does anyone have the same issue and know how to import the categories into a specific view (.e,g. only to german)?

Another issue I have got is related to the format of the import file. With the input file being in utf8 format, the scripts can not import any categories. Can anyone share the ideas of making the script work with utf8?

Many thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
snowman58
Member
 
Total Posts:  54
Joined:  2009-04-09
 
michael_g08 - 08 April 2009 07:35 PM

I wrote my own script based on direct sql queries. Importing the tree of over 200 categories from temporary table into magento and asociating products with them.
I’ts hardcoded for my own needs, but i think it’s enough easy to change smile.

If somebody interested, I can share.

Hi, could you add an explaination of how to use your script for newbies?

Thanks for contributing.

 
Magento Community Magento Community
Magento Community
Magento Community
 
snowman58
Member
 
Total Posts:  54
Joined:  2009-04-09
 
michael_g08 - 23 April 2009 09:44 PM

Here Your are smile
Just do not forget to change the username & password to Your MySql.

File “products_import_sql.gz” includes temporary table structure. It have to be imported into base “magento_import” which You have to create manualy.

Regards, Michael.

Michael,

Could you add an explaination of how to use your script for newbies?

Thanks for contributing

 
Magento Community Magento Community
Magento Community
Magento Community
 
ilib
Member
 
Total Posts:  49
Joined:  2008-11-25
Москва
 

Hi everybody
I used Hucke-Media files to import categories (THe initial methos is actually the same) into 4 sites of multisite configuration
About 100 categories per site. As soon as categories were being imported I noticed that the time to open Catalog -> Manage Categories became much longer. When the last site categories were imported it take about 5 minutes to open Manage Categories page. Do you have any idea how to fix it? question

 
Magento Community Magento Community
Magento Community
Magento Community
 
smagu
Jr. Member
 
Total Posts:  1
Joined:  2009-06-04
 

Hello,

I followed Hucke-Media method and i am getting error:

Starting profile executionplease wait...
    * 
WarningPlease don't close window during importing/exporting data

    * Starting Mage_Dataflow_Model_Convert_Adapter_Io :: load
    * Loaded successfully: "/home/admin/public_html/var/import/Categories.csv"
    * Starting Mage_Dataflow_Model_Convert_Parser_Csv :: parse
    * Found 4 rows
    * Starting catalog/convert_adapter_category :: parse
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * Processed 0% 0/4 records
    * Imported 0 records
    * Finished profile execution.

Maybe someone have any idea?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ilib
Member
 
Total Posts:  49
Joined:  2008-11-25
Москва
 

Something is wrong with Categories.csv file

`store` column must consist of storeview codes
No empty rows
the 1st row must be:

store,categories
smagu - 04 June 2009 03:08 PM

Hello,

I followed Hucke-Media method and i am getting error:

Starting profile executionplease wait...
    * 
WarningPlease don't close window during importing/exporting data

    * Starting Mage_Dataflow_Model_Convert_Adapter_Io :: load
    * Loaded successfully: "/home/admin/public_html/var/import/Categories.csv"
    * Starting Mage_Dataflow_Model_Convert_Parser_Csv :: parse
    * Found 4 rows
    * Starting catalog/convert_adapter_category :: parse
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * <br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/admin/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />
    * Processed 0% 0/4 records
    * Imported 0 records
    * Finished profile execution.

Maybe someone have any idea?

Thanks.
 
Magento Community Magento Community
Magento Community
Magento Community
 
F. P.
Member
 
Total Posts:  55
Joined:  2007-12-09
 

Hi michael_08,

thank you for posting that script. Could You please tell us how it should be installed? I did create an additional database with the name: magento_import and I did insert the given SQL tables. Did put a few example data into that database and tried to start the script. It simply does not work. I cannot connect to the new created database. The script does stop immediately without any result. Does it need a special server configuration to connect with 2 databases at the same time? I am shure to have inserted the right passwords and users for both databases into your script.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Wouter (@MidoMedia)
Member
 
Avatar
Total Posts:  44
Joined:  2007-11-28
 

FYI @ smagu (or others with the fatal error): I finally got it working when I manually edited the csv file to literally contain only:

store,categories
default,testing
default,more_testing

If you still have this problem or you’re using Excel to create the CSV, check in a text-editor if Excel hasn’t for example put ; instead of ,

Kudos to Santhosh for posting this amazing script!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MI
Sr. Member
 
Total Posts:  172
Joined:  2008-12-11
Spain
 

Thanks santhosh kumar!! It works great!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MI
Sr. Member
 
Total Posts:  172
Joined:  2008-12-11
Spain
 

One thing more!

Checking “catalog_category_entity” table after import categories I have seen that the new categories fields are all right except “attribute_set_id” field that has “0” value while the other categories have “12” value.

To improve that I have changed Category.php adding this line: 

$cat = Mage::getModel(’catalog/category’)
->setStoreId($store->getId())
->setPath($path)
->setName($catName)
->setAttributeSetId($cat->getDefaultAttributeSetId())
->setIsActive(1)
->setIsAnchor(1)
->setDisplayMode($dispMode)
->save();

Sorry for my poor english I hope you can understand me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dibears
Jr. Member
 
Total Posts:  2
Joined:  2009-07-18
 

Does anyone know how to use commas to separate the parent and child categories? For instance, if I have a Test category with a SubTest sub category, using Santhosh’s method, I would need to specify in the .csv like so: default, Test/SubTest.

This isn’t very conducive to a csv file in that it’s usually separated by commas. I would like for it to be like so: default, Test, SubTest.

Is this as simple as modifying the class code Santhosh provided or does it not work like that? If it is that way, can someone help and show me what/where I would need to modify to do so?

Thanks alot, any help would be greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rob W
Jr. Member
 
Total Posts:  6
Joined:  2009-05-31
 
Dibears - 18 July 2009 01:49 PM

Does anyone know how to use commas to separate the parent and child categories? For instance, if I have a Test category with a SubTest sub category, using Santhosh’s method, I would need to specify in the .csv like so: default, Test/SubTest.

This isn’t very conducive to a csv file in that it’s usually separated by commas. I would like for it to be like so: default, Test, SubTest.

Is this as simple as modifying the class code Santhosh provided or does it not work like that? If it is that way, can someone help and show me what/where I would need to modify to do so?

Thanks alot, any help would be greatly appreciated.

The categories are designed to be read as one column, so changing it from / to , is counter-intuitive! If you really want to use commas, you’d need to enclose the columns with quote marks ("default”,"Test,SubTest") etc. You’d also need to make sure, however, that the Category.php code knows how to deal with these changes, and that’s another matter entirely!

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

@F.P.
Hi. Sorry for not replying. Did You look at `products` table?
There are fields “category1”, “category1_id” and so on.
1. You have to fill that fields with Your categories.
2. Did You changed connection settings in both DB connections?
3. Do not forget to change the path to your Mage.php
4. If You want to make relationship with the products, they have to be allready in magento DB.
If not - comment Lines 123 and 125.

You do not have to install it. Just open it in browser.

If that didn’t help - ask. I’ll be online now.

Regards, Michael.

 
Magento Community Magento Community
Magento Community
Magento Community
 
F. P.
Member
 
Total Posts:  55
Joined:  2007-12-09
 

Hi Michael,

do you mean that if I just have the category names your script is able to create those category entries by name, that means it creates itself those categories in the magento tables, reads out the created category id and puts them into your helper table.
Or do you mean I first have to create those categories manually and your script is able to handle those given categories by putting the products into those given categories. Do I have first to create categories manually before using your script or is it possible to put names into the fields category1, category2, category3 and the script creates those categories on the fly?

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

@F.P.

Hi, not that script will not do that. But I have another script for that purpose.
If You want I can post it here.

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