21

Alternatively you can try this, if you have the customer's email address: $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email); if ($subscriber->getId()) { // put your logic here... } Or if you have customer ID then you can directly check in newsletter_subscriber table to check if customer ID exists or not.


19

First inject the \Magento\Newsletter\Model\Subscriber class in your constructor: protected $_subscriber; public function __construct( ... \Magento\Newsletter\Model\Subscriber $subscriber ... ){ ... $this->_subscriber= $subscriber; ... } Then you have two possible cases Assuming your have the customer email Then in your code ...


17

It is very simple to create modal popup in Magento 2. Like if you want to display any static block in popup, you can do it simply by calling the content and displaying it. We should start by creating new module in Magento 2. app/code/Example/ModalOverlay/registration.php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\...


15

hi you can add this by add below code at billing.phtml <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" checked="checked" class="checkbox" /> using the event checkout_submit_all_after subscribe the customer to newsletter <global> <events> <...


14

You can use newsletter subscription confirmation feature in Magento. Enable this from: admin-login >> System >> Configuration >> Customer >> Newsletter >> select Yes from Need to confirm drop-down option. I hope this will help you.


12

I'm not 100% sure what you mean by 'get', I thought you meant add it but as it's already there in the blank and Luma theme and the previous answer is pretty much correct I presume you want to move it so I'll base my answer on that. Quick answer: <move element="form.subscribe" destination="*DESTINATION-HERE*" /> The explanation: Find the block name ...


10

You almost had it. Here's the code you need to use: {{block class="Magento\Newsletter\Block\Subscribe" name="static.newsletter" template="Magento_Newsletter::subscribe.phtml"}}


9

