I am trying to update a custom attribute via a Magento script. All I need to do is change the label of the attribute, which is on the customer table.
I've found online that the main things to make sure of is the naming of the upgrade scripts, and the corresponding version in the config.xml file too.
Every time I try, the core_resource does get an upgrade / bump in version number correctly, but the label doesn't change. I assume it's something in my upgrade script. What am I doing wrong? Do I need to reference the attribute differently?
In the DB core_resources:
Equisolve_GenisysUserId_setup | 0.1.4 | 0.1.4
The config.xml file:
<?xml version="1.0"?>
<config>
<modules>
<Equisolve_GenisysUserId>
<version>0.1.4</version>
</Equisolve_GenisysUserId>
</modules>
<global>
<resources>
<Equisolve_GenisysUserId_setup>
<setup>
<module>Equisolve_GenisysUserId</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</Equisolve_GenisysUserId_setup>
<Equisolve_GenisysUserId_write>
<connection>
<use>core_write</use>
</connection>
</Equisolve_GenisysUserId_write>
<Equisolve_GenisysUserId_read>
<connection>
<use>core_read</use>
</connection>
</Equisolve_GenisysUserId_read>
</resources>
</global>
</config>
Original install file at install-0.1.0.php:
<?php
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttribute("customer", "genisys_user_id", array(
"type" => "varchar",
"backend" => "",
"label" => "Genisys User ID",
"input" => "text",
"source" => "",
"visible" => true,
"required" => false,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => "The Reference ID to the customer within Genisys / AlphaRENTAL to connect their user account with their existing information and orders."
)
);
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'genisys_user_id',
'999' //sort_order
);
$gUserAttribute = Mage::getSingleton("eav/config")->getAttribute("customer", "genisys_user_id");
$gUserAttribute->setData('used_in_forms', array('adminhtml_customer'));
$gUserAttribute->setData("is_used_for_customer_segment", true);
// Other options can be found in the customer_form_attribute database table; setting this data is required
$gUserAttribute->save();
$installer->endSetup();
?>
Upgrade script at upgrade-0.1.3-0.1.4.php:
<?php
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('customer','genisys_user_id','label', 'Genisys Customer Number');
$installer->endSetup();
?>
I know there is a gap in version numbers; there were files in between. The upgrade to 0.1.4 "ran" as evidenced by the core_resources version...but the label hasn't updated.
Thanks for the insight!
