0

I have created an New category called Mobile(ID : 646).

I already have another category Mobile cover(ID : 516).

So i need to move all Mobile cover under Mobile category

Mobile is root category and Mobile cover is sub category

How i can move Programatically

2

1 Answer 1

3

For example create a file named test.php with the below content and place it in magento root folder. Then run your site www.yoursite.com/test.php

<?php
require_once("app/Mage.php");
Mage::app();
$mobile_id = 646;
$mobile_cover_id = 516;
$category = Mage::getModel('catalog/category')->load($mobile_cover_id);
$category->move($mobile_id, null);
?>

Its working for me.

5
  • ya i tried but it's not working
    – Magento 2
    Oct 5, 2015 at 14:59
  • i put root folder but it's not working
    – Magento 2
    Oct 5, 2015 at 14:59
  • You can set up a module and use this code. It will work.
    – vinothavn
    Oct 5, 2015 at 15:45
  • set up module in the sense? where i have to use
    – Magento 2
    Oct 5, 2015 at 16:42
  • I have updated the answer. Please check it. No need of module creation. Just follow the steps in answer
    – vinothavn
    Oct 5, 2015 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.