Skip to content

Instantly share code, notes, and snippets.

@ArnaudLigny
Created August 31, 2012 16:20
Show Gist options
  • Save ArnaudLigny/3555333 to your computer and use it in GitHub Desktop.
Save ArnaudLigny/3555333 to your computer and use it in GitHub Desktop.
Cloning category?
<?php
// category source
$category_id = '3';
$category = Mage::getModel('catalog/category')->load($category_id);
$category_products = $category->getProductsPosition();
// clone category
$category_copy = clone $category;
$category_copy
->setId(null)
->setIsActive(0)
->seturl_key('')
->setName($category->getName() . ' (copy)')
->setPostedProducts($category_products)
->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment