Ankita Agrawal
Ankita Agrawal

Reputation: 504

Show error message in guest subscriber if user already subscribe with that Id

I am using magento default newsletter subscriber. I found that the error There was a problem with the subscription: This email address is already assigned to another user. will be shown only if the subscriber has an account in magento store. If the subscriber is a guest customer then the error will not be shown, A success msg will be shown stating Newsletter Has been subscribed. How can I show message in guest subscriber also.

Upvotes: 1

Views: 3037

Answers (1)

cosmoshy
cosmoshy

Reputation: 26

You should edit the following file :

/app/code/core/Mage/Newsletter/controllers/SubscriberController.php

in line #63 above this line of code :

$status = Mage::getModel('newsletter/subscriber')->subscribe($email);

add the following codes :

$emailExist = Mage::getModel('newsletter/subscriber')->load($email, 'subscriber_email');
if ($emailExist->getId()) {
Mage::throwException($this->__('This email address is already exist.'));
}

Upvotes: 1

Related Questions