-1

when i write below code

$email=$recipient['email'];
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($email);

i get error entity value can be null why so what should i write there

what should i write to make it work, i had already set share customer to global but stilll same error message

1 Answer 1

0

The section of code you share is correct, however I don't know the value if any of $recipient['email'] so for testing try hardcoding the email

$customer_email = "[email protected]"; 
$customer = Mage::getModel("customer/customer"); 
$customer->setWebsiteId(Mage::app()->getWebsite()->getId()); 
$customer->loadByEmail($customer_email); //load customer by email id 

if($customer->getId){
   // do your logic here
}

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.