I am getting this error on save method of a model.

Fatal error: Call to a member function beginTransaction() on a non-object in /home/public_html/app/code/core/Mage/Core/Model/Abstract.php on line 313

$warranty = Mage::getModel('warrany/warrantydata');

I have this added xml for model


i also have the collection and model file

class Website_Warranty_Model_Warrantydata extends Mage_Core_Model_Abstract{}

class Website_Warranty_Model_Mysql4_Warrantydata extends Mage_Core_Model_Mysql4_Abstract {}
  • Could you please add some more information? - What does your config.xml look like? - Did you create the class in the Model folder? Sep 6 '13 at 10:55
  • It seams obvious...$this->_getRsource() does not return an object
    – Marius
    Sep 6 '13 at 10:57

In your resource model Website_Warranty_Model_Mysql4_Warrantydata you need to add this method :

public function _construct(){
    $this->_init('warranty/warrantydata', 'entity_id'); //the second parameter must be the primary key in your warrantydata table. If it's not `entity_id` then change it

and in your model class Website_Warranty_Model_Warrantydata you need this method:

public function _construct(){

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.