My Source File :
<?php
class Dbaux_Customer_Model_Source_WhatsappOption extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
/**
* Retrieve all options array
*
* @return array
*/
public function getAllOptions()
{
if (is_null($this->_options)) {
$this->_options = array(
array(
"label" => Mage::helper("eav")->__("New User"),
"value" => 0
),
array(
"label" => Mage::helper("eav")->__("Opted In"),
"value" => 1
),
array(
"label" => Mage::helper("eav")->__("Opted Out"),
"value" => 2
),
array(
"label" => Mage::helper("eav")->__("Not Registered"),
"value" => 3
),
);
}
return $this->_options;
}
/**
* Retrieve option array
*
* @return array
*/
public function getOptionArray()
{
$_options = array();
foreach ($this->getAllOptions() as $option) {
$_options[$option["value"]] = $option["label"];
}
return $_options;
}
/**
* Get a text for option value
*
* @param string|integer $value
* @return string
*/
public function getOptionText($value)
{
$options = $this->getAllOptions();
foreach ($options as $option) {
if ($option["value"] == $value) {
return $option["label"];
}
}
return false;
}
}