I am trying to get a record from mysql database with Mage::getModel('amshuhucustomer/groupdomain')->load($id);
It is working with observer so no need for frontend in config.xml
But it is not loaded and saying 'Resource is not set'
module/etc/config.xml
<global>
<models>
<amshuhucustomer>
<class>Amshuhu_Customer_Model</class>
<resourceModel>amshuhucustomer_mysql4</resourceModel>
</amshuhucustomer>
<amshuhucustomer_mysql4>
<class>Amshuhu_Customer_Model_Mysql4</class>
<entities>
<groupdomain>
<table>customergroupdomain</table>
</groupdomain>
</entities>
</amshuhucustomer_mysql4>
</models>
<resources>
<amshuhucustomer_setup>
<setup>
<module>Amshuhu_Customer</module>
<class>Amshuhu_Customer_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</amshuhucustomer_setup>
<amshuhucustomer_write>
<connection>
<use>core_write</use>
</connection>
</amshuhucustomer_write>
<amshuhucustomer_read>
<connection>
<use>core_read</use>
</connection>
</amshuhucustomer_read>
</resources>
......
</global>
Groupdomain.php
class Amshuhu_Customer_Model_Mysql4_Groupdomain extends Mage_Core_Model_Mysql4_Abstract
{
protected function _construct()
{
$this->_init('amshuhucustomer/groupdomain', 'id');
}
}
Finally found the answer by myself.
Forget to add the initialization in the model itself.
Added the following in the _construct method solved the issue..
$this->_init('amshuhucustomer/groupdomain');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With