Hi I am using default newsletters subscription package in magento. I need to show an error if the user is already registered with Us I've seen an option like this
$emailExist = Mage::getModel('newsletter/subscriber')->load($email, 'subscriber_email');
if ($emailExist->getId()) {
Mage::throwException($this->__('This email address is already exist.'));
}
from here Show error message in guest subscriber if user already subscribe with that Id
But this is not working for me, still i am getting same thanks for subscription message. thanks
Check this............
$NewSellt= Mage::getModel('newsletter/subscriber')->subscribe($email);
if($NewSellt->getId()>0){
//if exits
}
If customer is registered user
$ownerId = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($email)
->getId();
if ($ownerId !== null && $ownerId != $customerSession->getId()) {
//'This email address is already assigned to another user.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With