1

I want to move a category from parent category to another parent category.

category Drag and drop from admin is too slow. So how can I do this using code?

1

I think this will help for you,

First create one test file in root directory with below content and run www.example.com/test.php

$mobile_id = 246;
$mobile_cover_id = 116;
$category = Mage::getModel('catalog/category')->load($mobile_cover_id);
$category->move($mobile_id, null);
  • I am asking about magento 2. BTW Thanks, I have done. – Vinod Kumar Apr 28 '18 at 11:06
1
$categoryId = 183;
$parentId = 540;
$rootCat = $objectManager->get('Magento\Catalog\Model\Category');
$cat_info = $rootCat->load($categoryId);
$cat_info->move($parentId, null);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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