Skip to content

Move a Magento category using code

March 30, 2011

Magento is a very powerful e-commerce system, however the developer-facing documentation is pretty light (read: missing) for some very basic things.

After relentless Googling and trawling through the Magento API, I finally found the following:

$categoryId = 456;
$parentId = 123;

$category = Mage::getModel('catalog/category')->load($categoryId);
$category->move($parentId, null);
Advertisements

From → Magento, PHP

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: