While programmatically creating category, using the below code, i got a error
Category with the 'categorgyurl' url_key attribute already exists
code:
$category = new Mage_Catalog_Model_Category();
$category->setName('categorgyurl');
$category->setUrlKey('categorgyurl');
$category->setIsActive(1);
$category->setDisplayMode('PRODUCTS');
$category->setIsAnchor(0);
$parentCategory = Mage::getModel('catalog/category')->load($root_catid);
$category->setPath($parentCategory->getPath());
$category->save();
how to set, if category url
already exits then make it change(ie. Rename it automatically/programmatically).