2

I need to override

Mage->Adminhtml->Model->System->Config->Source->Notification->Frequency.php

I followed the instructions outlined in Inchoo override magento model

I tested the changes i need by editing the original mage file... which worked. I then copied that edited file to my module

Myname->Modulename->Model->System->Config->Source->Notification->Frequency.php

Then placed the original file back in the mage folder.

I then edited the class of frequency.php:

class Myname_Modulename_Model_System_Config_Source_Notification_Frequency { public function toOptionArray() { return array( 0 => Mage::helper('adminhtml')->__('0 Minute'), 1 => Mage::helper('adminhtml')->__('1 Hour'), 2 => Mage::helper('adminhtml')->__('2 Hours'), 6 => Mage::helper('adminhtml')->__('6 Hours'), 12 => Mage::helper('adminhtml')->__('12 Hours'), 24 => Mage::helper('adminhtml')->__('24 Hours') ); } } 

I then added this to the config.xml file:

<config> <global> <models> <modulename> <rewrite> <item>Openstream_Notifications_Model_System_Config_Source_Notification_Frequency</item> </rewrite> </modulename> </models> </global> </config> 

But i am unable to see the override changes in the systems area, please help by telling me what i'm doing wrong. its my first time overriding a model.

1 Answer 1

2

You don't need to have <modulename> tag while overriding and also you will need to tell magento what file path is it exactly? In our case adminhtml_system_config_source_notification_frequency

<config> <global> <models> <adminhtml> <rewrite> <system_config_source_notification_frequency>Openstream_Notifications_Model_System_Config_Source_Notification_Frequency</system_config_source_notification_frequency> </rewrite> </adminhtml> </models> </global> </config> 

This should work however for neat coding I would also put my files under adminhtml folder since it belongs there. It will help you in future to know which file/folder belongs to admin/front section.

So your folder structure would be: Openstream_Notifications_Model_Adminhtml_System_Config_Source_Notification_Frequency. If you follow this then will need to change this exactly as follow:

 <adminhtml> <rewrite> <system_config_source_notification_frequency>Openstream_Notifications_Model_Adminhtml_System_Config_Source_Notification_Frequency</system_config_source_notification_frequency> </rewrite> </adminhtml> 

Hope this helps.

1
  • Glad it helped you. Commented Aug 28, 2015 at 1:40

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.