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
 
ArthurCatigbe
Member
 
Total Posts:  34
Joined:  2009-06-02
 
quatermain - 02 December 2009 11:05 AM

Hello, I have this error:

<br /> <b>Fatal error</b>: Call to undefined method Mycomp_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home6/umelecke/public_html/test/app/code/local/Mycomp/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>43</b><br />

This show me with MyComp solution and ImpCat_Katalogdaten_importieren solution although I do all things in “manual”. Can you help me?

I also have this problem. Has anyone found a solution to this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
digitalcomputernetwork
Jr. Member
 
Total Posts:  11
Joined:  2009-05-29
 

What good is it to import the categories separate from the products? This should be done together.  Does anyone have a non impossible way to import a product list in this format.  : “category” “product name” “description” “price” “image url” etc....

 
Magento Community Magento Community
Magento Community
Magento Community
 
ArthurCatigbe
Member
 
Total Posts:  34
Joined:  2009-06-02
 

You can’t set details for categories using that method. Such as whether or not the category is an anchor, or any meta data for the categories.

 
Magento Community Magento Community
Magento Community
Magento Community
 
highfructose
Jr. Member
 
Total Posts:  3
Joined:  2010-01-06
 

i had a problem getting this working but i fixed it before anyone replied… it ended up being a cache problem… I had everything disabled except for configuration. Make sure you have all caching disabled!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Azim
Sr. Member
 
Total Posts:  97
Joined:  2008-09-17
NY, USA
 

I just made this work for my site, But now i have products which have three categories to one product. Three different categories, so which menas if i use this method to import products to pre-imported categories i am gonna end up with new categories import.
I need some help i have this import category profile working ok, But i need to import products to the categories by names not ids.
Any help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hmpierson
Sr. Member
 
Total Posts:  101
Joined:  2008-11-15
 

My situation is a little more complicated, because I have several Top Level categories, which can each contain next level categories with the same name.

If this is never a possibility for you, (i.e. you are able to have a unique index on the category names) you only need two fields, category number and category name. Refreshing the table when you add/delete/edit categories goes very quickly.

partial code to import categories from the results of a mysql query

(replace the 7 in array(7,$cat_details) with the parent category id of your new category)

$cat_details = array ();
$cat_details["name"] = “name”;
$cat_details["is_active"] = “1”;
$cat_details["available_sort_by"] = “name”;
$cat_details["default_sort_by"] = “name”;
$cat_details["is_anchor"] = 1;

while ($row = mysql_fetch_row($result)) {
$cat_details["name"] = $row[0];
echo $cat_details["name"] . “<br>\n”;
$newCategoryId = $proxy->call($sessionId,’category.create’,array(7,$cat_details));
echo $cat_details["name"] . “newCategoryId = $newCategoryId <br>\n”;
ob_flush();
flush();

usleep(300000);

}

FWIW, I inderstand your wanting to be able to import/assign products to categories by “name” and not bi id. So I created a table that has the name for each category id, and I repoplulate it each time when I add categories. Then I look into that table to find the category id when I assign a product to categories for which I know the name. In my case, I have just a few “parent” categories that are identified by the enum. Your mileage will vary, but you can extend the concept.

CREATE TABLE IF NOT EXISTS `hp_cat_nums` (
`catnum` int(11) NOT NULL,
`class` enum(’B’,’T’,’E’,’S’,’F’) NOT NULL,
`Name` varchar(60) NOT NULL,
PRIMARY KEY (`catnum`),
KEY `class` (`class`),
KEY `Name` (`Name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

And here is my script for updating that table:

if (@mysql_connect(DB_HOST,DB_USER,DB_PWORD))
mysql_select_db(DB_NAME);
else die("Could not connect!");

foreach ($cat_tree["children"] as $cat) {



try{
$ar = $proxy->call($sessionId, ‘category.info’,$cat[’category_id’]);
if ($ar)
{echo “<br>success for “ . $row[0] . “ category “ . $cat["name"] . “<br>\n”;

$class = substr($cat["name"],0,1);

$sub_cat_tree = $proxy->call($sessionId, ‘category.tree’,$cat[’category_id’]);
foreach($sub_cat_tree["children"] as $sub_cat) {
$sql = “Select Name from hp_cat_nums where class = ‘$class’ and Name = ‘“ . $sub_cat["name"] . “‘“;
$result = mysql_query($sql);
if ($rr = mysql_fetch_row($result)) {
$s = “Update hp_cat_nums set catnum = “ . $sub_cat[’category_id’] . “ where class = ‘$class’ AND Name = ‘“ . $sub_cat["name"] . “‘“;
echo “<blockquote>$s</blockquote><br>\n”;
$r = mysql_query($s);
} else {
$s = “Insert into hp_cat_nums values (” . $sub_cat[’category_id’] . “, ‘$class’,’” . $sub_cat["name"] . “‘)”;
echo “<blockquote>$s</blockquote><br>\n”;
$r = mysql_query($s);
}
}

// var_dump($ar);




} else




{echo “<br>failure for “ . $row[0] . “ category “ . $cat["name"] . “<br>\n”;}
}
catch (SoapFault $e) {echo “<br> $e <br>No Category Found for id “ . $cat["category_id"] . “\n”;}

}

rentown - 07 November 2009 07:53 AM

hi
pezomatic

doenst the link below import categories?
http://www.magentocommerce.com/wiki/how-to/how_to_import_category_structure_with_products_using_dataflow
can you take a look and see if this is it?

and if yes how can be installed as i did install but its not working at all.

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
mgrandio
Jr. Member
 
Total Posts:  20
Joined:  2009-05-12
 

Hi,

I tried the code but also have the error:

ArthurCatigbe - 29 December 2009 12:39 PM

quatermain - 02 December 2009 11:05 AM
Hello, I have this error:

<br /> <b>Fatal error</b>: Call to undefined method Mycomp_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home6/umelecke/public_html/test/app/code/local/Mycomp/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>43</b><br />

This show me with MyComp solution and ImpCat_Katalogdaten_importieren solution although I do all things in “manual”. Can you help me?

I also have this problem. Has anyone found a solution to this?

cleared cache no solution, any sugestion, i am using magento 1.3.2.4

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Marius-H
Jr. Member
 
Total Posts:  3
Joined:  2009-10-09
 

Hello
I did use the German method. But all my foreign characters were missing. All Æ Ø Å are gone. What can be changed to make it work?

Marius

 
Magento Community Magento Community
Magento Community
Magento Community
 
nervosu
Jr. Member
 
Total Posts:  1
Joined:  2010-03-05
 

Hi,

I have this problem: all categories listed looks the same for all products: Root Catalog>Electronics>Cell Phones .... !!

It is a fresh install of 1.4.0.1, default products and categories.
Below is the XML code. Can you pls take a look? Am I missing smth?

<action type="catalog/convert_adapter_product" method="load">
<var name="store"><![CDATA[1]]></var>
</action>

<action type="catalog/convert_parser_product" method="unparse">
<var name="store"><![CDATA[1]]></var>
<var name="url_field"><![CDATA[1]]></var>
</action>

<action type="dataflow/convert_mapper_column" method="map">
<var name="map">
<map name="sku"><![CDATA[sku]]></map>
<map name="name"><![CDATA[name]]></map>
</var>
<var name="_only_specified">true</var>
</action>

<action method="unparse" type="exportextension/modifier">
<var name="remove_line_breaks">true</var>
<var name="remove_html_tags">true</var>
<var name="add_categories">true</var>
<var name="category_field_name">category</var>
<var name="category_delimiter">#</var>
<var name="category_first_level">-1</var>
<var name="category_path_delimiter"><![CDATA[>]]></var>
</action>

<action type="dataflow/convert_parser_csv" method="unparse">
<var name="delimiter"><![CDATA[,]]></var>
<var name="enclose"><![CDATA["]]></var>
<var name="fieldnames">true</var>
</action>

<action type="dataflow/convert_adapter_io" method="save">
<var name="type">file</var>
<var name="path">var/export</var>
<var name="filename"><![CDATA[export_2010-03-10_00-56.csv]]></var>
</action>

Thanks.
Rgds

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rico Winter
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-20
Leipzig
 

Thx alot!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jompis
Jr. Member
 
Total Posts:  7
Joined:  2010-03-16
 

Hey!
I’m having some trouble importing categories with non UTF8-characters!
Tried to convert them with PHPs UTF8_ENCODE() since I retrieve the categories from another mysql table.
The categories are imported, but the problem is that the shop displays the converted utf8 characters and not the original.
So how can I import the no UTF8 characters and still show them normally?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Esty
Member
 
Avatar
Total Posts:  39
Joined:  2010-03-27
Toronto, Canada
 

Hello everyone, I successfully imported the categories.cvs file but now I’m going though the code trying to understand it and Magento.

$batchModel Mage::getSingleton('dataflow/batch');
/* @var $batchModel Mage_Dataflow_Model_Batch */

$batchImportModel $batchModel->getBatchImportModel();
$importIds $batchImportModel->getIdCollection();

According to the Magento documents getBatchImportModel() returns an object of type Mage_Dataflow_Model_Import_Export. I can not however find any docs for this class and the source code doesn’t have a app/code/core/Mage/Dataflow/Model/Import/Export.php file.

How would I ever know that this class has an getIdCollection() method??

Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Esty
Member
 
Avatar
Total Posts:  39
Joined:  2010-03-27
Toronto, Canada
 

Hello again everyone,

Don’t know if it’s the best way or not but to find out the methods available from a object I did the following:

$cat2 Mage::getModel('catalog/category');
$class_methods get_class_methods($cat2);
$message Mage::helper('catalog')->__('Print out of catalog/category ' var_dump($class_methods));
Mage::throwException($message);

Hope it helps someone else.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kopila
Jr. Member
 
Total Posts:  3
Joined:  2010-04-04
 

Any Solution
I am facing this problem
<br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/mymagen1/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kopila
Jr. Member
 
Total Posts:  3
Joined:  2010-04-04
 

I receive this error
<br /> <b>Fatal error</b>: Call to undefined method ImpCat_Catalog_Model_Convert_Adapter_Category::getStoreById() in <b>/home/mymagen1/public_html/app/code/local/ImpCat/Catalog/Model/Convert/Adapter/Category.php</b> on line <b>42</b><br />

I would appreciate if anyone could post the solution

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