Question

I'm currently using the below to add a category programatically/in the front end

 <?php
 $category = Mage::getModel('catalog/category');
 $category->setName('new_category');
 $category->setIsActive(1);   
 $category->setIsAnchor(0);
 $parentCategory = Mage::getModel('catalog/category')->load("X");
 $category->setPath($parentCategory->getPath());
 $category->save();
 ?>

There are 2 settings which i need to be able to add - the setting of use parent category settings = yes and the category thumbnail

How can this be done with the above?

Was it helpful?

Solution

You can add the following lines for that:

$category->setCustomUseParentSettings(true);
$category->setThumbnail([image]);

The [image] is the name of the image that is located in media/catalog/category/

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top