I want to store Magento 1.9.2 contact form data into database?
I have create a New DB Table and create new Module on local Pool but Controller overwrite is not working.
I want to send email as well store all the data in my custom table.
My Code Is:
/app/etc/modules/Codefire_Contacts.xml
<?xml version="1.0"?>
<config>
<modules>
<Codefire_Contacts>
<active>true</active>
<codePool>local</codePool>
</Codefire_Contacts>
</modules>
</config>
/app/code/local/Codefire/Contacts/controllers/indexController.php
<?php
require_once(Mage::getModuleDir('controllers', 'Mage_Contacts') . DS . 'IndexController.php');
class Codefire_Contacts_IndexController extends Mage_Contacts_IndexController {
//your targeted controller action rewrite here
public function indexAction() {
parent::indexAction();
echo 'Good';
die;
}
public function postAction() {
echo 'Good';
die;
}
}
/app/code/local/Codefire/Contacts/etc
<?xml version="1.0"?>
<config>
<modules>
<Codefire_Contacts>
<version>0.1.0</version>
</Codefire_Contacts>
</modules>
<frontend>
<routers>
<contacts>
<args>
<modules>
<Codefire_Contacts before="Mage_Contacts">Codefire_Contacts</Codefire_Contacts>
</modules>
</args>
</contacts>
</routers>
</frontend>
</config>
Its not working…
Best Answer
Please add the following code in the config.xml file.
Rewrite the postAction() controller file and add the following code.
Please refer my tutorial for full code and file structure.
http://www.pearlbells.co.uk/save-contact-form-data-magento-database/