0

I am add following Functionality to seller. How to get seller following count in that page

 <?php $connectionresource = Mage::getSingleton('core/resource');
        $readconnection = $connectionresource->getConnection('core_read'); 
        $allrecord = $readconnection->select()->from(array('userdata'=>'followup'))
        ->where('userdata.cus_mail=?', $email);
        $alldata =$readconnection->fetchAll($allrecord);
        if(!$alldata){?>

            <!-- Followers -->
    <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>
    <!-- Followers -->


            <?php $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');
         }
        else{?>

            <input type="submit" value="Following" class="Follow-up-email" readonly>
        <?php }?>

Also i want to restrict user follow same Seller More then one time

  • it email related to customer or seller id? – Qaisar Satti Mar 21 '16 at 12:18
  • Count related to Seller ID – Magento 2 Mar 21 '16 at 12:20
  • i mean which is related to customer i mean cannot add same email twice? – Qaisar Satti Mar 21 '16 at 12:22
1

you check with

$connectionresource = Mage::getSingleton('core/resource');
$readconnection = $connectionresource->getConnection('core_read'); 

$allrecord = $readconnection->select()->from(array('userdata'=>'marketplace_userdata'))
->wher‌​e('userdata.email=?', $email); //change on ur requirement seller_id or eamil
$alldata =$readconnection->fetchAll($allrecord);
if(!$alldata){
    //insert new record
 }else {
   //you are already listed as follower
 }

for count

$connectionresource = Mage::getSingleton('core/resource');
    $readconnection = $connectionresource->getConnection('core_read'); 

    $allrecord = $readconnection->select()->from(array('userdata'=>'marketplace_userdata'))
    ->wher‌​e('userdata.seller_id=?', $seller_id); 
    $alldata =$readconnection->fetchAll($allrecord);
   echo count($alldata);
  • add that code too – Qaisar Satti Mar 21 '16 at 12:26
  • Okay i will check it – Magento 2 Mar 21 '16 at 12:27
  • Count i understand But 1st thing i can't understand can you please explain it – Magento 2 Mar 21 '16 at 12:35
  • first thing is for Also i want to restrict user follow same Seller More then one time not add new record if it already there.. – Qaisar Satti Mar 21 '16 at 12:38
  • Thanks I Have one doubt After Follwing I wan to set Follow button as a readonly – Magento 2 Mar 21 '16 at 13:02

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.