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

冷暖自知 提交于 2019-12-11 05:46:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!