如果用户已经使用该ID订阅,则在来宾订阅者中显示错误消息 [英] Show error message in guest subscriber if user already subscribe with that Id
问题描述
我正在使用magento默认新闻订阅者.我发现仅当订户在magento商店中有一个帐户时,才会显示错误There was a problem with the subscription: This email address is already assigned to another user.
.如果订户是访客客户,则不会显示错误,将显示成功消息,表明已订阅新闻通讯.我如何也可以在访客订户中显示消息.
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.
推荐答案
您应编辑以下文件:
/app/code/core/Mage/Newsletter/controllers/SubscriberController.php
此代码行上方的#63行:
in line #63 above this line of code :
$status = Mage::getModel('newsletter/subscriber')->subscribe($email);
添加以下代码:
$emailExist = Mage::getModel('newsletter/subscriber')->load($email, 'subscriber_email');
if ($emailExist->getId()) {
Mage::throwException($this->__('This email address is already exist.'));
}
这篇关于如果用户已经使用该ID订阅,则在来宾订阅者中显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!