简体   繁体   中英

import & Export all categories in csv format

如何使用csv格式导入和导出magento中的所有类别?

Mass Product Importer - Magmi Project

The magmi project initial goal was to provide a product mass import script from csv files that match magento dataflow csv export format.

The main project goal is to achieve dataflow like operations with a reasonable speed.

http://sourceforge.net/projects/magmi/

I used Magmi for Mass products import products it is good for fast products import but there are many issues we have to fix it to make it work. Now i am looking for Import Export Categories code but i am unable to find it then i got Import Export Categories extension, http://www.magentocommerce.com/magento-connect/import-export-categories-extension.html It works great. Easy to install and work as per my requirements. fully satisfied.

This forum post on the Magento website takes you through the process. It adds a new Adapter to import categories via the Magento importer. This is the recommended approach rather than using raw SQL due to the complex joins and indexes.

I dont know about exporting it.I only know how to import it. To importing category: 1. Create Advanced Profile and paste the code written by santosh kumar from this forum http://www.magentocommerce.com/boards/viewthread/26022/ and save it.

  1. I get blank admin page while running it,so need to modify dataflow.xml from adminhtml/default/default/layout/ <adminhtml_system_convert_profile_run> <remove name = "root"/> <block type="adminhtml/page" name="convert_root" output="toHtml" template="page.phtml"> <block type="adminhtml/page_head" name="convert_root_head" as="head" template="page/head.phtml"> <action method="addJs"><script>prototype/prototype.js</script></action> <action method="addJs"><script>prototype/validation.js</script></action> <action method="addJs"><script>varien/js.js</script></action> <action method="addJs"><script>mage/translate.js</script></action> <action method="addJs"><script>mage/adminhtml/tools.js</script></action> </block> <block type="adminhtml/system_convert_profile_run" name="system_convert_profile_run" template="system/convert/profile/process.phtml" output="toHtml"/> </block> </adminhtml_system_convert_profile_run> and flush magento cash, Now you can see profile executes. One more thing you need to create categories.csv in var/import folder and in which you have to write store,categories default,Sports default,Sports/Cricket default,Sports/Tenis .

The following code works for me. Please check the following link for full code. https://www.pearlbells.co.uk/export-woocommerce-categories-csv/

function getCategories() {
wp_reset_query();
$custom_terms = get_terms('product_cat');
$allData = array();
foreach( $custom_terms as $custom_term ) {

    $categoryData = array( $custom_term->term_id, $custom_term->parent, $custom_term->name, $custom_term->slug, $custom_term->description  );
    $seoData = yoastSeoDetails( $custom_term->term_id );
    $featuredImage = getCategoryImage( $custom_term->term_id  );
    $allData[$custom_term->term_id] = array_merge( $categoryData, $seoData, $featuredImage );
}
createCSV($allData);
}

function getCategoryImage( $catId ) {

$thumbnail_id = get_woocommerce_term_meta( $catId, 'thumbnail_id', true ); 
$catImageUrl = wp_get_attachment_url( $thumbnail_id );    
return array($catImageUrl);

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM