在数据库中创建新模型并存储联系表单详细信息 - magento

时间:2014-11-14 10:09:01

标签: php magento

错误:致命错误:在非对象上调用成员函数save() IndexController.php

           $model = Mage::getModel('contacts/contacts');
           $model->setGuestName( trim($post['name']) );
           $model->setGuestEmail(trim($post['email']));
           $model->setGuestTelephone(trim($post['telephone']));
           $model->setGuestComments(trim($post['comment']));
           $model->setGuestAttachment(trim($post['attachment']));
           $model->Mage_Core_Model_Abstract->save( );   

的Config.xml

          <models>
          <contacts>
          <class>Mage_Contacts_Model</class>
          <resourceModel>Contacts_Mysql4</resourceModel>        
          </contacts>
          <contacts_Mysql4>
          <class>Mage_Contacts_Model_Mysql4</class>
          <entities>
          <contacts>
          <table>contact_details</table>
          </contacts>
          </entities>                
          </contacts_Mysql4>
          </models>

0 个答案:

没有答案