Sunday, 25 May 2014

How to Update category attribute code in magento ?



$installer = $this;
$installer->startSetup();
$installer->updateAttribute('catalog_category', 'old_attribute_code', array('attribute_code' => 'new_attribute_code'));
$installer->endSetup();



Script:


<?php
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$write->query("
  UPDATE eav_attribute val
  SET  val.attribute_code = "SET VALUE WHAT YOU WANT"
  WHERE  val.attribute_id = (
     SELECT attribute_id FROM eav_attribute eav
     WHERE eav.entity_type_id = 3
       AND eav.attribute_code = 'your-category-code'
    )
");

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home