Skip to content

[Magento] Update category attributes programmatically

here you go


$resource = Mage::getResourceModel('catalog/category');		
$collection = Mage::getModel('catalog/category')->getCollection();

foreach($collection as $category) {

  $category->setStoreId(0);    // 0 for default scope (All Store Views)
  $category->setData('page_layout', 'two_columns_left');
  $resource->saveAttribute($category, 'page_layout');
				
  $category->setStoreId(0);    // 0 for default scope (All Store Views)
  $category->setData('is_anchor', 1);
  $resource->saveAttribute($category, 'is_anchor');
}


 

Share

Comments are closed.