0

Hi I try to create Followup to Particular seller.I don't know how to store Database. I create one Module.

My Sql

<?php
$installer = $this;
$installer->startSetup();
$sql=<<<SQLTEXT
create table followup(followup_id int not null auto_increment, name varchar(100),
seller_id varchar(255), cus_mail varchar(255), primary key(followup_id));

SQLTEXT;

$installer->run($sql);

my phtml

<?PHP     
//get customer login status ?>     
<?php $myStatus = Mage::getSingleton('customer/session')->isLoggedIn() ?>
 <?php if($myStatus): ?>
 <p> Follow Up </p>
 <?php else: ?>
 <li><a href="<?php echo Mage::getUrl('customer/account/login');?>" title="Customer Register">Follow Up</a></li>
 <?php endif ?>

If user Click Follow Up link then it will store Database. How to write code can anyone give some example for this

2 Answers 2

1

you can add in database with below

 $connectionresource = Mage::getSingleton('core/resource');

 $connectionWrite = $connectionresource->getConnection('core_write');

        $query = "insert into followup "
                         . "(name,seller_id, cus_mail) values "
                         . "(:name, :seller_id, :cus_mail)";

                  $binds = array(
                      'name'    => 'name ',
                      'seller_id'   => '1',
                      'cus_mail' => '[email protected]',

                  );

                  $connectionWrite->query($query, $binds);
29
  • If i click p tag it will store database
    – Magento 2
    Commented Mar 21, 2016 at 5:14
  • you have to add controller action there you add your code and add your required it is simple way to add data in database Commented Mar 21, 2016 at 5:17
  • Can you please give me the example i didn't have idea
    – Magento 2
    Commented Mar 21, 2016 at 5:21
  • this question i told how to add action. in place of send email save to database magento.stackexchange.com/questions/106705/… Commented Mar 21, 2016 at 5:23
  • 1
    Thanks Bro i got it in this way $sellerid = ''.$this->getRequest()->getPost('sellerid');
    – Magento 2
    Commented Mar 21, 2016 at 11:03
0

These two links should give you want you are looking for. Would have to adjust on you 'Follow Up' button.

https://stackoverflow.com/questions/16212396/store-magento-contact-form-data-in-database

Adding a custom function to insert contact forms to database after post action from frontend

Best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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