问题
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.
回答1:
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.'));
}
来源:https://stackoverflow.com/questions/17289289/show-error-message-in-guest-subscriber-if-user-already-subscribe-with-that-id