I want to create a product attribute where the values are enumerated string codes like "value_1", "value_2", "value_2" so that I can match them cleanly without having to rely on an ID or a user facing label, which are both subject to change.
I created a "select" type attribute via installer and used my own source class with a simple getAllOptions() method. It shows up when editing products. Saving the value takes. The value gets stored in catalog_product_entity_varchar as it should.
Here is an example version of the custom source class:
<?php
class My_Catalog_Model_Source_Billingfrequency extends
Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
public function getAllOptions()
{
if (!$this->_options) {
$this->_options = array(
array(
'label' => 'Monthly',
'value' => 'monthly',
),
array(
'label' => 'Annually',
'value' => 'annually',
),
);
}
return $this->_options;
}
}
?>
The problem is that Magento does not push this value to flat tables. I also ensured that used_in_product_listing was on and reindexed.
Does anyone know if it's possible, using Magento product attributes to create an enumerated attribute without having to use the standard Magento ID/label values like you would set in the admin?