Tag Archives: Category

Magento Create Attribute Source Model

1) Create the file app/code/local/Mage/Eav/Model/Entity/Attribute/Source/Cms.php and paste the code

class Mage_Eav_Model_Entity_Attribute_Source_Cms extends Mage_Eav_Model_Entity_Attribute_Source_Table{
public function getAllOptions($withEmpty = true){
if (!$this->_options) {
$options = array();
$options[] = array(
‘value’ => ‘0’,
‘label’ => ‘No’,
$options[] = array(
‘value’ => ‘1’,
‘label’ => ‘Yes’,
$this->_options = $options;
$options = $this->_options;

if ($withEmpty) {
array_unshift($options, array(
‘value’ => ”,
‘label’ => ‘Please Select’,

return $options;

Magento Delete Custom Category Attribute

1)Change the directory to the root of magento installation

2)  vi app/etc/modules/Pcode_Attribute.xml and paste the below given content

3) mkdir app/code/local/
4) mkdir app/code/local/Pcode
5 )mkdir app/code/local/Pcode/Attribute
6) mkdir app/code/local/Pcode/Attribute/etc
7) mkdir app/code/local/Pcode/Attribute/sql
8) mkdir app/code/local/Pcode/Attribute/sql/categoryattribute_setup
9) vi app/code/local/Pcode/Attribute/sql/categoryattribute_setup/mysql4-install-0.1.0.php and paste the below given code

$this->removeAttribute(‘catalog_category’, attribute_code);

10) vi app/code/local/Pcode/Attribute/etc/config.xm and paste the below code
<?xml version=”1.0″?>