Created
August 31, 2012 16:20
-
-
Save ArnaudLigny/3555333 to your computer and use it in GitHub Desktop.
Cloning category?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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