I make a new module which is a simply form, but i can not write into the ddbb, because (i think) can not find the model. I have this code in controllers/IndexController.php:
public function createPersonAction() {
$data = $this->getRequest()->getPost();
$session = Mage::getSingleton('core/session');
$landing = Mage::getModel('landing/landing');
$landing->setData('name', $data['name']);
$landing->setData('apellido1', $data['apellido1']);
$landing->setData('apellido2', $data['apellido2']);
$landing->setData('email', $data['email']);
$landing->setData('telefono', $data['telefono']);
//$person->setData($data);
try{
$landing->save();
$session->addSuccess('Add a person sucessfully');
}catch(Exception $e){
$session->addError('Add Error');
}
$this->_redirect('landing');
}
But i have this error:
Fatal error: Call to a member function setData() on boolean in \app\code\local\LP\Landing\controllers\IndexController.php on line 28
(Line 28 is --> $landing->setData('name', $data['name']);)
I have all the needed files, this is my tree:
\app\code\local\LP\Landing\Block\Index.php
\app\code\local\LP\Landing\Block\Adminhtml\Landingbackend.php
\app\code\local\LP\Landing\controllers\IndexController.php
\app\code\local\LP\Landing\controllers\Adminhtml\LandingbackendController.php
\app\code\local\LP\Landing\etc\config.xml
\app\code\local\LP\Landing\Helper\Data.php
\app\code\local\LP\Landing\Model\Landing.php
\app\code\local\LP\Landing\Model\Resource\Landing.php
\app\code\local\LP\Landing\Model\Resource\Landing\Collection.php
\app\code\local\LP\Landing\sql\landing_setup\mysql4-install-0.1.0.php
Help please.