-
Notifications
You must be signed in to change notification settings - Fork 0
/
Subscriber.php
26 lines (23 loc) · 892 Bytes
/
Subscriber.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
class Lexiconn_Mailinglist_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
{
public function _construct()
{
parent::_construct();
}
public function loadByCustomer(Mage_Customer_Model_Customer $customer)
{
$data = $this->getResource()->loadByCustomer($customer);
$this->addData($data);
if (!empty($data) && $customer->getId() && !$this->getCustomerId()) {
$this->setCustomerId($customer->getId());
Mage::fireLog($customer->getId());
$this->setSubscriberConfirmCode($this->randomSequence());
if ($this->getStatus()==self::STATUS_NOT_ACTIVE) {
$this->setStatus($customer->getIsSubscribed() ? self::STATUS_SUBSCRIBED : self::STATUS_UNSUBSCRIBED);
}
$this->save();
}
return $this;
}
}