diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails/Grid.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedmails/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder/Grid.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Abandonedorder/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Sales.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Sales.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Totals.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/Dashboard/Totals.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Date.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Date.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Adminhtml/System/Config/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Block/Popup/Emailcatcher.php b/app/code/community/Ebizmarts/AbandonedCart/Block/Popup/Emailcatcher.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php b/app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Abtesting.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Abtesting.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php old mode 100755 new mode 100644 index f203e697..2256e108 --- a/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php @@ -33,7 +33,6 @@ class Ebizmarts_AbandonedCart_Model_Config const FOURTH_SUBJECT = "ebizmarts_abandonedcart/general/subject4"; const FIFTH_SUBJECT = "ebizmarts_abandonedcart/general/subject5"; const LOG = "ebizmarts_abandonedcart/general/log"; - const AUTOLOGIN = "ebizmarts_abandonedcart/general/autologin"; const ABANDONED_TAGS = 'global/ebizmarts_abandonedcart/mandrill-tag'; const IN_DAYS = 0; const IN_HOURS = 1; diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php old mode 100755 new mode 100644 index fb18fa96..a6b898c5 --- a/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php @@ -162,7 +162,7 @@ protected function _processRun($adapter, $run, $storeId) } // for each cart of the current run foreach ($collection as $quote) { - $this->_proccessCollection($quote, $storeId); + $quote = $this->_proccessCollection($quote, $storeId); if (count($quote->getAllVisibleItems()) < 1) { $quote2 = Mage::getModel('sales/quote')->loadByIdWithoutStore($quote->getId()); @@ -335,7 +335,7 @@ protected function _proccessCollection($quote, $storeId) is_object($stock) && ($stock->getManageStock() || ($stock->getUseConfigManageStock() && Mage::getStoreConfig('cataloginventory/item_options/manage_stock', $quote->getStoreId()))) ) - && $stockQty < $item->getQty() && (!$inventory->getBackorders() || $stockItem->getBackorders()) + && $stockQty < $item->getQty() && (!$inventory->getBackorders() || !$stockItem->getBackorders()) ) { Mage::log('AbandonedCart; ' . $product->getSku() . ' is no longer in stock; remove from quote ' . $quote->getId() . ' for email', null, 'Ebizmarts_AbandonedCart.log'); $removeFromQuote = true; @@ -344,6 +344,7 @@ protected function _proccessCollection($quote, $storeId) $quote->removeItem($item->getId()); } } + return $quote; } protected function _sendPopupCoupon($storeId) { diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php b/app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Mailssent.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Mailssent.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Popup.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Popup.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting/Collection.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Abtesting/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent/Collection.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Mailssent/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Order/Collection.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Order/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup/Collection.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Resource/Popup/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Automatic.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Automatic.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Cmspage.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Cmspage.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Customergroup.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Customergroup.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Discounttype.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Discounttype.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Maxemails.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Maxemails.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Unit.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Unit.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Yesnovariation.php b/app/code/community/Ebizmarts/AbandonedCart/Model/System/Config/Yesnovariation.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php b/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php old mode 100755 new mode 100644 index d74796d1..63c46905 --- a/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php +++ b/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php @@ -48,10 +48,6 @@ public function loadquoteAction() $quote->setCouponCode($params['coupon']); $quote->save(); } - if ((!isset($params['token']) || (isset($params['token']) && $params['token'] != $quote->getEbizmartsAbandonedcartToken())) && Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AUTOLOGIN, $quote->getStoreId())) { - Mage::getSingleton('customer/session')->addNotice("Your token cart is incorrect"); - $this->_redirect($url); - } else { $url = Mage::getUrl(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId())); $first = true; foreach($analytics as $key => $value) { @@ -71,14 +67,6 @@ public function loadquoteAction() $this->getResponse() ->setRedirect($url, 301); } else { - if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AUTOLOGIN, $quote->getStoreId())) { - $customer = Mage::getModel('customer/customer')->load($quote->getCustomerId()); - if ($customer->getId()) { - Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer); - } - $this->getResponse() - ->setRedirect($url, 301); - } else { if (Mage::helper('customer')->isLoggedIn()) { $this->getResponse() ->setRedirect($url, 301); @@ -86,9 +74,7 @@ public function loadquoteAction() Mage::getSingleton('customer/session')->addNotice("Login to complete your order"); $this->_redirect('customer/account'); } - } } - } } // $this->_redirect('checkout/cart'); } diff --git a/app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedmailsController.php b/app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedmailsController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedorderController.php b/app/code/community/Ebizmarts/AbandonedCart/controllers/Adminhtml/AbandonedorderController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/etc/adminhtml.xml b/app/code/community/Ebizmarts/AbandonedCart/etc/adminhtml.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml b/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml old mode 100755 new mode 100644 index ab7f768f..0915d9a8 --- a/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml +++ b/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml @@ -10,7 +10,7 @@ - 1.2.2.1 + 1.2.3 diff --git a/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml b/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml old mode 100755 new mode 100644 index a7e1c024..f3655955 --- a/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml +++ b/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml @@ -356,19 +356,6 @@ 1 - - - select - adminhtml/system_config_source_yesno - 65 - 1 - 1 - 1 - - - 1 - - diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-install-0.1.0.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-install-0.1.0.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.12-0.1.13.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.12-0.1.13.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.18-0.1.19.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.18-0.1.19.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.2-0.1.3.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.2-0.1.3.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.20-0.1.21.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.20-0.1.21.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.29-0.1.30.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.29-0.1.30.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.30-0.1.31.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.30-0.1.31.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.6-0.1.7.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-0.1.6-0.1.7.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-1.1.35-1.2.0.php b/app/code/community/Ebizmarts/AbandonedCart/sql/ebizmarts_abandonedcart_setup/mysql4-upgrade-1.1.35-1.2.0.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Backtostock/Fieldset/Hint.php b/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Backtostock/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Birthday/Fieldset/Hint.php b/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Birthday/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Review/Fieldset/Hint.php b/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Review/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Wishlist/Fieldset/Hint.php b/app/code/community/Ebizmarts/Autoresponder/Block/Adminhtml/System/Config/Wishlist/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Backtostock/Notice.php b/app/code/community/Ebizmarts/Autoresponder/Block/Backtostock/Notice.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Customer/Account/List.php b/app/code/community/Ebizmarts/Autoresponder/Block/Customer/Account/List.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Email/Backtostock/Item.php b/app/code/community/Ebizmarts/Autoresponder/Block/Email/Backtostock/Item.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Email/Related/Items.php b/app/code/community/Ebizmarts/Autoresponder/Block/Email/Related/Items.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Email/Review/Items.php b/app/code/community/Ebizmarts/Autoresponder/Block/Email/Review/Items.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Email/Wishlist/Items.php b/app/code/community/Ebizmarts/Autoresponder/Block/Email/Wishlist/Items.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Review/Form.php b/app/code/community/Ebizmarts/Autoresponder/Block/Review/Form.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Block/Unsubscribe.php b/app/code/community/Ebizmarts/Autoresponder/Block/Unsubscribe.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Helper/Data.php b/app/code/community/Ebizmarts/Autoresponder/Helper/Data.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Backtostock.php b/app/code/community/Ebizmarts/Autoresponder/Model/Backtostock.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Backtostockalert.php b/app/code/community/Ebizmarts/Autoresponder/Model/Backtostockalert.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Config.php b/app/code/community/Ebizmarts/Autoresponder/Model/Config.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php b/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php old mode 100755 new mode 100644 index a98b97ad..282911e4 --- a/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php +++ b/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php @@ -615,7 +615,14 @@ protected function _sendVisitedProductEmail($email,$storeId,$products,$name,$tag $senderId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::GENERAL_SENDER, $storeId); $sender = array('name' => Mage::getStoreConfig("trans_email/ident_$senderId/name", $storeId), 'email' => Mage::getStoreConfig("trans_email/ident_$senderId/email", $storeId)); $templateId = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::VISITED_TEMPLATE, $storeId); - $url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=visitedproducts&email=' . $email . '&store=' . $storeId; + $store=Mage::getModel('core/store')->load($storeId); + $storeCode=$store->getCode(); + $storeCodeUrl = Mage::getStoreConfig('web/url/use_store', $storeId); + if($storeCodeUrl){ + $url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . $storeCode . '/ebizautoresponder/autoresponder/unsubscribe?list=visitedproducts&email=' . $email . '&store=' . $storeId; + }else { + $url = Mage::getModel('core/url')->setStore($storeId)->getUrl() . 'ebizautoresponder/autoresponder/unsubscribe?list=visitedproducts&email=' . $email . '&store=' . $storeId; + } $vars = array('name' => $name, 'tags' => array($tags), 'products' => $products, 'url' => $url); $customer = Mage::getModel('customer/customer') diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/EventObserver.php b/app/code/community/Ebizmarts/Autoresponder/Model/EventObserver.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock/Collection.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostock/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert/Collection.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Backtostockalert/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review/Collection.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Review/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe/Collection.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Unsubscribe/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited/Collection.php b/app/code/community/Ebizmarts/Autoresponder/Model/Resource/Visited/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Review.php b/app/code/community/Ebizmarts/Autoresponder/Model/Review.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Automatic.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Automatic.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Couponcounter.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Couponcounter.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Customergroup.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Customergroup.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Discounttype.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Discounttype.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Generaltype.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Generaltype.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Hours.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Hours.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Newordertrigger.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Newordertrigger.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Registeredcustomergroup.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Registeredcustomergroup.php new file mode 100644 index 00000000..4da6fc4e --- /dev/null +++ b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Registeredcustomergroup.php @@ -0,0 +1,23 @@ + + * @license http://opensource.org/licenses/osl-3.0.php + */ +class Ebizmarts_Autoresponder_Model_System_Config_Registeredcustomergroup +{ + protected $_options; + + public function toOptionArray() + { + if (!$this->_options) { + $this->_options = Mage::getResourceModel('customer/group_collection') + ->loadData()->toOptionArray(); + } + unset($this->_options[0]); + return $this->_options; + } +} diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Time.php b/app/code/community/Ebizmarts/Autoresponder/Model/System/Config/Time.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Unsubscribe.php b/app/code/community/Ebizmarts/Autoresponder/Model/Unsubscribe.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Visited.php b/app/code/community/Ebizmarts/Autoresponder/Model/Visited.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/controllers/AutoresponderController.php b/app/code/community/Ebizmarts/Autoresponder/controllers/AutoresponderController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/controllers/BacktostockController.php b/app/code/community/Ebizmarts/Autoresponder/controllers/BacktostockController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/etc/adminhtml.xml b/app/code/community/Ebizmarts/Autoresponder/etc/adminhtml.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/etc/config.xml b/app/code/community/Ebizmarts/Autoresponder/etc/config.xml old mode 100755 new mode 100644 index f26d7c10..48a92980 --- a/app/code/community/Ebizmarts/Autoresponder/etc/config.xml +++ b/app/code/community/Ebizmarts/Autoresponder/etc/config.xml @@ -10,7 +10,7 @@ - 1.2.1.1 + 1.2.2 diff --git a/app/code/community/Ebizmarts/Autoresponder/etc/system.xml b/app/code/community/Ebizmarts/Autoresponder/etc/system.xml old mode 100755 new mode 100644 index 9eff1f93..b2484229 --- a/app/code/community/Ebizmarts/Autoresponder/etc/system.xml +++ b/app/code/community/Ebizmarts/Autoresponder/etc/system.xml @@ -552,7 +552,7 @@ multiselect - ebizmarts_autoresponder/system_config_customergroup + ebizmarts_autoresponder/system_config_registeredcustomergroup 110 1 1 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-install-0.1.0.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-install-0.1.0.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.3-0.1.4.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.3-0.1.4.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.4-0.1.5.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.4-0.1.5.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.5-0.1.6.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.5-0.1.6.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.9-0.1.10.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-0.1.9-0.1.10.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-1.1.14-1.2.0.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-1.1.14-1.2.0.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-1.2.0-1.2.1.php b/app/code/community/Ebizmarts/Autoresponder/sql/ebizmarts_autoresponder_setup/mysql4-upgrade-1.2.0-1.2.1.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export/Form.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Export/Form.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import/Form.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Import/Form.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue/Grid.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/Queue/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport/Grid.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueExport/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport/Grid.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Bulksync/QueueImport/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Customer/Edit/Tab/Memberactivity.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce/Grid.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerce/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Grid.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Renderer/Items.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Ecommerceapi/Renderer/Items.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Memberactivity/Grid.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Memberactivity/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Newsletter/Subscriber/Renderer/Firstname.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Newsletter/Subscriber/Renderer/Firstname.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Newsletter/Subscriber/Renderer/Lastname.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Newsletter/Subscriber/Renderer/Lastname.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Date.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Date.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Importypes.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Importypes.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Lists.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Lists.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Progress.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Progress.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Yesno.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/Renderer/Yesno.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Account.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Account.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Date.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Date.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/OauthWizard.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/OauthWizard.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetLocalEcommerce.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetLocalEcommerce.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetRemoteEcommerce.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/ResetRemoteEcommerce.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/UpgradeForPatch.php b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/UpgradeForPatch.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Checkout/Subscribe.php b/app/code/community/Ebizmarts/MageMonkey/Block/Checkout/Subscribe.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Customer/Account/Lists.php b/app/code/community/Ebizmarts/MageMonkey/Block/Customer/Account/Lists.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Lists.php b/app/code/community/Ebizmarts/MageMonkey/Block/Lists.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Block/Signup.php b/app/code/community/Ebizmarts/MageMonkey/Block/Signup.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Helper/Cache.php b/app/code/community/Ebizmarts/MageMonkey/Helper/Cache.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php b/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php old mode 100755 new mode 100644 index a3838506..91802949 --- a/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php +++ b/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php @@ -437,7 +437,7 @@ public function getMergeVars($customer, $includeEmail = FALSE, $websiteId = NULL if($customer->getSubscriberFirstname()){ $guestFirstName = $this->config('guest_name', $customer->getStoreId()); }elseif($this->config('guest_name', $customer->getStoreId())) { - $guestFirstName = $customer->getSubscriberFirstname(); + $guestFirstName = $this->config('guest_name', $customer->getStoreId()); } if ($guestFirstName) { @@ -449,7 +449,7 @@ public function getMergeVars($customer, $includeEmail = FALSE, $websiteId = NULL if($customer->getSubscriberLastname()){ $guestLastName = $this->config('guest_lastname', $customer->getStoreId()); }elseif($this->config('guest_lastname', $customer->getStoreId())){ - $guestLastName = $customer->getSubscriberLastname(); + $guestLastName = $this->config('guest_lastname', $customer->getStoreId()); } if ($guestLastName) { @@ -498,6 +498,49 @@ public function getMergeVars($customer, $includeEmail = FALSE, $websiteId = NULL //magemonkey_mergevars_after return $merge_vars; } + + public function getMergeVarsFromOrder($maps, $order, $merge_vars){ + + foreach ($maps as $map) { + + $customAtt = $map['magento']; + $chimpTag = $map['mailchimp']; + + if ($chimpTag && $customAtt) { + + $key = strtoupper($chimpTag); + + switch ($customAtt) { + + case 'billing_address': + case 'shipping_address': + $merge_vars = array_merge($merge_vars, $this->_setAddress($customAtt,$merge_vars, $order, $key)); + break; + case 'date_of_purchase': + + $merge_vars[$key] = $order->getUpdatedAt(); + + break; + + case 'store_code': + $storeId = (string)$order->getData('store_id'); + $storeCode = Mage::getModel('core/store')->load($storeId)->getCode(); + if ($storeCode) { + $merge_vars[$key] = $storeCode; + } + break; + case 'fname': + $merge_vars[$key] = $order->getCustomerFirstname(); + break; + case 'lname': + $merge_vars[$key] = $order->getCustomerLastname(); + break; + } + + } + } + return $merge_vars; + } private function _setMaps($maps,$customer,$merge_vars, $websiteId) { foreach ($maps as $map) { @@ -593,14 +636,19 @@ private function _setMaps($maps,$customer,$merge_vars, $websiteId) } return $merge_vars; } - protected function _setAddress($customAtt,$merge_vars, $customer, $key) + protected function _setAddress($customAtt,$merge_vars, $object, $key) { - - $addr = explode('_', $customAtt); - $address = $customer->{'getPrimary' . ucfirst($addr[0]) . 'Address'}(); - if (!$address) { - if ($customer->{'getDefault' . ucfirst($addr[0])}()) { - $address = Mage::getModel('customer/address')->load($customer->{'getDefault' . ucfirst($addr[0])}()); + if($object instanceof Mage_Sales_Model_Order){ + $addr = explode('_', $customAtt); + $address = $object->{'get' . ucfirst($addr[0]) . 'Address'}(); + }else { + + $addr = explode('_', $customAtt); + $address = $object->{'getPrimary' . ucfirst($addr[0]) . 'Address'}(); + if (!$address) { + if ($object->{'getDefault' . ucfirst($addr[0])}()) { + $address = Mage::getModel('customer/address')->load($object->{'getDefault' . ucfirst($addr[0])}()); + } } } if ($address) { @@ -917,26 +965,27 @@ protected function _McAddressToMage(array $data, $type, $customer) * * @param $object * @param $db + * @param $orderId */ - public function listsSubscription($object, $db) + public function listsSubscription($object, $db, $orderId = null) { $monkeyPost = Mage::getSingleton('core/session')->getMonkeyPost(); $post = unserialize($monkeyPost); if (isset($post['magemonkey_force'])) { foreach ($post['list'] as $list) { $listId = $list['subscribed']; - $this->subscribeToList($object, $db, $listId); + $this->subscribeToList($object, $db, $listId, false, $orderId); } } elseif (isset($post['magemonkey_subscribe']) && $post['magemonkey_subscribe']) { $lists = explode(',', $post['magemonkey_subscribe']); foreach ($lists as $listId) { - $this->subscribeToList($object, $db, $listId); + $this->subscribeToList($object, $db, $listId, false, $orderId); } //Subscription for One Step Checkout with force subscription } elseif (Mage::getSingleton('core/session')->getIsOneStepCheckout() && Mage::helper('monkey')->config('checkout_subscribe') > 2 && !Mage::getSingleton('core/session')->getIsUpdateCustomer()) { - $this->subscribeToList($object, $db); + $this->subscribeToList($object, $db, null, false, $orderId); } elseif(!Mage::getSingleton('core/session')->getMonkeyCheckout()){ - $this->subscribeToList($object, $db, NULL, TRUE); + $this->subscribeToList($object, $db, NULL, TRUE, $orderId); } } @@ -947,8 +996,10 @@ public function listsSubscription($object, $db) * @param $object * @param $db * @param null $listId + * @param $forceSubscribe + * @param $orderId */ - public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = FALSE) + public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = FALSE, $orderId = null) { $email = $object->getEmail(); $storeId = $object->getStoreId(); @@ -964,8 +1015,16 @@ public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = $listId = $defaultList; } $alreadySubscribed = Mage::getSingleton('newsletter/subscriber')->loadByEmail($email); + $mergeVars = Mage::helper('monkey')->mergeVars($object, FALSE, $listId); + $isConfirmNeed = FALSE; + if (!Mage::helper('monkey')->isAdmin() && + (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $object->getStoreId()) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $object->getStoreId()) || $forceSubscribe && Mage::getSingleton('core/session')->getMonkeyCheckout()) + ) { + $isConfirmNeed = TRUE; + } if ($listId == $defaultList && !Mage::getSingleton('core/session')->getIsHandleSubscriber() && !$forceSubscribe && (!$alreadySubscribed || !$alreadySubscribed->getId())) { $subscriber->setStoreId($storeId)->subscribe($email); + $this->_subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db, $orderId); } else { $alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection() ->addFieldToFilter('lists', $listId) @@ -973,19 +1032,12 @@ public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = ->addFieldToFilter('processed', 0); //if not in magemonkey_async_subscribers with processed 0 add list if (count($alreadyOnList) == 0) { - $isConfirmNeed = FALSE; - if (!Mage::helper('monkey')->isAdmin() && - (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $object->getStoreId()) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $object->getStoreId()) || $forceSubscribe && Mage::getSingleton('core/session')->getMonkeyCheckout()) - ) { - $isConfirmNeed = TRUE; - } $isOnMailChimp = Mage::helper('monkey')->subscribedToList($email, $listId); //if( TRUE === $subscriber->getIsStatusChanged() ){ if ($isOnMailChimp == 1) { if(Mage::getSingleton('core/session')->getIsOneStepCheckout() || Mage::getSingleton('core/session')->getMonkeyCheckout()) { - $mergeVars = Mage::helper('monkey')->mergeVars($object, FALSE, $listId); - $this->_subscribe($listId, $email, $mergeVars, 0, 1); + $this->_subscribe($listId, $email, $mergeVars, 0, 1, $orderId); } return; } @@ -994,9 +1046,9 @@ public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED); } - $mergeVars = Mage::helper('monkey')->mergeVars($object, FALSE, $listId); - $this->_subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db); - if(Mage::getSingleton('core/session')->getMonkeyCheckout()){ + $this->_subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db, $orderId); + $subscriberExists = Mage::getModel('newsletter/subscriber')->loadbyEmail($email); + if(Mage::getSingleton('core/session')->getMonkeyCheckout() && !$subscriberExists->getId()){ $subscriber->subscribe($email); } } @@ -1012,8 +1064,9 @@ public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = * @param $mergeVars * @param $isConfirmNeed * @param $db + * @param $orderId */ - public function _subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db) + public function _subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db, $orderId = null) { if ($db) { if ($isConfirmNeed) { @@ -1026,6 +1079,7 @@ public function _subscribe($listId, $email, $mergeVars, $isConfirmNeed, $db) ->setConfirm($isConfirmNeed) ->setProcessed(0) ->setCreatedAt(Mage::getModel('core/date')->gmtDate()) + ->setOrderId($orderId) ->save(); } else { if ($isConfirmNeed) { diff --git a/app/code/community/Ebizmarts/MageMonkey/Helper/Export.php b/app/code/community/Ebizmarts/MageMonkey/Helper/Export.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Helper/Oauth2.php b/app/code/community/Ebizmarts/MageMonkey/Helper/Oauth2.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Api.php b/app/code/community/Ebizmarts/MageMonkey/Model/Api.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Asyncorders.php b/app/code/community/Ebizmarts/MageMonkey/Model/Asyncorders.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Asyncsubscribers.php b/app/code/community/Ebizmarts/MageMonkey/Model/Asyncsubscribers.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Asyncwebhooks.php b/app/code/community/Ebizmarts/MageMonkey/Model/Asyncwebhooks.php new file mode 100644 index 00000000..f385dd7f --- /dev/null +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Asyncwebhooks.php @@ -0,0 +1,22 @@ + + * Date : 9/15/14 + * Time : 12:46 PM + * File : Asyncwebhooks.php + * Module : Ebizmarts_MageMonkey + */ +class Ebizmarts_MageMonkey_Model_Asyncwebhooks extends Mage_Core_Model_Abstract +{ + /** + * Initialize model + * + * @return void + */ + public function _construct() + { + parent::_construct(); + $this->_init('monkey/asyncwebhooks'); + } +} diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/BulksyncExport.php b/app/code/community/Ebizmarts/MageMonkey/Model/BulksyncExport.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/BulksyncImport.php b/app/code/community/Ebizmarts/MageMonkey/Model/BulksyncImport.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Cache.php b/app/code/community/Ebizmarts/MageMonkey/Model/Cache.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Config.php b/app/code/community/Ebizmarts/MageMonkey/Model/Config.php old mode 100755 new mode 100644 index 94fc39c7..ec4af03f --- a/app/code/community/Ebizmarts/MageMonkey/Model/Config.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Config.php @@ -35,6 +35,8 @@ class Ebizmarts_MageMonkey_Model_Config const GENERAL_ADMINHTML_NOTIFICATION = 'monkey/general/adminhtml_notification'; const GENERAL_ENABLE_LOG = 'monkey/general/enable_log'; + const GENERAL_CHECKOUT_SUBSCRIBE_DATA = 'monkey/general/checkout_subscribe_data'; + const ECOMMERCE360_ACTIVE = 'monkey/ecommerce360/active'; const ECOMMERCE360_ORDER_STATUS = 'monkey/ecommerce360/order_status'; diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php b/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php old mode 100755 new mode 100644 index ce1d2115..56ddbaed --- a/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php @@ -487,6 +487,9 @@ public function sendSubscribersAsync() $oldList = $newList; } $mergeVars = unserialize($item->getMapfields()); + if($item->getOrderId()){ + $mergeVars = $this->_addOrderData($item->getOrderId(), $mergeVars); + } if ($newList != $oldList || $eachIsConfirmNeed != $isConfirmNeed) { if (count($batch) > 0) { Mage::getSingleton('monkey/api')->listBatchSubscribe($oldList, $batch, $isConfirmNeed, TRUE, FALSE); @@ -512,6 +515,13 @@ public function sendSubscribersAsync() } + protected function _addOrderData($orderId, $mergeVars){ + $order = Mage::getModel('sales/order')->load($orderId); + $maps = Mage::helper('monkey')->getMergeMaps($order->getStoreId()); + $mergeVars = Mage::helper('monkey')->getMergeVarsFromOrder($maps, $order, $mergeVars); + return $mergeVars; + } + public function cleanSubscribersAsync() { $collection = Mage::getModel('monkey/asyncsubscribers')->getCollection(); @@ -520,4 +530,297 @@ public function cleanSubscribersAsync() $item->delete(); } } + + + public function processWebhookData() + { + + $collection = Mage::getModel('monkey/asyncwebhooks')->getCollection(); + $collection->addFieldToFilter('processed', array('eq' => 0)); + + foreach ($collection as $item) { + $data=json_decode($item->getWebhookData(), true); + $listId = $data['data']['list_id']; //According to the docs, the events are always related to a list_id +// $store = Mage::helper('monkey')->getStoreByList($listId); + $subscriber = Mage::getModel('newsletter/subscriber') + ->loadByEmail(isset($data['data']['email'])); + $storeId = $subscriber->getStoreId(); + $store = Mage::getModel('core/store')->load($storeId); + if (!is_null($store)) { + $curstore = Mage::app()->getStore(); + Mage::app()->setCurrentStore($store); + } + // Object for cache clean + $object = new stdClass(); + $object->requestParams = array(); + $object->requestParams['id'] = $listId; + + if (isset($data['data']['email'])) { + $object->requestParams['email_address'] = $data['data']['email']; + } + $cacheHelper = Mage::helper('monkey/cache'); + + switch ($item->getWebhookType()) { + case 'subscribe': + $this->_subscribe($data); + $cacheHelper->clearCache('listSubscribe', $object); + break; + case 'unsubscribe': + $this->_unsubscribe($data); + $cacheHelper->clearCache('listUnsubscribe', $object); + break; + case 'cleaned': + $this->_cleaned($data); + $cacheHelper->clearCache('listUnsubscribe', $object); + break; + case 'campaign': + $this->_campaign($data); + break; + //case 'profile': Cuando se actualiza email en MC como merchant, te manda un upmail y un profile (no siempre en el mismo órden) + case 'upemail': + $this->_updateEmail($data); + $cacheHelper->clearCache('listUpdateMember', $object); + break; + case 'profile': + $this->_profile($data); + $cacheHelper->clearCache('listUpdateMember', $object); + break; + } + + if (!is_null($store)) { + Mage::app()->setCurrentStore($curstore); + } + $item->setProcessed(1)->save(); + + } + + + } + + + /** + * Subscribe email to Magento list + * + * @param array $data + * @return void + */ + + protected function _subscribe(array $data) + { + try { + + $subscriber = Mage::getSingleton('newsletter/subscriber') + ->loadByEmail($data['data']['email']); + if ($subscriber->getId()) { + + $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) + ->save(); + } else { + $subscriber = Mage::getModel('newsletter/subscriber')->setImportMode(TRUE); + if(isset($data['data']['fname'])){ + $subscriber->setSubscriberFirstname($data['data']['fname']); + } + if(isset($data['data']['lname'])){ + $subscriber->setSubscriberLastname($data['data']['lname']); + } + if(isset($data['data']['merges']['STOREID'])){ + $subscriberStoreId=$data['data']['merges']['STOREID']; + }else { + $subscriberStoreId = Mage::helper('monkey')->getStoreByList($data['data']['id']); + } + Mage::app()->setCurrentStore($subscriberStoreId); + $subscriber->subscribe($data['data']['email']); + Mage::app()->setCurrentStore(0); + + } + $customerExist = Mage::getSingleton('customer/customer') + ->getCollection() + ->addAttributeToFilter('email', array('eq' => $data['data']['email']) ) + ->getFirstItem(); + if($customerExist){ + $storeId = $customerExist->getStoreId(); + } + if($customerExist && Mage::getStoreConfig('sweetmonkey/general/active', $storeId)){ + Mage::helper('sweetmonkey')->pushVars($customerExist); + } + } catch (Exception $e) { + Mage::logException($e); + } + } + + + /** + * Unsubscribe or delete email from Magento list + * + * @param array $data + * @return void + */ + + protected function _unsubscribe(array $data) + { + $subscriber = Mage::getSingleton('newsletter/subscriber') + ->loadByEmail($data['data']['email']); + + if (!$subscriber->getId()) { + $subscriber = Mage::getModel('newsletter/subscriber') + ->loadByEmail($data['data']['email']); + } + if($subscriber->getId()){ + try { + if(!Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $subscriber->getStoreId())){ + $subscriber->setImportMode(true); + } + + switch ($data['data']['action']) { + case 'delete' : + //if config setting "Webhooks Delete action" is set as "Delete customer account" + if (Mage::getStoreConfig("monkey/general/webhook_delete") == 1) { + $subscriber->delete(); + } else { + $subscriber->unsubscribe(); + } + break; + case 'unsub': + $subscriber->unsubscribe(); + break; + } + } catch (Exception $e) { + Mage::logException($e); + } + } + } + + /** + * Add "Cleaned Emails" notification to Adminnotification Inbox + * + * @param array $data + * @return void + */ + + + protected function _cleaned(array $data) + { + if (Mage::helper('monkey')->isAdminNotificationEnabled()) { //This 'if' returns false even if Admin Notification is enabled on the module sometimes, must check why + $text = Mage::helper('monkey')->__('MailChimp Cleaned Emails: %s %s at %s reason: %s', $data['data']['email'], $data['type'], $data['fired_at'], $data['data']['reason']); + $temp1=$this->_getInbox() + ->setTitle($text) + ->setDescription($text) + ->save(); + + } + + //Delete subscriber from Magento + $s = Mage::getSingleton('newsletter/subscriber') + ->loadByEmail($data['data']['email']); + + if ($s->getId()) { + try { + $s->delete(); + } catch (Exception $e) { + Mage::logException($e); + } + } + } + + + /** + * Add "Campaign Sending Status" notification to Adminnotification Inbox + * + * @param array $data + * @return void + */ + + protected function _campaign(array $data) + { + if (Mage::helper('monkey')->isAdminNotificationEnabled()) { + $text = Mage::helper('monkey')->__('MailChimp Campaign Send: %s %s at %s', $data['data']['subject'], $data['data']['status'], $data['fired_at']); + $this->_getInbox() + ->setTitle($text) + ->setDescription($text) + ->save(); + } + + } + + + + + protected function _profile(array $data) + { + $email = $data['data']['email']; + $subscriber = Mage::getSingleton('newsletter/subscriber') + ->loadByEmail($data['data']['email']); + + $customerCollection = Mage::getModel('customer/customer')->getCollection() + ->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->save(); + } + + /** + * Update customer email + * + * @param array $data + * @return void + */ + protected function _updateEmail(array $data) + { + $old = $data['data']['old_email']; + $new = $data['data']['new_email']; + + + $oldSubscriber = Mage::getSingleton('newsletter/subscriber')->loadByEmail($old); + $newSubscriber = Mage::getSingleton('newsletter/subscriber')->loadByEmail($new); + + + $subscriberStoreId = Mage::helper('monkey')->getStoreByList($data['data']['list_id']); + + Mage::app()->setCurrentStore($subscriberStoreId); + + + if ($oldSubscriber->getId()) { + $oldSubscriber->setSubscriberEmail($new) + ->save(); + Mage::app()->setCurrentStore(0); + } elseif (!$newSubscriber->getId() && !$oldSubscriber->getId()) { + Mage::getModel('newsletter/subscriber') + ->setImportMode(TRUE) + ->setStoreId(Mage::app()->getStore()->getId()) + ->subscribe($new); + Mage::app()->setCurrentStore(0); + } + } + + + + /** + * Return Inbox model instance + * + * @return Mage_AdminNotification_Model_Inbox + */ + protected function _getInbox() + { + return Mage::getModel('adminnotification/inbox') + ->setSeverity(4)//Notice + ->setDateAdded(Mage::getModel('core/date')->gmtDate()); + } + + } diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Custom/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Custom/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce.php b/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php b/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php old mode 100755 new mode 100644 index a8df8d67..38659a9d --- a/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php @@ -95,10 +95,11 @@ public function run(Varien_Event_Observer $observer) $order = $observer->getEvent()->getOrder(); if (is_object($order) && $order->getId()) { //Set Campaign Id if exist - $campaign_id = Mage::getModel('monkey/ecommerce360')->getCookie()->get('magemonkey_campaign_id'); + $campaign_id = $this->_getCampaignCookie(); if ($campaign_id && $order->getEbizmartsMagemonkeyCampaignId() == null) { $order->setEbizmartsMagemonkeyCampaignId($campaign_id)->save(); } + $this->_deleteCampaignCookie(); $customerEmail = $order->getCustomerEmail(); $collection = Mage::getModel('monkey/lastorder')->getCollection() ->addFieldToFilter('email', array('eq' => $customerEmail)); @@ -313,7 +314,21 @@ protected function _getEmailCookie() */ protected function _getCampaignCookie() { - return $this->getCookie()->get('magemonkey_campaign_id'); + $cookie = Mage::getModel('core/cookie')->get('magemonkey_campaign_id'); + if($cookie && Mage::getModel('core/cookie')->getLifetime('magemonkey_campaign_id') == 3600) { + return $cookie; + } + else { + return null; + } + } + + protected function _deleteCampaignCookie() + { + if($this->_getCampaignCookie()) + { + Mage::getModel('core/cookie')->delete('magemonkey_campaign_id'); + } } /** diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Email/Template.php b/app/code/community/Ebizmarts/MageMonkey/Model/Email/Template.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php b/app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Lastorder.php b/app/code/community/Ebizmarts/MageMonkey/Model/Lastorder.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php b/app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/MCEXPORTAPI.php b/app/code/community/Ebizmarts/MageMonkey/Model/MCEXPORTAPI.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php b/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php old mode 100755 new mode 100644 index f2611b33..aa1f4a4d --- a/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php @@ -26,254 +26,17 @@ class Ebizmarts_MageMonkey_Model_Monkey */ public function processWebhookData(array $data) { - $listId = $data['data']['list_id']; //According to the docs, the events are always related to a list_id -// $store = Mage::helper('monkey')->getStoreByList($listId); - $subscriber = Mage::getModel('newsletter/subscriber') - ->loadByEmail($data['data']['email']); - $storeId = $subscriber->getStoreId(); - $store = Mage::getModel('core/store')->load($storeId); - if (!is_null($store)) { - $curstore = Mage::app()->getStore(); - Mage::app()->setCurrentStore($store); - } - //Object for cache clean - $object = new stdClass(); - $object->requestParams = array(); - $object->requestParams['id'] = $listId; - if (isset($data['data']['email'])) { - $object->requestParams['email_address'] = $data['data']['email']; - } - $cacheHelper = Mage::helper('monkey/cache'); - - switch ($data['type']) { - case 'subscribe': - $this->_subscribe($data); - $cacheHelper->clearCache('listSubscribe', $object); - break; - case 'unsubscribe': - $this->_unsubscribe($data); - $cacheHelper->clearCache('listUnsubscribe', $object); - break; - case 'cleaned': - $this->_clean($data); - $cacheHelper->clearCache('listUnsubscribe', $object); - break; - case 'campaign': - $this->_campaign($data); - break; - //case 'profile': Cuando se actualiza email en MC como merchant, te manda un upmail y un profile (no siempre en el mismo órden) - case 'upemail': - $this->_updateEmail($data); - $cacheHelper->clearCache('listUpdateMember', $object); - break; - case 'profile': - $this->_profile($data); - $cacheHelper->clearCache('listUpdateMember', $object); - break; - } - - if (!is_null($store)) { - Mage::app()->setCurrentStore($curstore); - } - } - - /** - * Update customer email - * - * @param array $data - * @return void - */ - protected function _updateEmail(array $data) - { - - $old = $data['data']['old_email']; - $new = $data['data']['new_email']; - - $oldSubscriber = $this->loadByEmail($old); - $newSubscriber = $this->loadByEmail($new); - - if (!$newSubscriber->getId() && $oldSubscriber->getId()) { - $oldSubscriber->setSubscriberEmail($new) - ->save(); - } elseif (!$newSubscriber->getId() && !$oldSubscriber->getId()) { - - Mage::getModel('newsletter/subscriber') - ->setImportMode(TRUE) - ->setStoreId(Mage::app()->getStore()->getId()) - ->subscribe($new); - } - } - - /** - * Add "Cleaned Emails" notification to Adminnotification Inbox - * - * @param array $data - * @return void - */ - protected function _clean(array $data) - { - - if (Mage::helper('monkey')->isAdminNotificationEnabled()) { - $text = Mage::helper('monkey')->__('MailChimp Cleaned Emails: %s %s at %s reason: %s', $data['data']['email'], $data['type'], $data['fired_at'], $data['data']['reason']); - - $this->_getInbox() - ->setTitle($text) - ->setDescription($text) - ->save(); - } - - //Delete subscriber from Magento - $s = $this->loadByEmail($data['data']['email']); - - if ($s->getId()) { - try { - $s->delete(); - } catch (Exception $e) { - Mage::logException($e); - } - } - } - - /** - * Add "Campaign Sending Status" notification to Adminnotification Inbox - * - * @param array $data - * @return void - */ - protected function _campaign(array $data) - { - - if (Mage::helper('monkey')->isAdminNotificationEnabled()) { - $text = Mage::helper('monkey')->__('MailChimp Campaign Send: %s %s at %s', $data['data']['subject'], $data['data']['status'], $data['fired_at']); - - $this->_getInbox() - ->setTitle($text) - ->setDescription($text) - ->save(); - } + Mage::getModel('monkey/asyncwebhooks') + ->setWebhookType($data['type']) + ->setWebhookData(json_encode($data)) + ->setProcessed(0) + ->save(); } - /** - * Subscribe email to Magento list, store aware - * - * @param array $data - * @return void - */ - protected function _subscribe(array $data) - { - try { - - //TODO: El método subscribe de Subscriber (Magento) hace un load by email - // entonces si existe en un store, lo acutaliza y lo cambia de store, no lo agrega a otra store - //VALIDAR si es lo que se requiere - - $subscriber = Mage::getModel('newsletter/subscriber') - ->loadByEmail($data['data']['email']); - if ($subscriber->getId()) { - $subscriber->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) - ->save(); - } else { - $subscriber = Mage::getModel('newsletter/subscriber')->setImportMode(TRUE); - if(isset($data['data']['fname'])){ - $subscriber->setSubscriberFirstname($data['data']['fname']); - } - if(isset($data['data']['lname'])){ - $subscriber->setSubscriberLastname($data['data']['lname']); - } - $subscriber->subscribe($data['data']['email']); - - } - $customerExist = Mage::getSingleton('customer/customer') - ->getCollection() - ->addAttributeToFilter('email', array('eq' => $data['data']['email']) ) - ->getFirstItem(); - if($customerExist){ - $storeId = $customerExist->getStoreId(); - } - if($customerExist && Mage::getStoreConfig('sweetmonkey/general/active', $storeId)){ - Mage::helper('sweetmonkey')->pushVars($customerExist); - } - } catch (Exception $e) { - Mage::logException($e); - } - } - - /** - * Unsubscribe or delete email from Magento list, store aware - * - * @param array $data - * @return void - */ - protected function _unsubscribe(array $data) - { - $subscriber = $this->loadByEmail($data['data']['email']); - - if (!$subscriber->getId()) { - $subscriber = Mage::getModel('newsletter/subscriber') - ->loadByEmail($data['data']['email']); - } - - if ($subscriber->getId()) { - try { - if(!Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $subscriber->getStoreId())){ - $subscriber->setImportMode(true); - } - - switch ($data['data']['action']) { - case 'delete' : - //if config setting "Webhooks Delete action" is set as "Delete customer account" - if (Mage::getStoreConfig("monkey/general/webhook_delete") == 1) { - $subscriber->delete(); - } else { - $subscriber->unsubscribe(); - } - break; - case 'unsub': - $subscriber->unsubscribe(); - break; - } - } catch (Exception $e) { - Mage::logException($e); - } - } - } - - protected function _profile(array $data) - { - $email = $data['data']['email']; - $subscriber = $this->loadByEmail($email); - $storeId = $subscriber->getStoreId(); - - $customerCollection = Mage::getModel('customer/customer')->getCollection() - ->addFieldToFilter('email', array('eq' => $email)); - if (count($customerCollection) > 0) { - $toUpdate = $customerCollection->getFirstItem(); - } else { - $toUpdate = $subscriber; - } - $toUpdate->setFirstname($data['data']['merges']['FNAME']); - $toUpdate->setLastname($data['data']['merges']['LNAME']); - $toUpdate->save(); - - - } - - /** - * Return Inbox model instance - * - * @return Mage_AdminNotification_Model_Inbox - */ - protected function _getInbox() - { - return Mage::getModel('adminnotification/inbox') - ->setSeverity(4)//Notice - ->setDateAdded(Mage::getModel('core/date')->gmtDate()); - } - - /** + /** * Load newsletter_subscriber by email * * @param string $email diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Apidebug/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncorders/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncsubscribers/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncwebhooks.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncwebhooks.php new file mode 100644 index 00000000..04ecbf50 --- /dev/null +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncwebhooks.php @@ -0,0 +1,22 @@ + + * Date : 9/12/14 + * Time : 1:09 AM + * File : AsyncWebhooks.php + * Module : Ebizmarts_MageMonkey + */ +class Ebizmarts_MageMonkey_Model_Mysql4_Asyncwebhooks extends Mage_Core_Model_Mysql4_Abstract +{ + + /** + * Initialize + * + * @return void + */ + public function _construct() + { + $this->_init('monkey/asyncwebhooks', 'id'); + } +} \ No newline at end of file diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncwebhooks/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncwebhooks/Collection.php new file mode 100644 index 00000000..7ce8cc4e --- /dev/null +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Asyncwebhooks/Collection.php @@ -0,0 +1,23 @@ + + * Date : 9/12/14 + * Time : 1:17 AM + * File : Collection.php + * Module : Ebizmarts_MageMonkey + */ +class Ebizmarts_MageMonkey_Model_Mysql4_Asyncwebhooks_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract +{ + + /** + * Set resource type + * + * @return void + */ + public function _construct() + { + parent::_construct(); + $this->_init('monkey/asyncwebhooks'); + } +} \ No newline at end of file diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Export/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Bulksync/Import/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Ecommerce/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Lastorder.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Lastorder.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Lastorder/Collection.php b/app/code/community/Ebizmarts/MageMonkey/Model/Mysql4/Lastorder/Collection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php b/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php old mode 100755 new mode 100644 index 5f1e5b7a..5868fd05 --- a/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php @@ -268,13 +268,11 @@ protected function _saveCustomerGroups($lists,$api,$selectedLists,$hookUrl) //If webhook was not added, add a message on Admin panel if ($api->errorCode && Mage::helper('monkey')->isAdmin()) { - //Don't show an error if webhook already in, otherwise, show error message and code if ($api->errorMessage !== "Setting up multiple WebHooks for one URL is not allowed.") { $message = Mage::helper('monkey')->__('Could not add Webhook "%s" for list "%s", error code %s, %s', $hookUrl, $list['name'], $api->errorCode, $api->errorMessage); Mage::getSingleton('adminhtml/session')->addError($message); } - } /** * Adding Webhooks @@ -298,7 +296,7 @@ public function updateCustomer(Varien_Event_Observer $observer) $request = Mage::app()->getRequest(); $isAdmin = $request->getActionName() == 'save' && $request->getControllerName() == 'customer' && $request->getModuleName() == (string)Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName'); $customer = $observer->getEvent()->getCustomer(); - $isCheckout = $request->getModuleName() == 'checkout' || $request->getModuleName() == 'sgps' || Mage::getSingleton('core/session')->getIsOneStepCheckout() || Mage::getSingleton('core/session')->getMonkeyCheckout(); + $isCheckout = $request->getControllerName() == 'sales_order_create' || $request->getModuleName() == 'firecheckout' || $request->getModuleName() == 'checkout' || $request->getModuleName() == 'sgps' || Mage::getSingleton('core/session')->getIsOneStepCheckout() || Mage::getSingleton('core/session')->getMonkeyCheckout(); // $isConfirmNeed = FALSE; // if (!Mage::helper('monkey')->isAdmin() && // (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $customer->getStoreId()) == 1) @@ -357,6 +355,24 @@ public function updateCustomer(Varien_Event_Observer $observer) return $observer; } + public function registerCheckoutSubscribeWithSagePay(Varien_Event_Observer $observer){ + if (!Mage::helper('monkey')->canMonkey()) { + return $observer; + } + $post = $observer->getEvent()->getPost(); + $oneStep = Mage::app()->getRequest()->getModuleName() == 'onestepcheckout'; + $subscribe = $post['magemonkey_subscribe']; + + Mage::getSingleton('core/session')->setMonkeyPost(serialize($post)); + if (!is_null($subscribe) || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CHECKOUT_SUBSCRIBE, Mage::app()->getStore()->getId()) >= 3) { + Mage::getSingleton('core/session')->setMonkeyCheckout(true); + } + if ($oneStep) { + Mage::getSingleton('core/session')->setIsOneStepCheckout(true); + } + return $observer; + } + /** * Add flag on session to tell the module if on success page should subscribe customer * @@ -368,19 +384,26 @@ public function registerCheckoutSubscribe(Varien_Event_Observer $observer) if (!Mage::helper('monkey')->canMonkey()) { return $observer; } - - $oneStep = Mage::app()->getRequest()->getModuleName() == 'onestepcheckout'; - if (Mage::app()->getRequest()->isPost()) { - $subscribe = Mage::app()->getRequest()->getPost('magemonkey_subscribe'); - $force = Mage::app()->getRequest()->getPost('magemonkey_force'); - - Mage::getSingleton('core/session')->setMonkeyPost(serialize(Mage::app()->getRequest()->getPost())); - if (!is_null($subscribe) || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CHECKOUT_SUBSCRIBE) >= 3) { - Mage::getSingleton('core/session')->setMonkeyCheckout(true); + if (Mage::getSingleton('core/session')->getMonkeyPost()){ + $order = $observer->getEvent()->getOrder(); + $this->_handleCheckoutSubscription($order, true); + }else { + $oneStep = Mage::app()->getRequest()->getModuleName() == 'onestepcheckout'; + if (Mage::app()->getRequest()->isPost()) { + $subscribe = Mage::app()->getRequest()->getPost('magemonkey_subscribe'); + + Mage::getSingleton('core/session')->setMonkeyPost(serialize(Mage::app()->getRequest()->getPost())); + if (!is_null($subscribe) || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CHECKOUT_SUBSCRIBE, Mage::app()->getStore()->getId()) >= 3) { + Mage::getSingleton('core/session')->setMonkeyCheckout(true); + } + } + if ($oneStep) { + Mage::getSingleton('core/session')->setIsOneStepCheckout(true); + } + if (Mage::getSingleton('core/session')->getMonkeyPost()){ + $order = $observer->getEvent()->getOrder(); + $this->_handleCheckoutSubscription($order, true); } - } - if ($oneStep) { - Mage::getSingleton('core/session')->setIsOneStepCheckout(true); } return $observer; } @@ -406,8 +429,40 @@ public function registerCheckoutSuccess(Varien_Event_Observer $observer) if ($orderId) { $order = Mage::getModel('sales/order')->load($orderId); } + $this->_handleCheckoutSubscription($order, false); + + return $observer; + } + + /** Add mass action option to Sales -> Order grid in admin panel to send orders to MC (Ecommerce360) + * + * @param Varien_Event_Observer $observer + * @return void + */ + public function massActionOption(Varien_Event_Observer $observer) + { + $stores = Mage::app()->getStores(); + if (!Mage::helper('monkey')->canMonkey($stores)) { + return $observer; + } + $block = $observer->getEvent()->getBlock(); + + if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction) { + + if ($block->getRequest()->getControllerName() == 'sales_order') { + + $block->addItem('magemonkey_ecommerce360', array( + 'label' => Mage::helper('monkey')->__('Send to MailChimp'), + 'url' => Mage::getModel('adminhtml/url')->getUrl('adminhtml/ecommerce/masssend', Mage::app()->getStore()->isCurrentlySecure() ? array('_secure' => true) : array()), + )); + + } + } + return $observer; + } - if (is_object($order) && $order->getId()) { + protected function _handleCheckoutSubscription($order, $isSaveOrderBefore = false){ + if (is_object($order) && ($order->getId() || $isSaveOrderBefore)) { //Set Campaign Id if exist $campaign_id = Mage::getModel('monkey/ecommerce360')->getCookie()->get('magemonkey_campaign_id'); if ($campaign_id) { @@ -431,10 +486,12 @@ public function registerCheckoutSuccess(Varien_Event_Observer $observer) ->setSubscriberFirstname($order->getCustomerFirstname()) ->setSubscriberLastname($order->getCustomerLastname()) ->setEmail($order->getCustomerEmail()); + } + $orderId = $order->getId(); if(Mage::getSingleton('core/session')->getMonkeyCheckout() || Mage::getSingleton('core/session')->getIsOneStepCheckout()) { - Mage::helper('monkey')->listsSubscription($toSubscribe, $saveOnDb); + Mage::helper('monkey')->listsSubscription($toSubscribe, $saveOnDb, $orderId); } } @@ -442,34 +499,6 @@ public function registerCheckoutSuccess(Varien_Event_Observer $observer) Mage::getSingleton('core/session')->setMonkeyPost(NULL); Mage::getSingleton('core/session')->setIsOneStepCheckout(FALSE); Mage::getSingleton('core/session')->setRegisterCheckoutSuccess(FALSE); - return $observer; - } - - /** Add mass action option to Sales -> Order grid in admin panel to send orders to MC (Ecommerce360) - * - * @param Varien_Event_Observer $observer - * @return void - */ - public function massActionOption(Varien_Event_Observer $observer) - { - $stores = Mage::app()->getStores(); - if (!Mage::helper('monkey')->canMonkey($stores)) { - return $observer; - } - $block = $observer->getEvent()->getBlock(); - - if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction || $block instanceof Enterprise_SalesArchive_Block_Adminhtml_Sales_Order_Grid_Massaction) { - - if ($block->getRequest()->getControllerName() == 'sales_order') { - - $block->addItem('magemonkey_ecommerce360', array( - 'label' => Mage::helper('monkey')->__('Send to MailChimp'), - 'url' => Mage::getModel('adminhtml/url')->getUrl('adminhtml/ecommerce/masssend', Mage::app()->getStore()->isCurrentlySecure() ? array('_secure' => true) : array()), - )); - - } - } - return $observer; } public function alterNewsletterGrid(Varien_Event_Observer $observer){ diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Subscriber.php b/app/code/community/Ebizmarts/MageMonkey/Model/Subscriber.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Account.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Account.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Attributes.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Attributes.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncDatasource.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncDatasource.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncStatus.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/BulksyncStatus.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Checkoutsubscribe.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Checkoutsubscribe.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CronProcessLimit.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CronProcessLimit.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CustomerGroup.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/CustomerGroup.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Ecommerce360.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Ecommerce360.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderProcessLimit.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderProcessLimit.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderStatus.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/OrderStatus.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Status.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/Status.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/TransactionalEmails.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/TransactionalEmails.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/WebhookDelete.php b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/WebhookDelete.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/BulksyncController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/BulksyncController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/EcommerceController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/EcommerceController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/Customer/AccountController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/Customer/AccountController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/SignupController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/SignupController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php old mode 100755 new mode 100644 index 813248cc..de216177 --- a/app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php +++ b/app/code/community/Ebizmarts/MageMonkey/controllers/WebhookController.php @@ -17,7 +17,6 @@ class Ebizmarts_MageMonkey_WebhookController extends Mage_Core_Controller_Front_ public function indexAction() { $requestKey = $this->getRequest()->getParam('wkey'); - //Checking if "wkey" para is present on request, we cannot check for !isPost() //because Mailchimp pings the URL (GET request) to validate webhook if (!$requestKey) { diff --git a/app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml b/app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/etc/config.xml b/app/code/community/Ebizmarts/MageMonkey/etc/config.xml index 9289f8dd..99bb2983 100755 --- a/app/code/community/Ebizmarts/MageMonkey/etc/config.xml +++ b/app/code/community/Ebizmarts/MageMonkey/etc/config.xml @@ -10,7 +10,7 @@ - 1.2.4.1 + 1.2.5 @@ -69,6 +69,9 @@ magemonkey_last_order
+ + magemonkey_async_webhooks
+
@@ -135,6 +138,14 @@ + + + + monkey/observer + registerCheckoutSubscribeWithSagePay + + + @@ -143,6 +154,14 @@ + + + + monkey/observer + registerCheckoutSubscribe + + + @@ -267,6 +286,7 @@ 1 1 HASCLICKED + 1 0 @@ -336,6 +356,14 @@ monkey/cron::cleanSubscribersAsync + + + */15 * * * * + + + monkey/cron::processWebhookData + +
diff --git a/app/code/community/Ebizmarts/MageMonkey/etc/system.xml b/app/code/community/Ebizmarts/MageMonkey/etc/system.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-install-0.0.1.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-install-0.0.1.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.1-0.0.2.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.1-0.0.2.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.2-0.0.3.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.2-0.0.3.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.3-0.0.4.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.3-0.0.4.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.4-0.0.5.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.4-0.0.5.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.5-0.0.6.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.5-0.0.6.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.6-0.0.7.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-0.0.6-0.0.7.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.0.10-1.0.11.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.0.10-1.0.11.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.21-1.1.22.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.21-1.1.22.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.23-1.1.24.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.23-1.1.24.php old mode 100755 new mode 100644 index 9a20e003..0b19b496 --- a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.23-1.1.24.php +++ b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.23-1.1.24.php @@ -4,9 +4,13 @@ $installer->startSetup(); -$installer->run(" +try { + $installer->run(" ALTER TABLE `{$this->getTable('magemonkey_async_subscribers')}` CHANGE `proccessed` `processed` INT; ALTER TABLE `{$this->getTable('magemonkey_async_orders')}` CHANGE `proccessed` `processed` INT; "); +} + +catch(Exception $e){} $installer->endSetup(); \ No newline at end of file diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.33-1.1.34.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.33-1.1.34.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.5-1.1.6.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.1.5-1.1.6.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.2.1-1.2.2.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.2.1-1.2.2.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.2.4-1.2.5.php b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.2.4-1.2.5.php new file mode 100644 index 00000000..273e98e0 --- /dev/null +++ b/app/code/community/Ebizmarts/MageMonkey/sql/monkey_setup/mysql4-upgrade-1.2.4-1.2.5.php @@ -0,0 +1,21 @@ +startSetup(); + +$installer->getConnection()->addColumn( + $installer->getTable('magemonkey_async_subscribers'), 'order_id', 'smallint(5)' +); + +$installer->run(" + CREATE TABLE IF NOT EXISTS `{$this->getTable('magemonkey_async_webhooks')}` ( + `id` INT(10) unsigned NOT NULL auto_increment, + `webhook_type` varchar(24), + `webhook_data` text, + `processed` INT(1) NOT NULL default 0, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +"); + +$installer->endSetup(); \ No newline at end of file diff --git a/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Userinfo.php b/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/System/Config/Userinfo.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates.php b/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates/Grid.php b/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Templates/Templates/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders.php b/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders/Grid.php b/app/code/community/Ebizmarts/Mandrill/Block/Adminhtml/Users/Senders/Grid.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Helper/Data.php b/app/code/community/Ebizmarts/Mandrill/Helper/Data.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Model/Customcollection.php b/app/code/community/Ebizmarts/Mandrill/Model/Customcollection.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php b/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Model/System/Config.php b/app/code/community/Ebizmarts/Mandrill/Model/System/Config.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/Model/System/Config/Source/Userinfo.php b/app/code/community/Ebizmarts/Mandrill/Model/System/Config/Source/Userinfo.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/controllers/Adminhtml/Mandrill/UsersController.php b/app/code/community/Ebizmarts/Mandrill/controllers/Adminhtml/Mandrill/UsersController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/etc/adminhtml.xml b/app/code/community/Ebizmarts/Mandrill/etc/adminhtml.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/etc/config.xml b/app/code/community/Ebizmarts/Mandrill/etc/config.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/Mandrill/etc/system.xml b/app/code/community/Ebizmarts/Mandrill/etc/system.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Autovars.php b/app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Autovars.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php b/app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Fieldset/Hint.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php b/app/code/community/Ebizmarts/SweetMonkey/Block/Adminhtml/System/Config/Form/Field/Mapfields.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/Helper/Data.php b/app/code/community/Ebizmarts/SweetMonkey/Helper/Data.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/Model/Observer.php b/app/code/community/Ebizmarts/SweetMonkey/Model/Observer.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/controllers/Adminhtml/MageMonkeyController.php b/app/code/community/Ebizmarts/SweetMonkey/controllers/Adminhtml/MageMonkeyController.php old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/etc/adminhtml.xml b/app/code/community/Ebizmarts/SweetMonkey/etc/adminhtml.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/etc/config.xml b/app/code/community/Ebizmarts/SweetMonkey/etc/config.xml old mode 100755 new mode 100644 diff --git a/app/code/community/Ebizmarts/SweetMonkey/etc/system.xml b/app/code/community/Ebizmarts/SweetMonkey/etc/system.xml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/layout/ebizmarts/abandonedcart.xml b/app/design/adminhtml/default/default/layout/ebizmarts/abandonedcart.xml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/layout/ebizmarts/mandrill.xml b/app/design/adminhtml/default/default/layout/ebizmarts/mandrill.xml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/layout/magemonkey.xml b/app/design/adminhtml/default/default/layout/magemonkey.xml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/index.phtml b/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/index.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/salebar.phtml b/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/salebar.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/totalbar.phtml b/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/dashboard/totalbar.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/system/config/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/abandonedcart/system/config/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/backtostock/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/backtostock/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/birthday/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/birthday/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/review/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/review/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/wishlist/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/autoresponder/system/config/wishlist/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/ebizmarts/mandrill/system/config/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/ebizmarts/mandrill/system/config/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/bulksync/export/form.phtml b/app/design/adminhtml/default/default/template/magemonkey/bulksync/export/form.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/bulksync/import/form.phtml b/app/design/adminhtml/default/default/template/magemonkey/bulksync/import/form.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/system/config/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/magemonkey/system/config/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/system/config/oauth_wizard.phtml b/app/design/adminhtml/default/default/template/magemonkey/system/config/oauth_wizard.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/system/config/resetlocal360.phtml b/app/design/adminhtml/default/default/template/magemonkey/system/config/resetlocal360.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/system/config/resetremote360.phtml b/app/design/adminhtml/default/default/template/magemonkey/system/config/resetremote360.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/magemonkey/system/config/upgradeforpatch.phtml b/app/design/adminhtml/default/default/template/magemonkey/system/config/upgradeforpatch.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/sweetmonkey/system/config/autovars.phtml b/app/design/adminhtml/default/default/template/sweetmonkey/system/config/autovars.phtml old mode 100755 new mode 100644 diff --git a/app/design/adminhtml/default/default/template/sweetmonkey/system/config/fieldset/hint.phtml b/app/design/adminhtml/default/default/template/sweetmonkey/system/config/fieldset/hint.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/layout/ebizmarts/abandonedcart.xml b/app/design/frontend/base/default/layout/ebizmarts/abandonedcart.xml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/layout/ebizmarts/autoresponder.xml b/app/design/frontend/base/default/layout/ebizmarts/autoresponder.xml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/layout/magemonkey.xml b/app/design/frontend/base/default/layout/magemonkey.xml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/form.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/form.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/notice.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/catalog/product/notice.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/item.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/backtostock/item.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/customer/list.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/customer/list.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/related/items.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/related/items.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/review/items.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/review/items.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/unsubscribe.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/unsubscribe.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts/autoresponder/wishlist/items.phtml b/app/design/frontend/base/default/template/ebizmarts/autoresponder/wishlist/items.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items.phtml b/app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items/order/default.phtml b/app/design/frontend/base/default/template/ebizmarts_abandonedcart/email/order/items/order/default.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/ebizmarts_abandonedcart/popup/emailcatcher.phtml b/app/design/frontend/base/default/template/ebizmarts_abandonedcart/popup/emailcatcher.phtml old mode 100755 new mode 100644 index 1fe7f012..2ed3ec87 --- a/app/design/frontend/base/default/template/ebizmarts_abandonedcart/popup/emailcatcher.phtml +++ b/app/design/frontend/base/default/template/ebizmarts_abandonedcart/popup/emailcatcher.phtml @@ -83,26 +83,22 @@ onCancel: function (win) { load($counterId); + $counter = $_COOKIE['counter']; //if(counter en config == counter en db){ - if($counter->getCounter()+1 >= Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_INSIST, Mage::app()->getStore()->getId())): + if($counter+1 >= Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::POPUP_INSIST, Mage::app()->getStore()->getId())): ?> - document.cookie = 'counter=; expires=Thu, 01 Jan 1970 00:00:01 GMT'; - createCookie('email=none', _getStoreId()))); ?>); - setCounter(($counter->getCounter()+1)); - $counter->save(); - endif; ?> + Mage.Cookies.clear('counter'); + createCookie('email', 'none', _getStoreId()))); ?>); + + createCookie('counter',,_getStoreId()))); ?>); + getStore()->getId()) == 1): ?> - createCookie('email=none', _getStoreId()))); ?>); - _getStoreId()))); ?>); + $newCounter = Mage::getModel('ebizmarts_abandonedcart/popup'); - $newCounter->setCounter(1)->save(); - ?> - createCookie('counter=' +getId())); ?>, _getStoreId()))); ?>); + createCookie('counter',1,_getStoreId()))); ?>); }, @@ -121,10 +117,9 @@ lname = inputFieldLName.value; } if (validateEmail(email)) { - var cookie = 'email=' + email + '/' + fname + '/' + lname; - createCookie(cookie, 365); + createCookie('email',email + '/' + fname + '/' + lname, 365); _modalSubscribe()): ?> - createCookie('subscribe=true', 365); + createCookie('subscribe', 'true', 365); location.reload(); win.close(); @@ -158,20 +153,28 @@ return re.test(email); } function emailCookieExists() { - var cookie = document.cookie; - var cookieArr = cookie.split(';'); - var cookieStored = false; - for (var i = 0; i < cookieArr.length; i++) { - if (cookieArr[i].indexOf('email=') > -1) { - cookieStored = true; - } +// var cookie = document.cookie; +// var cookieArr = cookie.split(';'); +// var cookieStored = false; +// for (var i = 0; i < cookieArr.length; i++) { +// if (cookieArr[i].indexOf('email=') > -1) { +// cookieStored = true; +// } +// } +// return cookieStored; + if(Mage.Cookies.get('email')) { + return true + } + else { + return false } - return cookieStored; } - function createCookie(cookie, expirationInDays) { + function createCookie(name, value, expirationInDays) { var now = new Date(); var expire = new Date(now.getTime() + (expirationInDays * 24 * 60) * 60000);//[(1 * 365 * 24 * 60) * 60000] == 1 year -- (Years * Days * Hours * Minutes) * 60000 - document.cookie = cookie + '; expires=' + expire + '; path=/'; + //document.cookie = cookie + '; expires=' + expire + '; path=/'; + Mage.Cookies.expires = expire; + Mage.Cookies.set(name,value); } \ No newline at end of file diff --git a/app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml b/app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml old mode 100755 new mode 100644 diff --git a/app/design/frontend/base/default/template/magemonkey/lists.phtml b/app/design/frontend/base/default/template/magemonkey/lists.phtml old mode 100755 new mode 100644 diff --git a/app/etc/modules/Ebizmarts_AbandonedCart.xml b/app/etc/modules/Ebizmarts_AbandonedCart.xml old mode 100755 new mode 100644 diff --git a/app/etc/modules/Ebizmarts_Autoresponder.xml b/app/etc/modules/Ebizmarts_Autoresponder.xml old mode 100755 new mode 100644 diff --git a/app/etc/modules/Ebizmarts_MageMonkey.xml b/app/etc/modules/Ebizmarts_MageMonkey.xml old mode 100755 new mode 100644 diff --git a/app/etc/modules/Ebizmarts_Mandrill.xml b/app/etc/modules/Ebizmarts_Mandrill.xml old mode 100755 new mode 100644 diff --git a/app/etc/modules/Ebizmarts_SweetMonkey.xml b/app/etc/modules/Ebizmarts_SweetMonkey.xml old mode 100755 new mode 100644 diff --git a/app/locale/en_US/Ebizmarts_AbandonedCart.csv b/app/locale/en_US/Ebizmarts_AbandonedCart.csv old mode 100755 new mode 100644 diff --git a/app/locale/en_US/Ebizmarts_Autoresponder.csv b/app/locale/en_US/Ebizmarts_Autoresponder.csv old mode 100755 new mode 100644 diff --git a/app/locale/en_US/Ebizmarts_MageMonkey.csv b/app/locale/en_US/Ebizmarts_MageMonkey.csv old mode 100755 new mode 100644 diff --git a/app/locale/en_US/Ebizmarts_Mandrill.csv b/app/locale/en_US/Ebizmarts_Mandrill.csv old mode 100755 new mode 100644 diff --git a/app/locale/en_US/Ebizmarts_SweetMonkey.csv b/app/locale/en_US/Ebizmarts_SweetMonkey.csv old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_1.html b/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_1.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_2.html b/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_2.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_3.html b/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_3.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_generic.html b/app/locale/en_US/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_generic.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/abandonedcart/popup_coupon_template.html b/app/locale/en_US/template/email/ebizmarts/abandonedcart/popup_coupon_template.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/backtostock.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/backtostock.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/relatedproducts.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/relatedproducts.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/review.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/review.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/reviewcoupon.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/reviewcoupon.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/visitedproducts.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/visitedproducts.html old mode 100755 new mode 100644 diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/Ebizmarts_AbandonedCart.csv b/app/locale/nl_NL/Ebizmarts_AbandonedCart.csv old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/Ebizmarts_MageMonkey.csv b/app/locale/nl_NL/Ebizmarts_MageMonkey.csv old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/Ebizmarts_SweetMonkey.csv b/app/locale/nl_NL/Ebizmarts_SweetMonkey.csv old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_1.html b/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_1.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_2.html b/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_2.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_3.html b/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_3.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_generic.html b/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/abandoned_cart_mail_generic.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/popup_coupon_template.html b/app/locale/nl_NL/template/email/ebizmarts/abandonedcart/popup_coupon_template.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/backtostock.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/backtostock.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/birthday.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/birthday.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/neworder.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/neworder.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/noactivity.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/noactivity.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/relatedproducts.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/relatedproducts.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/review.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/review.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/reviewcoupon.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/reviewcoupon.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/visitedproducts.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/visitedproducts.html old mode 100755 new mode 100644 diff --git a/app/locale/nl_NL/template/email/ebizmarts/autoresponder/wishlist.html b/app/locale/nl_NL/template/email/ebizmarts/autoresponder/wishlist.html old mode 100755 new mode 100644 diff --git a/js/ebizmarts/abandonedcart/popup.css b/js/ebizmarts/abandonedcart/popup.css old mode 100755 new mode 100644 diff --git a/js/ebizmarts/abandonedcart/xmark.png b/js/ebizmarts/abandonedcart/xmark.png old mode 100755 new mode 100644 diff --git a/js/ebizmarts/autoresponders/visitedproducts.js b/js/ebizmarts/autoresponders/visitedproducts.js old mode 100755 new mode 100644 diff --git a/js/ebizmarts/autoresponders/visitedproductsstorecodes.js b/js/ebizmarts/autoresponders/visitedproductsstorecodes.js old mode 100755 new mode 100644 diff --git a/js/ebizmarts/magemonkey/campaignCatcher.js b/js/ebizmarts/magemonkey/campaignCatcher.js old mode 100755 new mode 100644 index 0c2b7575..fa56ba6c --- a/js/ebizmarts/magemonkey/campaignCatcher.js +++ b/js/ebizmarts/magemonkey/campaignCatcher.js @@ -1,32 +1,33 @@ - - function getCampaign() { - var params = location.search.substr(1).split('&'); - var cookies = new Array(); - for (var i = 0; i < params.length; i++) { - var cookie = params[i].split('='); - var key = cookie[0]; - var val = cookie[1]; - if (key && val) { - cookies[key] = val; - } - } - - if (cookies['mc_cid']) { - createCookie('magemonkey_campaign_id=' + cookies['mc_cid'], 30); - } - if (cookies['mc_eid']) { - createCookie('magemonkey_email_id=' + cookies['mc_eid'], 30); +function getCampaign() { + var urlparams = location.search.substr(1).split('&'); + var params = new Array(); + for (var i = 0; i < urlparams.length; i++) { + var param = urlparams[i].split('='); + var key = param[0]; + var val = param[1]; + if (key && val) { + params[key] = val; } } - function createCookie(cookie, expirationInDays) { - var now = new Date(); - var expire = new Date(now.getTime() + (expirationInDays * 24 * 60) * 60000);//[(1 * 365 * 24 * 60) * 60000] == 1 year -- (Years * Days * Hours * Minutes) * 60000 - document.cookie = cookie + '; expires=' + expire + '; path=/'; + if (params['mc_cid']) { + createCookie('magemonkey_campaign_id', params['mc_cid'], 3600); + } + if (params['mc_eid']) { + createCookie('magemonkey_email_id', params['mc_eid'], 3600); } +} + +function createCookie(name, value, expirationInSec) { + var now = new Date(); + var expire = new Date(now.getTime() + (expirationInSec * 1000));//[(1 * 365 * 24 * 60) * 60000] == 1 year -- (Years * Days * Hours * Minutes) * 60000 + alert('creating cookie'); + Mage.Cookies.expires = expire; + Mage.Cookies.set(name,value); +} - if (document.loaded) { - getCampaign; - } else { - document.observe('dom:loaded', getCampaign); - } \ No newline at end of file +if (document.loaded) { + getCampaign; +} else { + document.observe('dom:loaded', getCampaign); +} \ No newline at end of file diff --git a/lib/Mandrill/Mandrill.php b/lib/Mandrill/Mandrill.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Exceptions.php b/lib/Mandrill/Mandrill/Exceptions.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Exports.php b/lib/Mandrill/Mandrill/Exports.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Inbound.php b/lib/Mandrill/Mandrill/Inbound.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Internal.php b/lib/Mandrill/Mandrill/Internal.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Ips.php b/lib/Mandrill/Mandrill/Ips.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Messages.php b/lib/Mandrill/Mandrill/Messages.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Metadata.php b/lib/Mandrill/Mandrill/Metadata.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Rejects.php b/lib/Mandrill/Mandrill/Rejects.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Senders.php b/lib/Mandrill/Mandrill/Senders.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Subaccounts.php b/lib/Mandrill/Mandrill/Subaccounts.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Tags.php b/lib/Mandrill/Mandrill/Tags.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Templates.php b/lib/Mandrill/Mandrill/Templates.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Urls.php b/lib/Mandrill/Mandrill/Urls.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Users.php b/lib/Mandrill/Mandrill/Users.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Webhooks.php b/lib/Mandrill/Mandrill/Webhooks.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Mandrill/Whitelists.php b/lib/Mandrill/Mandrill/Whitelists.php old mode 100755 new mode 100644 diff --git a/lib/Mandrill/Message.php b/lib/Mandrill/Message.php old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/abandonedcart/abandonedcart.css b/skin/adminhtml/default/default/abandonedcart/abandonedcart.css old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/ebizmarts/ebizmarts-tab.png b/skin/adminhtml/default/default/ebizmarts/ebizmarts-tab.png old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/ebizmarts/ebizmarts.css b/skin/adminhtml/default/default/ebizmarts/ebizmarts.css old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/ebizmarts/mandrill/mandrill-tab.png b/skin/adminhtml/default/default/ebizmarts/mandrill/mandrill-tab.png old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/ebizmarts/mandrill/mandrill.css b/skin/adminhtml/default/default/ebizmarts/mandrill/mandrill.css old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/magemonkey/magemonkey.css b/skin/adminhtml/default/default/magemonkey/magemonkey.css old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/magemonkey/magemonkey.js b/skin/adminhtml/default/default/magemonkey/magemonkey.js old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/magemonkey/mailchimp-connected-ebizmarts-title.png b/skin/adminhtml/default/default/magemonkey/mailchimp-connected-ebizmarts-title.png old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/magemonkey/mailchimp-ico.png b/skin/adminhtml/default/default/magemonkey/mailchimp-ico.png old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/magemonkey/mailchimp-section-background.png b/skin/adminhtml/default/default/magemonkey/mailchimp-section-background.png old mode 100755 new mode 100644 diff --git a/skin/adminhtml/default/default/magemonkey/mailchimp-tab.png b/skin/adminhtml/default/default/magemonkey/mailchimp-tab.png old mode 100755 new mode 100644 diff --git a/skin/frontend/base/default/magemonkey/magemonkey.css b/skin/frontend/base/default/magemonkey/magemonkey.css old mode 100755 new mode 100644 diff --git a/skin/frontend/base/default/magemonkey/monkey.js b/skin/frontend/base/default/magemonkey/monkey.js old mode 100755 new mode 100644