32 lines
766 B
PHP
Executable File
32 lines
766 B
PHP
Executable File
<?php
|
|
|
|
namespace IpSupply\Prology\Helper;
|
|
|
|
class NewsletterHelper
|
|
{
|
|
|
|
protected $objectManager;
|
|
protected $storeManage;
|
|
protected $customer;
|
|
protected $subscriptionManager;
|
|
|
|
public function __construct(
|
|
|
|
) {
|
|
|
|
$this->objectManager = \Magento\Framework\App\ObjectManager::getInstance();
|
|
}
|
|
|
|
public function getCustomerByEmail($email)
|
|
{
|
|
$websiteID = $this->storeManage->getStore()->getWebsiteId();
|
|
$customer = $this->customer->create()->setWebsiteId($websiteID)->loadByEmail($email);
|
|
return $customer;
|
|
}
|
|
|
|
public function register($email) {
|
|
$subscriber= $this->objectManager->create('Magento\Newsletter\Model\SubscriberFactory');
|
|
$subscriber->create()->subscribe($email);
|
|
}
|
|
}
|