The below worked fine for me. There is plenty of room for improvement. The form needs styling help and this adds additional first/last name fields to the admin grid rather than merging them with the existing customer name columns. Add this to your CMS page to include the form with the additional fields {{block class="Magento\Newsletter\Block\Subscribe" ...


9

To do that you can inject Magento\Newsletter\Model\SubscriberFactory in your constructor: protected $subscriberFactory; public function __construct( // \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, ) { $this->subscriberFactory= $subscriberFactory; // } Then in your code you can call: $this->subscriberFactory->...


8

You can print the messages in a template like this: <?php echo $this->getMessagesBlock()->getGroupedHtml() ?> But there is a catch. For example the newsletter subscription message is added to Mage::getSingleton('core/session'). So in order to see te core/session messages you need to add this in the controller that renders the template: $...


8

Since the newest Security Patch / Release you need to add a permission for the block type under "System -> Permissions -> Blocks"


8

I have created module for your requirement and firstname & lastname Create registeration file. app\code\Hm\Newsletters - registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Hm_Newsletters', __DIR__ ); app\code\Hm\Newsletters\etc - module.xml &...


7

As you put the code into the template of the Mage_Page_Block_Html_Header block the getFormActionUrl method originally referenced to Mage_Newsletter_Block_Subscribe is not returning a right value anymore. So replace <?php echo $this->getFormActionUrl() ?> with <?php echo $this->getUrl('newsletter/subscriber/new', array('_secure' => true))...


7

As Sander Mangel pointed out the solution is in app/code/core/Mage/Newsletter/Model/Subscriber.php. Copy this file to app/code/local/Mage/Newsletter/Model/Subscriber.php Find function confirm($code) (Line 470 in CE-1.7.0.2) and add $this->sendConfirmationSuccessEmail(); Now the function should look like this: public function confirm($code) { if($...


7

Search the file /app/code/core/Mage/Newsletter/Model/Subscriber.php copy the whole content to MyVendor/Tweaks/Newsletter/Model/Subscriber.php Then find the below public function confirm($code) { if($this->getCode()==$code) { $this->setStatus(self::STATUS_SUBSCRIBED) ->setIsStatusChanged(true) ...


6

You have to check also the subscription status: if(Mage::getSingleton('customer/session')->isLoggedIn()){ $email = Mage::getSingleton('customer/session')->getCustomer()->getData('email'); $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email); if($subscriber->getId()) { $...


6

You have to join EAV collection with regular table. It is achievable with joinTable method of Mage_Eav_Model_Entity_Collection_Abstract class. The forth parameter defines the WHERE condition because apparently you can't use addAttributeToFilter method here. $collection = Mage::getModel('customer/customer')->getCollection(); $collection->...


6

In app/design/frontend/theme/theme/layout/newsletter.xml change from: <reference name="footer"> <block type="newsletter/subscribe" name="footer.newsletter" as="newsletter" before="footer_store_language" template="newsletter/subscribe.phtml"/> </reference> To: <reference name="left"> <block type="newsletter/subscribe" ...


6

We can do this in Magento2 using Plugins (Interceptors) In di.xml of a custom plugin <type name="Magento\Newsletter\Model\Subscriber"> <plugin name="my-subscriber" type="MyNamespace\MyModule\Newsletter\Model\Subscriber" sortOrder="1" disabled="1" /> </type> Then your Interceptor class which wraps the underlying Subscriber instance ...


6

This code is to add newsletter in the footer, the code is based on venia concept package. change as per your need. Here you have to create REST Api module for newsletter in Magento, there is free module available you can use that https://github.com/regento/magento2-newsletter-api Import Newsletter in Footer: src/components/Footer/footer.js import ...


5

You should check System > Configuration > ADVANCED > Advanced > Modules output > Mage Newsletter and verify that the output is enabled.


5

I ran into this same issue, and there is a simple fix. Rather than overwriting controllers, you can pass a hidden field in the form that defines the redirect URL. <input type="hidden" name="referer_url" value="{my URL}"> newAction() in Mage_Newsletter_SubscriberController by default returns to the same page you're on, but _getRefererUrl() in ...


5

This is not available out the box, and no rule would make this happen. You would need to do some custom code to make this work, as well as utilize mailchimps callback hooks to allow you to issue coupons on a successful subscription confirmation. So lets start: The first step is to go create a Shopping Cart Price Rule, and in the configuration, you set it ...


5

For add custom link in footer inside newsletter block.You Need to override these file in your custom theme vendor/magento/module-newsletter/view/frontend/templates/subscribe.phtml. like this one app/design/frontend/{PackageName}/{ThemeName}/Magento_Newsletter/templates/subscribe.phtml <?php /** * Copyright © Magento, Inc. All rights reserved. * ...


4

Your question is a little short on context, but in a standard Magento installation, the newsletter phtml template is located at app/design/base/default/template/newsletter/subscribe.phtml which means it will be located at app/design/[PACKAGE-NAME]/[THEME-NAME]/template/newsletter/subscribe.phtml if your theme conforms to the Magento standard. For ...


4

I know two options you have: Add a fake field, with a cool name, like name or url, make it invisible with JS or CSS (something the bot can't interpret), then the bot fill this field but a human does not and then check whether the field is filed, if it is, it is a bot. For your luck, we already did something like this, but I just saw, newsletter ...


4

In my opinion none of the above answers are very convenient in that they either don't check if the customer is actually subscribed or don't handle the case where a subscription has not been found, so here goes: $customerIsSubscribed = false; $customer = Mage::getSingleton('customer/session')->getCustomer(); if ($customer) { $customerEmail = $customer-...


4

Go to app/etc and find Mage_Newsletter.xml file. If it is not there open Mage_All.xml and find <Mage_Newsletter> <active>true</active> <codePool>core</codePool> <depends> <Mage_Core/> <Mage_Customer/> <Mage_Eav/> <Mage_Widget/> </depends> </...


4

Just add below single line & it works <?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml(); ?>


4

I had same issue,I guess its the bug from Magento 1.8~1.9.1. Try this. Open the file cron.php in the root directory of Magento and look for (around line 47): $isShellDisabled = (stripos(PHP_OS, ‘win’) === false) ? $isShellDisabled : true; After this line, add: $isShellDisabled = true; Save the file. After a couple minutes the cron should start working. ...


Only top voted, non community-wiki answers of a minimum length are eligible