0

I Have Try to store followers on store Database. I have some Problem

 <?php $connectionresource = Mage::getSingleton('core/resource'); 
    $readconnection = $connectionresource->getConnection('core_read'); 
    $allrecord = $readconnection->select()->from(array('userdata'=>'followup')) ->where('userdata.cus_mail=?', $email)->where('userdata.seller_id=?', $sellerid);
    $alldata =$readconnection->fetchAll($allrecord);
     if(!$alldata){?>
    <form action="<?php echo Mage::getUrl('followup/index/follow') ?>" method="post" id="follow-up">
        <?php $myStatus = Mage::getSingleton('customer/session')->isLoggedIn() ?>
        <?php if($myStatus): ?>
            <input type="hidden" id="sellerid" name="sellerid" value="<?php echo $partner->getMageuserid();?>" class="Follow-up-email-sellerid">
            <input type="submit" value="Follow Up" class="Follow-up-email">
            <?php else: ?>
            <li><a href="<?php echo Mage::getUrl('customer/account/login');?>" title="Customer Register">Follow Up</a></li>
        <?php endif ?>
    </form>
    <?php }
    else{?>
        <form action="<?php echo Mage::getUrl('followup/index/follow') ?>" method="post" id="follow-up">
        <?php $myStatus = Mage::getSingleton('customer/session')->isLoggedIn() ?>
        <?php if($myStatus): ?>
            <input type="hidden" id="sellerid" name="sellerid" value="<?php echo $partner->getMageuserid();?>" class="Follow-up-email-sellerid">
            <input type="submit" value="Following" class="Follow-up-email">
            <?php else: ?>
            <li><a href="<?php echo Mage::getUrl('customer/account/login');?>" title="Customer Register">Follow Up</a></li>
        <?php endif ?>
    </form>

   <?php  }?>

I can't able to find out the problem. What Mistake I done here??

1

add this code in controller otherwise on every refresh it will insert the data in amdin

 $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'   => $sellerid,
                              'cus_mail' => $email);
            $connectionWrite->query($query, $binds);
            //Mage::getSingleton('core/session')->addSuccess('Following');
  • Then how i restrict that button if already follow it show Following else it show follow up – Magento 2 Mar 22 '16 at 7:12
  • i told check it the same seller id or email in database. – Qaisar Satti Mar 22 '16 at 7:18
  • Okay i will check – Magento 2 Mar 22 '16 at 7:19
  • One customer can't able to follow more then one seller what is the problem – Magento 2 Mar 22 '16 at 10:38
  • what is unique of customer? – Qaisar Satti Mar 22 '16 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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