Save contact us queries in database magento and view it's listing in admin panel

Save contact us queries in database magento and view it's listing in admin panel

 To save contact us queries we need to override the Contacts_IndexController  and put the insert queries by overriding Post function. Also we need to create a module to show the customer queries listing in Admin  Panel and create a table with relevant field to save the contact us query.

 Below is the code to override Contacts_IndexController in config.xml file.
 
app/code/local/Letsknowit/Contactus/etc/config.xml
 
 
<config>
    <modules>
        <Letsknowit_Contactus>
            <version>0.1.0</version>
        </Letsknowit_Contactus>
    </modules>
<frontend>
       <routers>
            <contacts>
                <args>
                    <modules>
                        <Letsknowit_Contactus before="Mage_Contacts">Letsknowit_Contactus</Letsknowit_Contactus>
                    </modules>
                </args>
            </contacts>
        </routers>
       
    </frontend>
</config>
 
To create the table and fields to save the data we have to write a script at
below path
 
app/code/local/Letsknowit/Contactus/sql/contactus_setup/mysql4-install-0.1.0
 
<?php
 
$installer = $this;
 
$installer->startSetup();
 
$installer->run("
 
-- DROP TABLE IF EXISTS {$this->getTable('contactus')};
CREATE TABLE {$this->getTable('contactus')} (
  `contactus_id` int(11) unsigned NOT NULL auto_increment,
  `name` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  `telephone` varchar(255) NOT NULL default '',
  `comment` text NOT NULL default '',
  `status` smallint(6) NOT NULL default '0',
  `created_time` datetime NULL,
  `update_time` datetime NULL,
  PRIMARY KEY (`contactus_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
    ");
 
$installer->endSetup(); 
 
?>
 
Now in app/code/local/Letsknowit/Contactus/controllers/IndexController.php
we will put our insert query.
 
<?php
require_once 'Mage/Contacts/controllers/IndexController.php';
class Letsknowit_Contactus_IndexController extends Mage_Contacts_IndexController
{
    
 
    public function postAction()
    {
       $post = $this->getRequest()->getPost();
       
 
       /* code to save query , you can write our insert query here*/
       if ( $post ) {
          
                               $model = Mage::getModel('contactus/contactus');
$model->setData($post);
$model->save();
 
            }
     
 
    }
?>
 
 

0   0
Aditya Singh
profile john 16th April 2024

We also have a wide range of Escorts in Paharganj who are available on hourly basis. If you need an Paharganj Escort for just one hour, then you can avail our hourly rate option. This means that you can enjoy the company of a beautiful girl for as long as you like without having to pay extra money for it.

Write a comment ...
Post comment
Cancel
profile priyanka 4th April 2024

With our independent Daman Call Girls, you are in charge; your partner doesn't move an inch until you order. Your expectations define her actions.

Write a comment ...
Post comment
Cancel
profile Jeffree 29th March 2024

It seems like you're on the right track to override fnaf the Contacts module's functionality to save contact queries and display them in the admin panel.

Write a comment ...
Post comment
Cancel
profile Alvak 21st March 2024

This is realistic Magento functionality extension. Overriding the Contacts_IndexController to save 'Contact Us' inquiries directly into the database improves data management and customer service. burrito craft

Write a comment ...
Post comment
Cancel
profile Maurice 20th March 2024

In terms of useful knowledge geometry dash breeze, this blog is like finding a treasure trove. Very pleased that I stumbled onto it!

Write a comment ...
Post comment
Cancel
profile Leanna 18th March 2024

This blog is a goldmine prodentim of valuable information. So glad I found it!

Write a comment ...
Post comment
Cancel
profile Mike 19th February 2024

Awesome blog. I have read and thought about what you said. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!Michelle Keegan Leather Jacket Fool Me Once

Write a comment ...
Post comment
Cancel
profile Jeanette 13th February 2024

Good and useful article, thank you for sharing. Omegle online

Write a comment ...
Post comment
Cancel
profile Linda 16th January 2024

Explore the special features of Omegle online, an interesting chat application that prevents participants from getting bored.

Write a comment ...
Post comment
Cancel
profile Ammara 13th January 2024

Discover the beauty of Ammara Khan's unstitched suits collection for women. Timeless elegance and intricate designs await you. Shop now and create your own unique style.

Write a comment ...
Post comment
Cancel
profile Nani 12th January 2024

Discover the cutest new born baby clothes for your child. For your little one, choose from our collection of cozy and fashionable options. Shop right away to find the cutest outfits for the little one.

Write a comment ...
Post comment
Cancel
profile Declare 12th January 2024

Get the most recent trends in winter dresses to stay warm and fashionable this year. From warm clothing to elegant dresses, we have the right choice for you. Keep up to date with our collection of winter dresses.

Write a comment ...
Post comment
Cancel
profile Nayza 12th January 2024

Find the perfect pair of men trousers in pakistan at Nayza. We offer a wide range of stylish and trendy designs to suit your needs. Explore our collection now!

Write a comment ...
Post comment
Cancel
profile ECS 12th January 2024

Looking for kids shoes online in Pakistan? ECS offers their customer the best kids shoes. so, shop now for the best kids shoes online at ECS

Write a comment ...
Post comment
Cancel
profile chahyay 12th January 2024

Shop our collection of luxurious luxury formals at Chahyay. Find the perfect outfit for your next special occasion with our selection of high-quality luxury formals.

Write a comment ...
Post comment
Cancel

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site