1

I am using custom theme for my site, I bit stuck with newsletter subscription.

whenever I subscribe for news letter with same email id which is already subscribed, It should show the error, But I am not able to see any error message or success message in front end.

my subscribe.phtml code is

<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail" class="newsletter">
    <div class="form-group has-feedback">
         <input type="text" name="email" id="newsletter" title="<?php echo $this->__('I want to receive the specials') ?>" class="input-text required-entry validate-email form-control "/>
        <button type="submit" class="newsletter_button form-control-feedback button"><?php echo $this->__('OK') ?></button>
    </div>
</form>
<script type="text/javascript">
//<![CDATA[
    var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
//]]>
</script>

and I also use this code to display the error, in subscribetionController

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

I am not what is mistake here, But I am thinking I am not able to print the error message at front end,

Any suggestions, ? Help Me:) Thanks in advance..

1 Answer 1

1

The theme you are using is the issue, not the subscriber code itself. There is a message block in Magento to show all the notifications in the frontend and probably the theme does not have it.

Where are you being redirected after subscribing? You should check that page in particular has the message block.

Here is a guide to fully understand how this block works, you might fint it useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.