i have added below code but i get above error: Source model "unidesign/myoption" not found for attribute "catcustomergroup"
i have added custom field to category add i am using below installer script:
it works fine but i want to show customer group dropdown here , i am stucked u how can i do it
app\code\local\Devshree\Unidesing\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Devshree_Unidesing>
<version>0.1.0</version>
</Devshree_Unidesing>
</modules>
<global>
<resources>
<customcatattrb_setup>
<setup>
<module>Devshree_Unidesing</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
<connection>
<use>default_setup</use>
</connection>
</customcatattrb_setup>
</resources>
</global>
</config>
app\code\local\Devshree\Unidesing\sql\customcatattrb_setup\mysql4-install-0.0.1.php
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'select',
'label'=> 'Customer Group',
'input' => 'select',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'source' => "unidesign/myoption",
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'catcustomergroup', $attribute);
$installer->endSetup();
?>
app\code\local\Devshree\Unidesing\Model\Myoption.php
<?php
Class MyNameSpace_Mymodule_Model_Myoption
extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
/**
* Retrieve all options array
*
* @return array
*/
public function getAllOptions()
{
if (is_null($this->_options)) {
$options = Mage::getResourceModel('directory/country_collection')->load()->toOptionArray();
array_unshift($options, array('value'=>'', 'label'=>Mage::helper('customer')->__('Select')));
$this->_options =$options;
}
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;
}
/**
* Retrieve Column(s) for Flat
*
* @return array
*/
public function getFlatColums()
{
$columns = array();
$columns[$this->getAttribute()->getAttributeCode()] = array(
"type" => "tinyint(1)",
"unsigned" => false,
"is_null" => true,
"default" => null,
"extra" => null
);
return $columns;
}
/**
* Retrieve Indexes(s) for Flat
*
* @return array
*/
public function getFlatIndexes()
{
$indexes = array();
$index = "IDX_" . strtoupper($this->getAttribute()->getAttributeCode());
$indexes[$index] = array(
"type" => "index",
"fields" => array($this->getAttribute()->getAttributeCode())
);
return $indexes;
}
/**
* Retrieve Select For Flat Attribute update
*
* @param int $store
* @return Varien_Db_Select|null
*/
public function getFlatUpdateSelect($store)
{
return Mage::getResourceModel("eav/entity_attribute")
->getFlatUpdateSelect($this->getAttribute(), $store);
}
}
problem i that i want to customer group drop down here how can i do this please help