If you want to add programmatically subscriber newsletter user in magento . than do not worry magento blog or magento tutorials will tell you how to add custom subscriber newsletter user in magento.
Note:- Please take a Data Base Backup before usingthis script.
Step1:- Create a file subscriber.php in root folder.
Step2:- Add below code on subscriber.php file
<?php
require_once("app/Mage.php");
Mage::app();
$subscribers = array('put_your_subscriber_email_1', 'put_your_subscriber_email_2');
foreach ($subscribers as $email) {
Mage::getModel('newsletter/subscriber')->setImportMode(true)->subscribe($email);
// Here we will create subscribe without send confirmation mail to user
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
// Here we reterive genetared subscribe.
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
$subscriber->save(); // Here we saved genetared subscribe.
}
?>
Step3:- clear cache and run this file on your browser
http://yoursite.com/subscribe.php
Note:- Please take a Data Base Backup before usingthis script.
Step1:- Create a file subscriber.php in root folder.
Step2:- Add below code on subscriber.php file
<?php
require_once("app/Mage.php");
Mage::app();
$subscribers = array('put_your_subscriber_email_1', 'put_your_subscriber_email_2');
foreach ($subscribers as $email) {
Mage::getModel('newsletter/subscriber')->setImportMode(true)->subscribe($email);
// Here we will create subscribe without send confirmation mail to user
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
// Here we reterive genetared subscribe.
$subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
$subscriber->save(); // Here we saved genetared subscribe.
}
?>
Step3:- clear cache and run this file on your browser
http://yoursite.com/subscribe.php
No comments:
Post a Comment