<?php
//Export Categories Magento
//Upload this file in root and access from url.
//Exported file will be stored in var/import
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel ( 'catalog/category' );
$tree = $category->getTreeModel ();
$tree->load ();
$ids = $tree->getCollection ()->getAllIds ();
if ($ids) {
$file = "var/import/catwithid.csv";
file_put_contents($file,"catId, catName\n");
foreach ( $ids as $id ) {
$string = $id . ', ' .$category->load($id)->getName() . "\n";
file_put_contents($file,$string,FILE_APPEND);
}
}
?>
//Export Categories Magento
//Upload this file in root and access from url.
//Exported file will be stored in var/import
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel ( 'catalog/category' );
$tree = $category->getTreeModel ();
$tree->load ();
$ids = $tree->getCollection ()->getAllIds ();
if ($ids) {
$file = "var/import/catwithid.csv";
file_put_contents($file,"catId, catName\n");
foreach ( $ids as $id ) {
$string = $id . ', ' .$category->load($id)->getName() . "\n";
file_put_contents($file,$string,FILE_APPEND);
}
}
?>
category_id , i can't get it.because i create Category Import / Export Extension module.
ReplyDeletepublic function setcategoryid($row)
{
$collection = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('level');
$collection = $this->addAttributesToSelect($collection);
$collection->getSelect()->order('level');
$Ids = $collection->getAllIds();
foreach ($Ids as $id)
{
}
return implode('/',$Ids );
}
above code at foreach, i cant know how get category_id to write to csv file.
can you help me?
Hi truongngoc,
Deleteif you wish i can provide you complete module for categories export and import.
for this you can put your request here with your email id .
Thanks
This comment has been removed by the author.
ReplyDeletemy email :phongdevelopers@gmail.com thank alot Afroz Alam
ReplyDeleteI have sent you my categories import/export module by mail. Please revert back if you have any issue.
Deletethanks for replying, Afroz Alam. this is my gmail address : truongvietngocl@gmail.com . Please send to me your complete module import/export.thank you vary much, Afroz Alam. I am nice to know you! good luck, wish best for you,Afroz Alam.
ReplyDeleteI have sent you my categories import/export module by mail to your email id. Please revert back if you have any issue.
Deletehi Afroz Alam, thank you for sending your module to me. but now i have another issue, can you help me, in import/export product by csv file. with category_ids attribute must input is its ID, but i want to input path of category, not category_ids. so you can suggest to me that issue. you have seen that issue before?
Deletethank you in advance, Afroz Alam!
hello Afroz, can you please send me the module to my email? saziine@hotmail.com
ReplyDeleteI have sent you the required module. Please check your mail.
DeleteThis comment has been removed by the author.
ReplyDeleteHi Afroz, can you please send me the module to my email? alexrunner1@gmail.com
DeleteThanks
Hi Afroz, can you please send me the module to my email? alexrunner1@gmail.com...Thanks
ReplyDeleteHi Afroz, can you please send me the module also to my email? verkoop88@live.nl..........Many thanks
ReplyDeletecan you send me this module?:) reganck@o2.pl :) Thanks!
ReplyDeletehello
ReplyDeletei have to import category in magento
its in tree structure
eg:
Clothing & Accessories/Baby/Baby Boys/Bodysuits
Clothing & Accessories/Baby/Baby Boys/Bottoms/Shorts
help mee
Hi Shweta
DeleteCan you provide your email so i can assist better.
HI Afroz
ReplyDeletecan u send me that extension please.
Can you please brief your requirements?
Deletemy email ID vaibhav16singh@gmail.com
ReplyDeleteThe blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up..
ReplyDeletemagento development company in bangalore