Skip to content
This repository has been archived by the owner on Jun 1, 2018. It is now read-only.

Commit

Permalink
Webhook fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiagoebizmarts committed Aug 10, 2016
1 parent 53680af commit a1a0b27
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions app/code/community/Ebizmarts/MageMonkey/Model/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ protected function _subscribe(array $data)
if(isset($data['data']['merges']['STOREID'])){
$subscriberStoreId=$data['data']['merges']['STOREID'];
}else {
$subscriberStoreId = Mage::helper('monkey')->getStoreByList();
$subscriberStoreId = Mage::helper('monkey')->getStoreByList($data['data']['id']);
}
Mage::app()->setCurrentStore($subscriberStoreId);
$subscriber->subscribe($data['data']['email']);
Expand Down Expand Up @@ -755,11 +755,22 @@ protected function _profile(array $data)
->addFieldToFilter('email', array('eq' => $email));
if (count($customerCollection) > 0) {
$toUpdate = $customerCollection->getFirstItem();
if(isset($data['data']['merges']['FNAME'])) {
$toUpdate->setFirstname($data['data']['merges']['FNAME']);
}
if(isset($data['data']['merges']['LNAME'])) {
$toUpdate->setLastname($data['data']['merges']['LNAME']);
}
}else {
$toUpdate = $subscriber;
if(isset($data['data']['merges']['FNAME'])) {
$toUpdate->setSubscriberFirstname($data['data']['merges']['FNAME']);
}
if(isset($data['data']['merges']['LNAME'])) {
$toUpdate->setSubscriberLastname($data['data']['merges']['LNAME']);
}
}
$toUpdate->setFirstname($data['data']['merges']['FNAME']);
$toUpdate->setLastname($data['data']['merges']['LNAME']);

$toUpdate->save();
}

Expand All @@ -779,7 +790,7 @@ protected function _updateEmail(array $data)
$newSubscriber = Mage::getSingleton('newsletter/subscriber')->loadByEmail($new);


$subscriberStoreId = Mage::helper('monkey')->getStoreByList();
$subscriberStoreId = Mage::helper('monkey')->getStoreByList($data['data']['list_id']);

Mage::app()->setCurrentStore($subscriberStoreId);

Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ebizmarts/MageMonkey/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
<order_status>all_status</order_status>
</ecommerce360>
<notifications>
<updates_url><![CDATA[http://store.ebizmarts.com/media/feeds/]]></updates_url>
<updates_url><![CDATA[https://store.ebizmarts.com/media/feeds/]]></updates_url>
<check_frequency>86400</check_frequency>
</notifications>
</monkey>
Expand Down

0 comments on commit a1a0b27

Please sign in to comment.