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

Exporting Product Categories. 
 
termid0g
Jr. Member
 
Total Posts:  8
Joined:  2008-12-04
 

Is there an import/export profile, or has someone written a script, for exporting product categories?  I’m in the process of migrating 9000+ products from BVCommerce to a Magento implementation.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

You want products and categories… A API soap thingy will do it. Here is a script to just show the categories, it will take you a day with the api to get what you want.
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$begintime = $time;
?>
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
// hostname
$host= shop.net';
// if store in /magento change /shop, if store in root remove /shop
$client= new SoapClient('http://'.$host.'/shop/index.php/api/soap/?wsdl');

// Can be added in Magento-Admin -> Web Services with role set to admin
$apiuser= 'roy';
// API key is password
$apikey = 'rubin';
$sess_id= $client->login($apiuser, $apikey);
echo "<html>";
echo "<head>";
echo "<LINK REL=StyleSheet HREF=\"style.css\" TYPE=\"text/css\" MEDIA=screen>";
echo "</head>";
echo "<body>";

try {
echo "<h1>Category Tree</h1>";
$result= $client->call($sess_id, 'catalog_category.tree', array());
showCategory($result);
//var_dump($result);
} catch (Exception $e) {
echo "==> Error: " . $e->getMessage();
exit();
}

function showCategory($category, $indent=0)
{
for ($i=0; $i<$indent;$i++) { echo "  "; }
echo $category['name'] . " (".$category['category_id'] . ")<br />\n";

$indent++;
foreach ($category['children'] as $child)
{
showCategory($child, $indent);
}
$indent--;
}

?>
<?php
// Let's see how long this took…
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$endtime = $time;
$totaltime = ($endtime - $begintime);
echo '<br /><br /><em>This Magento SOAP API script took ' .$totaltime. ' seconds, precisely.</em>';
// ...and close the HTML document
echo "</body>";
echo "</html>";
?>

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