Created
September 22, 2014 22:49
-
-
Save davefreiman/10685bcf6e1d150a11d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Demac_Casl_Model_Observer | |
| { | |
| public function addCaslDataToSubscriber($observer) | |
| { | |
| $event = $observer->getEvent(); | |
| $subscriber = $event->getSubscriber(); | |
| $subscriberId = $subscriber->getId(); | |
| if ($subscriber && $subscriberId) { | |
| $model = Mage::getModel('demac_casl/subscriber'); | |
| $existingCheck = $model->getResource()->loadBySubscriberId($subscriberId); | |
| if (!$existingCheck->getId()){ | |
| $model->addCaslData(); | |
| $model->setSubscriberId($subscriber->getId()); | |
| $model->save(); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment