Saturday, 11 October 2014

how to check customer exist or not in magento

<?php
$websiteId = Mage::app()->getWebsite()->getId();
$email = 'abc@ptiwebtech.com';// Your Customers Email Here
   
function IscustomerEmailExists($email, $websiteId = null){
 $customer = Mage::getModel('customer/customer');

  if ($websiteId) {
            $customer->setWebsiteId($websiteId);
        }
        $customer->loadByEmail($email);
        if ($customer->getId()) {
            return $customer->getId();
        }
        return false;
    }
   
    $cust_exist = IscustomerEmailExists($email,$websiteId);

?>

No comments:

Post a Comment