diff --git a/.gitignore b/.gitignore 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 index 5e04c15c..4d81f4ae 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Block/Email/Order/Items.php @@ -30,6 +30,7 @@ public function getImage($_item) { $product = Mage::getModel('catalog/product') ->load($_item->getProductId()); + $imageUrl = $product->getThumbnailUrl(); if ($product->getImage() == "no_selection" && $product->getTypeId() == "configurable") { $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($product); $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions(); @@ -38,8 +39,6 @@ public function getImage($_item) $imageUrl = $simple_product->getThumbnailUrl(); } } - } else { - $imageUrl = $product->getThumbnailUrl(); } return $imageUrl; } diff --git a/app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php b/app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php index ff1c5644..aea06c22 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php @@ -54,6 +54,9 @@ public function saveMail($mailType, $mail, $name, $couponCode, $storeId) case 'by_percent': $couponType = 2; break; + default: + $couponType = 0; + break; } } else { $couponType = 0; diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php index c65d0cfb..f203e697 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Model/Config.php @@ -90,4 +90,9 @@ class Ebizmarts_AbandonedCart_Model_Config const POPUP_COUPON_DISCOUNT = 'ebizmarts_abandonedcart/emailcatcher/popup_discount'; const POPUP_COUPON_LABEL = 'ebizmarts_abandonedcart/emailcatcher/popup_couponlabel'; + const GANALYTICS_ACTIVE = 'ebizmarts_abandonedcart/ganalytics/analytics_active'; + const GANALYTICS_SOURCE = 'ebizmarts_abandonedcart/ganalytics/analytics_source'; + const GANALYTICS_MEDIUM = 'ebizmarts_abandonedcart/ganalytics/analytics_medium'; + const GANALYTICS_CAMPAIGN = 'ebizmarts_abandonedcart/ganalytics/analytics_campaign'; + } \ No newline at end of file diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php b/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php index 435081de..fb18fa96 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php @@ -148,7 +148,18 @@ protected function _processRun($adapter, $run, $storeId) } else { $this->sendcoupondays = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::COUPON_DAYS, $storeId); } - + $ganalytics=''; + if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_ACTIVE, $storeId)) { + if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_SOURCE, $storeId)!='') { + $ganalytics .= '&utm_source='.Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_SOURCE, $storeId); + } + if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_MEDIUM, $storeId)!='') { + $ganalytics .= '&utm_medium='.Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_MEDIUM, $storeId); + } + if(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_CAMPAIGN, $storeId)!='') { + $ganalytics .= '&utm_campaign='.Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::GANALYTICS_CAMPAIGN, $storeId); + } + } // for each cart of the current run foreach ($collection as $quote) { $this->_proccessCollection($quote, $storeId); @@ -179,11 +190,11 @@ protected function _processRun($adapter, $run, $storeId) //srand((double)microtime()*1000000); $token = md5(rand(0, 9999999)); if ($abTesting) { - $url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token . '&' . $suffix; + $url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token . '&' . $suffix; } else { $url = Mage::getModel('core/url')->setStore($storeId)->getUrl('', array('_nosid' => true)) . 'ebizmarts_abandonedcart/abandoned/loadquote?id=' . $quote->getEntityId() . '&token=' . $token; } - + $url .= $ganalytics; $data = array('AbandonedURL' => $url, 'AbandonedDate' => $quote->getUpdatedAt()); // send email @@ -200,7 +211,7 @@ protected function _processRun($adapter, $run, $storeId) //if hour is set for first run calculates hours since cart was created else calculates days $today = idate('U', strtotime(now())); - $updatedAt = idate('U', strtotime($quote2->getUpdatedAt())); + $updatedAt = idate('U', strtotime($quote->getUpdatedAt())); $updatedAtDiff = ($today - $updatedAt) / 60 / 60 / 24; if ($this->unit == Ebizmarts_AbandonedCart_Model_Config::IN_HOURS && $run == 0) { $updatedAtDiff = ($today - $updatedAt) / 60 / 60; @@ -263,8 +274,15 @@ protected function _processRun($adapter, $run, $storeId) } } if (Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::AB_TESTING_ACTIVE, $storeId)) { - $counterCollection = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection() - ->addFieldToFilter('store_id', array('eq' => $storeId)); + $counterCollection = Mage::getModel('ebizmarts_abandonedcart/abtesting')->getCollection(); + $defaultStore = Mage::app()->getStore($storeId)->getWebsite()->getDefaultStore(); + $normalFilter = array('eq' => $storeId); + if($storeId == $defaultStore->getId()){ + $newFilter = array('eq' => '0'); + $collection->addFieldToFilter('store_id', array($normalFilter, $newFilter)); + }else{ + $collection->addFieldToFilter('store_id', $normalFilter); + } $counter = $counterCollection->getFirstItem(); $counter->setCurrentStatus($counter->getCurrentStatus() + 1) ->save(); @@ -374,12 +392,12 @@ protected function _sendPopupCoupon($storeId) */ protected function _createNewCoupon($store, $email) { + $websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId(); $collection = Mage::getModel('salesrule/rule')->getCollection() - ->addFieldToFilter('name', array('like' => 'Abandoned coupon ' . $email)); + ->addFieldToFilter('name', array('like' => 'Abandoned coupon ' . $email)) + ->addFieldToFilter('website_ids', array('eq' => $websiteid)); if (!count($collection)) { - $websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId(); - $fromDate = date("Y-m-d"); $toDate = date('Y-m-d', strtotime($fromDate . " + $this->couponexpiredays day")); if ($this->coupontype == 1) { diff --git a/app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php b/app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php index 2ae4ed7d..1b06736d 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php +++ b/app/code/community/Ebizmarts/AbandonedCart/Model/EventObserver.php @@ -21,6 +21,7 @@ public function saveConfig(Varien_Event_Observer $observer) $cleanCache = false; $store = is_null($observer->getEvent()->getStore()) ? Mage::app()->getDefaultStoreView()->getCode() : $observer->getEvent()->getStore(); + $config = null; if (!Mage::helper('ebizmarts_mandrill')->useTransactionalService()) { $config = new Mage_Core_Model_Config(); $config->saveConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, false, $scope, $store); diff --git a/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php b/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php index c0b27089..d74796d1 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php +++ b/app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php @@ -21,9 +21,29 @@ public function loadquoteAction() if (isset($params['id'])) { //restore the quote // Mage::log($params['id']); - + $analytics = array(); + if(isset($params['utm_source'])) { + $analytics['utm_source'] = $params['utm_source']; + } + if(isset($params['utm_medium'])) { + $analytics['utm_medium'] = $params['utm_medium']; + } + if(isset($params['utm_campaign'])) { + $analytics['utm_campaign'] = $params['utm_campaign']; + } $quote = Mage::getModel('sales/quote')->load($params['id']); - $url = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId()); + $url = Mage::getUrl(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId())); + $first = true; + foreach($analytics as $key => $value) { + if($first) { + $char = '?'; + $first = false; + } + else { + $char = '&'; + } + $url .= "$char$key=$value"; + } if (isset($params['coupon'])) { $quote->setCouponCode($params['coupon']); $quote->save(); @@ -32,22 +52,36 @@ public function loadquoteAction() Mage::getSingleton('customer/session')->addNotice("Your token cart is incorrect"); $this->_redirect($url); } else { - $url = Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId()); + $url = Mage::getUrl(Mage::getStoreConfig(Ebizmarts_AbandonedCart_Model_Config::PAGE, $quote->getStoreId())); + $first = true; + foreach($analytics as $key => $value) { + if($first) { + $char = '?'; + $first = false; + } + else { + $char = '&'; + } + $url .= "$char$key=$value"; + } $quote->setEbizmartsAbandonedcartFlag(1); $quote->save(); if (!$quote->getCustomerId()) { $this->_getSession()->setQuoteId($quote->getId()); - $this->_redirect($url); + $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->_redirect($url); + $this->getResponse() + ->setRedirect($url, 301); } else { if (Mage::helper('customer')->isLoggedIn()) { - $this->_redirect($url); + $this->getResponse() + ->setRedirect($url, 301); } else { Mage::getSingleton('customer/session')->addNotice("Login to complete your order"); $this->_redirect('customer/account'); diff --git a/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml b/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml index 4cedfb32..ab7f768f 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml +++ b/app/code/community/Ebizmarts/AbandonedCart/etc/config.xml @@ -10,7 +10,7 @@ - 1.2.1 + 1.2.2.1 diff --git a/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml b/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml index b54021e5..a7e1c024 100755 --- a/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml +++ b/app/code/community/Ebizmarts/AbandonedCart/etc/system.xml @@ -964,6 +964,58 @@ + + + 500 + text + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 510 + 1 + 1 + 1 + + + + text + 520 + 1 + 1 + 1 + + 1 + + + + + text + 530 + 1 + 1 + 1 + + 1 + + + + + text + 540 + 1 + 1 + 1 + + 1 + + + + diff --git a/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php b/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php index 063129e7..a98b97ad 100755 --- a/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php +++ b/app/code/community/Ebizmarts/Autoresponder/Model/Cron.php @@ -135,8 +135,16 @@ protected function _processBirthday($storeId) $moreselect = "MONTH(at_dob.value) = $month AND DAY(at_dob.value) = $day"; - $collection->addAttributeToFilter('dob', array('neq' => 'null')) - ->addFieldToFilter('store_id', array('eq' => $storeId)); + $collection->addAttributeToFilter('dob', array('neq' => 'null')); + $defaultStore = Mage::app()->getStore($storeId)->getWebsite()->getDefaultStore(); + $normalFilter = array('eq' => $storeId); + if($storeId == $defaultStore->getId()){ + $newFilter = array('eq' => '0'); + $collection->addFieldToFilter('store_id', array($normalFilter, $newFilter)); + }else{ + $collection->addFieldToFilter('store_id', $normalFilter); + } + if (count($customerGroups)) { $collection->addFieldToFilter('group_id', array('in' => $customerGroups)); } @@ -203,7 +211,14 @@ protected function _processNoActivity($storeId) if (count($customerGroups)) { $collection->addFieldToFilter('group_id', array('in' => $customerGroups)); } - $collection->addFieldToFilter('store_id', array('eq' => $storeId)); + $defaultStore = Mage::app()->getStore($storeId)->getWebsite()->getDefaultStore(); + $normalFilter = array('eq' => $storeId); + if($storeId == $defaultStore->getId()){ + $newFilter = array('eq' => '0'); + $collection->addFieldToFilter('store_id', array($normalFilter, $newFilter)); + }else{ + $collection->addFieldToFilter('store_id', $normalFilter); + } foreach ($collection as $customer) { $customerId = $customer->getEntityId(); @@ -439,9 +454,9 @@ protected function _processWishlist($storeId) ->addFieldToFilter('main_table.store_id', array('eq' => $storeId)) ->setOrder('main_table.wishlist_id'); $wishlist_ant = -1; - $wishlistId = $collection->getFirstItem()->getWishlistId(); $products = array(); foreach ($collection as $item) { + $wishlistId = $item->getWishlistId(); if ($wishlistId != $wishlist_ant) { if ($wishlist_ant != -1 && count($products) > 0) { $translate = Mage::getSingleton('core/translate'); @@ -474,7 +489,6 @@ protected function _processWishlist($storeId) } $wishlist_ant = $wishlistId; - $wishlistId = $item->getWishlistId(); $wishlist = Mage::getModel('wishlist/wishlist')->load($wishlistId); $customer = Mage::getModel('customer/customer')->load($wishlist->getCustomerId()); $products = array(); @@ -862,15 +876,17 @@ public function cleanupBackToStock() protected function _createNewCoupon($store, $email, $string) { + $websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId(); $collection = Mage::getModel('salesrule/rule')->getCollection() - ->addFieldToFilter('name', array('like' => $string . $email)); + ->addFieldToFilter('name', array('like' => $string . $email)) + ->addFieldToFilter('website_ids', array('eq' => $websiteid)); + if (!count($collection)) { $couponamount = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT, $store); $couponexpiredays = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_EXPIRE, $store); $coupontype = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_DISCOUNT_TYPE, $store); $couponlength = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_LENGTH, $store); $couponlabel = Mage::getStoreConfig(Ebizmarts_Autoresponder_Model_Config::BIRTHDAY_COUPON_LABEL, $store); - $websiteid = Mage::getModel('core/store')->load($store)->getWebsiteId(); $fromDate = date("Y-m-d"); $toDate = date('Y-m-d', strtotime($fromDate . " + $couponexpiredays day")); diff --git a/app/code/community/Ebizmarts/Autoresponder/etc/config.xml b/app/code/community/Ebizmarts/Autoresponder/etc/config.xml index 13dcbce2..f26d7c10 100755 --- 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.2.1.1 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 index 793abf5a..9bce39a7 100755 --- 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 @@ -22,12 +22,15 @@ PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; "); - -$installer->run(" +try { + $installer->run(" ALTER TABLE `{$this->getTable('magemonkey_mails_sent')}` CHANGE `mail_type` `mail_type` ENUM( 'abandoned cart', 'happy birthday', 'new order', 'related products', 'product review', 'no activity', 'wishlist', 'review coupon' ) CHARACTER SET utf8 NOT NULL; "); +}catch (Exception $e){ + +} $installer->addAttribute( 'customer', 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 index 46c9b187..0eb6cb3d 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/UpgradeForPatch.php +++ b/app/code/community/Ebizmarts/MageMonkey/Block/Adminhtml/System/Config/UpgradeForPatch.php @@ -54,10 +54,11 @@ protected function tableExists(){ }else{ $pre = ''; } - $resource = Mage::getSingleton('core/resource'); + $resource = Mage::getSingleton('core/resource') + ->getConnection('core_write'); $table = $resource->getTableName($pre.'permission_block'); - $tableExists = (bool)$resource->getConnection()->showTableStatus($table); + $tableExists = (bool)$resource->showTableStatus($table); return $tableExists; } } \ No newline at end of file diff --git a/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php b/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php index 3d29de0e..a3838506 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php +++ b/app/code/community/Ebizmarts/MageMonkey/Helper/Data.php @@ -196,15 +196,22 @@ public function config($value, $store = null) $store = is_null($store) ? Mage::app()->getStore() : $store; $configscope = Mage::app()->getRequest()->getParam('store'); + $ret = null; if ($configscope && ($configscope !== 'undefined') && !is_array($configscope)) { if (is_array($configscope) && isset($configscope['code'])) { $store = $configscope['code']; } else { $store = $configscope; } + $storeExists = Mage::getModel('core/store')->load($store); + if ($storeExists->getId()) { + $ret = Mage::getStoreConfig("monkey/general/$value", $storeExists->getId()); + } } - - return Mage::getStoreConfig("monkey/general/$value", $store); + if(!$ret){ + $ret = Mage::getStoreConfig("monkey/general/$value", $store); + } + return $ret; } /** @@ -266,9 +273,19 @@ public function useTransactionalService() * * @return bool */ - public function canMonkey() + public function canMonkey($stores = null) { - return (bool)((int)$this->config('active') !== 0); + $ret = false; + if(is_array($stores)){ + foreach($stores as $store){ + if((bool)((int)$this->config('active', $store) !== 0)){ + $ret = true; + } + } + }else{ + $ret = (bool)((int)$this->config('active') !== 0); + } + return $ret; } /** @@ -670,17 +687,18 @@ public function mergeVars($object = NULL, $includeEmail = FALSE, $currentList = } protected function _checkGrouping($post,$currentList, $object) { + $storeId = Mage::app()->getStore()->getId() ? Mage::app()->getStore()->getId() : $object->getStoreId(); $mergeVars = array(); $request = Mage::app()->getRequest(); $adminSubscription = $request->getActionName() == 'save' && $request->getControllerName() == 'customer' && $request->getModuleName() == (string)Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName'); $footerSubscription = $request->getActionName() == 'new' && $request->getControllerName() == 'subscriber' && $request->getModuleName() == 'newsletter'; $customerSubscription = $request->getActionName() == 'saveadditional'; $customerCreateAccountSubscription = $request->getActionName() == 'createpost'; - if ($post && !$adminSubscription && !$customerSubscription && !$customerCreateAccountSubscription || Mage::getSingleton('core/session')->getIsOneStepCheckout()) { + if ($post && !$adminSubscription || Mage::getSingleton('core/session')->getIsOneStepCheckout()) { $defaultList = Mage::helper('monkey')->config('list'); //if can change customer set the groups set by customer else set the groups on MailChimp config - $canChangeGroups = Mage::getStoreConfig('monkey/general/changecustomergroup', $object->getStoreId()); - if ($currentList && ($currentList != $defaultList || $canChangeGroups && !$footerSubscription) && isset($post['list'][$currentList])) { + $canChangeGroups = Mage::getStoreConfig('monkey/general/changecustomergroup', $storeId); + if (!$customerCreateAccountSubscription && $currentList && ($currentList != $defaultList || $canChangeGroups && !$footerSubscription) && isset($post['list'][$currentList])) { $subscribeGroups = array(0 => array()); foreach ($post['list'][$currentList] as $toGroups => $value) { if (is_numeric($toGroups)) { @@ -690,12 +708,13 @@ protected function _checkGrouping($post,$currentList, $object) } $groups = NULL; } elseif ($currentList == $defaultList) { - $groups = Mage::getStoreConfig('monkey/general/cutomergroup', $object->getStoreId()); + $groups = Mage::getStoreConfig('monkey/general/cutomergroup', $storeId); $groups = explode(",", $groups); if (isset($groups[0]) && $groups[0]) { $subscribeGroups = array(); $_prevGroup = null; $checkboxes = array(); + $currentGroup = ''; foreach ($groups as $group) { $item = explode("_", $group); if ($item[0]) { @@ -703,22 +722,25 @@ protected function _checkGrouping($post,$currentList, $object) if ($currentGroup == $_prevGroup || $_prevGroup == null) { $checkboxes[] = $item[1]; $_prevGroup = $currentGroup; - } else { - $subscribeGroups[] = array('id' => $_prevGroup, "groups" => str_replace('%C%', '\\,', implode(', ', $checkboxes))); + } elseif($checkboxes && isset($item[1])) { + $subscribeGroups[] = array('id' => $_prevGroup, "groups" => str_replace('%C%', '\\,', implode(', ', $checkboxes))); + $checkboxes = array(); + $_prevGroup = $currentGroup; + $checkboxes[] = $item[1]; + }else{ $checkboxes = array(); - $_prevGroup = $currentGroup; - $checkboxes[] = $item[1]; + $_prevGroup = null; } } } - if ($currentGroup) { + if ($currentGroup && $checkboxes) { $subscribeGroups[] = array('id' => $currentGroup, "groups" => str_replace('%C%', '\\,', implode(', ', $checkboxes))); } } - $force = Mage::getStoreConfig('monkey/general/checkout_subscribe', $object->getStoreId()); - $map = Mage::getStoreConfig('monkey/general/markfield', $object->getStoreId()); + $force = Mage::getStoreConfig('monkey/general/checkout_subscribe', $storeId); + $map = Mage::getStoreConfig('monkey/general/markfield', $storeId); if (isset($post['magemonkey_subscribe']) && $map != "") { $listsChecked = explode(',', $post['magemonkey_subscribe']); $hasClicked = in_array($currentList, $listsChecked); @@ -738,7 +760,7 @@ protected function _checkGrouping($post,$currentList, $object) $mergeVars[$map] = "No"; } } else { - $map = Mage::getStoreConfig('monkey/general/markfield', $object->getStoreId()); + $map = Mage::getStoreConfig('monkey/general/markfield', $storeId); $mergeVars[$map] = "Yes"; } if (isset($subscribeGroups[0]['id']) && $subscribeGroups[0]['id'] != -1) { @@ -943,7 +965,7 @@ public function subscribeToList($object, $db, $listId = NULL, $forceSubscribe = } $alreadySubscribed = Mage::getSingleton('newsletter/subscriber')->loadByEmail($email); if ($listId == $defaultList && !Mage::getSingleton('core/session')->getIsHandleSubscriber() && !$forceSubscribe && (!$alreadySubscribed || !$alreadySubscribed->getId())) { - $subscriber->subscribe($email); + $subscriber->setStoreId($storeId)->subscribe($email); } else { $alreadyOnList = Mage::getSingleton('monkey/asyncsubscribers')->getCollection() ->addFieldToFilter('lists', $listId) @@ -1110,10 +1132,10 @@ public function handlePost($request, $guestEmail) $customer->setMcListId($listId); $customer->setListGroups($groupings); - $mergeVars = Mage::helper('monkey')->getMergeVars($customer); + $mergeVars = Mage::helper('monkey')->mergeVars($customer, FALSE, $listId); //Handle groups update - $api->listUpdateMember($listId, $email, $mergeVars); + $api->listUpdateMember($listId, $email, $mergeVars, 'html' ,false); Mage::getSingleton('core/session') ->addSuccess($this->__('Your profile has been updated!')); diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php b/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php index a449686d..ce1d2115 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Cron.php @@ -429,15 +429,12 @@ public function sendordersAsync() { $collection = Mage::getModel('monkey/asyncorders')->getCollection(); $collection->addFieldToFilter('processed', array('eq' => 0)); - $storeId = null; foreach ($collection as $item) { $info = (array)unserialize($item->getInfo()); $orderId = $info['order_id']; unset($info['order_id']); - if ($storeId != $info['store_id']) { - $api = Mage::getSingleton('monkey/api', array('store' => $info['store_id'])); - $storeId = $info['store_id']; - } + $storeId = $info['store_id']; + $api = Mage::getSingleton('monkey/api', array('store' => $storeId)); if (isset($info['campaign_id'])) { $api->campaignEcommOrderAdd($info); } else { diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php b/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php index f64f7092..a8df8d67 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Ecommerce360.php @@ -93,23 +93,29 @@ public function run(Varien_Event_Observer $observer) { $storeId = Mage::app()->getStore()->getId(); $order = $observer->getEvent()->getOrder(); - $customerEmail = $order->getCustomerEmail(); - $collection = Mage::getModel('monkey/lastorder')->getCollection() - ->addFieldToFilter('email', array('eq' => $customerEmail)); - if(count($collection) > 0){ - //When saving the new date is automatically placed. - $item = $collection->getFirstItem(); - $item->save(); - }else{ - Mage::getModel('monkey/lastorder') - ->setEmail($customerEmail) - ->save(); - } - if ((($this->_getCampaignCookie() && - $this->_getEmailCookie()) || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) == 2 || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) == 3) && - $this->isActive() - ) { - $this->logSale($order); + if (is_object($order) && $order->getId()) { + //Set Campaign Id if exist + $campaign_id = Mage::getModel('monkey/ecommerce360')->getCookie()->get('magemonkey_campaign_id'); + if ($campaign_id && $order->getEbizmartsMagemonkeyCampaignId() == null) { + $order->setEbizmartsMagemonkeyCampaignId($campaign_id)->save(); + } + $customerEmail = $order->getCustomerEmail(); + $collection = Mage::getModel('monkey/lastorder')->getCollection() + ->addFieldToFilter('email', array('eq' => $customerEmail)); + if (count($collection) > 0) { + //When saving the new date is automatically placed. + $item = $collection->getFirstItem(); + $item->save(); + } else { + Mage::getModel('monkey/lastorder') + ->setEmail($customerEmail) + ->save(); + } + if ((Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) == 2 || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ACTIVE, $storeId) == 1) && + $this->isActive() + ) { + $this->logSale($order); + } } return $observer; } @@ -154,9 +160,13 @@ public function logSale($order) $this->setItemstoSend($this->_order->getStoreId()); $rs = false; + $email = null; + $campaignId = null; if ($emailCookie && $campaignCookie) { $this->_info ['email_id'] = $emailCookie; $this->_info ['campaign_id'] = $campaignCookie; + $email = $emailCookie; + $campaignId = $campaignCookie; if (Mage::getStoreConfig('monkey/general/checkout_async')) { $collection = Mage::getModel('monkey/asyncorders')->getCollection(); $alreadyOnDb = false; @@ -182,7 +192,8 @@ public function logSale($order) $rs = $api->campaignEcommOrderAdd($this->_info); } } else { - $this->_info ['email'] = $this->_order->getCustomerEmail(); + $email = $this->_order->getCustomerEmail(); + $this->_info ['email'] = $email; if (Mage::getStoreConfig('monkey/general/checkout_async')) { $collection = Mage::getModel('monkey/asyncorders')->getCollection(); $alreadyOnDb = false; @@ -209,7 +220,7 @@ public function logSale($order) } if ($rs === TRUE) { - $this->_logCall(); + $this->_logCall($email, $campaignId); return true; } else { return $rs; @@ -273,7 +284,7 @@ private function setItemstoSend($storeId) // } } $mcitem['category_name'] = (count($names)) ? implode(" - ", $names) : 'None'; - if(!$mcitem['category_id']) { + if(!isset($mcitem['category_id'])) { $mcitem['category_id'] = 0; } $mcitem['qty'] = $item->getQtyOrdered(); @@ -310,13 +321,13 @@ protected function _getCampaignCookie() * * @return Ebizmarts_MageMonkey_Model_Ecommerce */ - protected function _logCall() + protected function _logCall($email, $campaignCookie = null) { return Mage::getModel('monkey/ecommerce') ->setOrderIncrementId($this->_order->getIncrementId()) ->setOrderId($this->_order->getId()) - ->setMcCampaignId($this->_getCampaignCookie()) - ->setMcEmailId($this->_getEmailCookie()) + ->setMcCampaignId($campaignCookie) + ->setMcEmailId($email) ->setCreatedAt(Mage::getModel('core/date')->gmtDate()) ->setStoreId($this->_order->getStoreId()) ->save(); diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php b/app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php index 12f7cd91..c8c91f7f 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Feed/Updates.php @@ -111,7 +111,7 @@ protected function _getUpdates($resource) foreach ($node->xpath('items/item') as $item) { - if(!isset($item->date_end) || (time() - strtotime($item->date_end)) < 0) { + if(isset($item->date_end) && (time() - strtotime($item->date_end)) > 0) { $feedData[] = array( 'severity' => (string)$item->severity, 'date_added' => (string)$item->created_at, diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php b/app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php index 3613f7aa..b61f7205 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/MCAPI.php @@ -58,7 +58,7 @@ class Ebizmarts_MageMonkey_Model_MCAPI function __construct($apikey, $secure = false) { $this->secure = $secure; - $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php"); + $this->apiUrl = parse_url("https://api.mailchimp.com/" . $this->version . "/?output=php"); $this->api_key = $apikey; } diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php b/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php index 9ba951bb..f2611b33 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Monkey.php @@ -27,8 +27,11 @@ 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); - +// $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); @@ -215,6 +218,9 @@ protected function _unsubscribe(array $data) 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' : @@ -222,11 +228,11 @@ protected function _unsubscribe(array $data) if (Mage::getStoreConfig("monkey/general/webhook_delete") == 1) { $subscriber->delete(); } else { - $subscriber->setImportMode(TRUE)->unsubscribe(); + $subscriber->unsubscribe(); } break; case 'unsub': - $subscriber->setImportMode(TRUE)->unsubscribe(); + $subscriber->unsubscribe(); break; } } catch (Exception $e) { diff --git a/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php b/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php index 4e24c7b7..c03d58b9 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/Observer.php @@ -170,10 +170,11 @@ public function saveConfig(Varien_Event_Observer $observer) } + $additionalLists = null; if (isset($post['groups']['general']['fields']['additional_lists']['value'])) { $additionalLists = $post['groups']['general']['fields']['additional_lists']['value']; } else { - if ((string)$post['groups']['general']['fields']['additional_lists']['inherit'] == 1) { + if (isset($post['groups']['general']['fields']['additional_lists']['inherit']) && (string)$post['groups']['general']['fields']['additional_lists']['inherit'] == 1) { $additionalLists = Mage::helper('monkey')->getAdditionalList(Mage::app()->getStore()->getId()); } } @@ -292,7 +293,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' || Mage::getSingleton('core/session')->getIsOneStepCheckout() || Mage::getSingleton('core/session')->getMonkeyCheckout(); + $isCheckout = $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) @@ -369,13 +370,12 @@ public function registerCheckoutSubscribe(Varien_Event_Observer $observer) $force = Mage::app()->getRequest()->getPost('magemonkey_force'); Mage::getSingleton('core/session')->setMonkeyPost(serialize(Mage::app()->getRequest()->getPost())); - if (!is_null($subscribe) || !is_null($force)) { + if (!is_null($subscribe) || Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CHECKOUT_SUBSCRIBE) >= 3) { Mage::getSingleton('core/session')->setMonkeyCheckout(true); } } if ($oneStep) { Mage::getSingleton('core/session')->setIsOneStepCheckout(true); - Mage::getSingleton('core/session')->setMonkeyCheckout(true); } return $observer; } @@ -428,7 +428,9 @@ public function registerCheckoutSuccess(Varien_Event_Observer $observer) ->setEmail($order->getCustomerEmail()); } - Mage::helper('monkey')->listsSubscription($toSubscribe, $saveOnDb); + if(Mage::getSingleton('core/session')->getMonkeyCheckout() || Mage::getSingleton('core/session')->getIsOneStepCheckout()) { + Mage::helper('monkey')->listsSubscription($toSubscribe, $saveOnDb); + } } Mage::getSingleton('core/session')->setMonkeyCheckout(FALSE); @@ -445,7 +447,8 @@ public function registerCheckoutSuccess(Varien_Event_Observer $observer) */ public function massActionOption(Varien_Event_Observer $observer) { - if (!Mage::helper('monkey')->canMonkey()) { + $stores = Mage::app()->getStores(); + if (!Mage::helper('monkey')->canMonkey($stores)) { return $observer; } $block = $observer->getEvent()->getBlock(); 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 index f7428764..1638bb0c 100755 --- a/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php +++ b/app/code/community/Ebizmarts/MageMonkey/Model/System/Config/Source/List.php @@ -46,7 +46,7 @@ public function toOptionArray() $lists = array(); if (is_array($this->_lists)) { - + $lists[] = array('value' => '', 'label' => Mage::helper('monkey')->__('--- Select a list ---')); foreach ($this->_lists['data'] as $list) { $lists [] = array('value' => $list['id'], 'label' => $list['name'] . ' (' . $list['stats']['member_count'] . ' ' . Mage::helper('monkey')->__('members') . ')'); } diff --git a/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php b/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php index d70351ca..1deb5b2b 100755 --- a/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php +++ b/app/code/community/Ebizmarts/MageMonkey/controllers/Adminhtml/ConfigController.php @@ -13,7 +13,7 @@ public function getGroupsAction() { $params = $this->getRequest()->getParams(); $listId = $params['list']; - if (isset($params['store'])) { + if (isset($params['store']) && $params['store']) { $store = $params['store']; $store = $this->_getStoreByCode($store); $storeId = $store->getId(); @@ -22,7 +22,7 @@ public function getGroupsAction() } $originalGroups = Mage::getStoreConfig('monkey/general/cutomergroup', $storeId); $originalGroups = explode(",", $originalGroups); - $groups = Mage::getSingleton('monkey/api')->listInterestGroupings($listId); + $groups = Mage::getModel('monkey/api', array('store' => $storeId))->listInterestGroupings($listId); $rc = array(); if (is_array($groups)) { foreach ($groups as $group) { @@ -81,9 +81,8 @@ public function upgradeForPatchAction(){ protected function _getStoreByCode($storeCode) { - $stores = array_keys(Mage::app()->getStores()); - foreach ($stores as $id) { - $store = Mage::app()->getStore($id); + $stores = Mage::app()->getStores(); + foreach ($stores as $store) { if ($store->getCode() == $storeCode) { return $store; } @@ -94,6 +93,7 @@ protected function _getStoreByCode($storeCode) protected function _isAllowed() { switch ($this->getRequest()->getActionName()) { case 'getGroups': + case 'upgradeForPatch': $acl = 'system/config/monkey'; break; } diff --git a/app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml b/app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml index a25ab043..6f4c9bc9 100755 --- a/app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml +++ b/app/code/community/Ebizmarts/MageMonkey/etc/adminhtml.xml @@ -9,10 +9,6 @@ Ecommerce 360 Orders - - Magento sent orders - adminhtml/ecommerce - ALL orders from API adminhtml/ecommerce/apiorders diff --git a/app/code/community/Ebizmarts/MageMonkey/etc/config.xml b/app/code/community/Ebizmarts/MageMonkey/etc/config.xml index 0113c056..bbe6849b 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.2 + 1.2.3 @@ -143,14 +143,14 @@ - + monkey/observer registerCheckoutSubscribe - + diff --git a/app/code/community/Ebizmarts/Mandrill/Model/Email/Queue.php b/app/code/community/Ebizmarts/Mandrill/Model/Email/Queue.php index 2bc2f51b..45e37d37 100644 --- a/app/code/community/Ebizmarts/Mandrill/Model/Email/Queue.php +++ b/app/code/community/Ebizmarts/Mandrill/Model/Email/Queue.php @@ -32,25 +32,25 @@ public function send() if ($message->getId()) { $parameters = new Varien_Object($message->getMessageParameters()); $mailer = $this->getMail(); - $mandrill = [ + $mandrill = array( 'subject' => $parameters->getSubject(), - 'to' => [], + 'to' => array(), 'from_email' => $parameters->getFromEmail(), 'from_name' => $parameters->getFromName(), 'headers' => $mailer->getHeaders(), 'html' => ($parameters->getIsPlain() ? "" : $message->getMessageBody()), 'text' => ($parameters->getIsPlain() ? $message->getMessageBody() : ""), - ]; + ); foreach ($message->getRecipients() as $recipient) { list($email, $name, $type) = $recipient; - $mandrill['to'][] = [ + $mandrill['to'][] = array( 'type' => ($type == self::EMAIL_TYPE_BCC ? "bcc" : "to"), 'email' => $email, 'name' => $name - ]; + ); } if ($parameters->getReplyTo() !== null) { - $mandrill['headers'] = array_merge($mandrill['headers'], ['Reply-To' => $parameters->getReplyTo()]); + $mandrill['headers'] = array_merge($mandrill['headers'], array('Reply-To' => $parameters->getReplyTo())); } if ($parameters->getReturnTo() !== null) { $mailer->setReturnPath($parameters->getReturnTo()); diff --git a/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php b/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php index 45da21be..578c19b7 100755 --- a/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php +++ b/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php @@ -82,6 +82,20 @@ public function send($email, $name = null, array $variables = array()) $email['from_name'] = $this->getSenderName(); $email['from_email'] = $this->getSenderEmail(); + $mandrillSenders = $mail->senders->domains(); + $senderExists = false; + foreach ($mandrillSenders as $sender) + { + $emailAddress = $sender['domain']; + if($email['from_email'] == $sender['domain']) + { + $senderExists = true; + } + } + if(!$senderExists) + { + $email['from_email'] = Mage::getStoreConfig('trans_email/ident_general/email'); + } $headers = $mail->getHeaders(); $headers[] = Mage::helper('ebizmarts_mandrill')->getUserAgent(); $email['headers'] = $headers; diff --git a/app/code/community/Ebizmarts/Mandrill/etc/config.xml b/app/code/community/Ebizmarts/Mandrill/etc/config.xml index 205a6c36..9ef05d56 100755 --- a/app/code/community/Ebizmarts/Mandrill/etc/config.xml +++ b/app/code/community/Ebizmarts/Mandrill/etc/config.xml @@ -2,7 +2,7 @@ - 2.0.8 + 2.0.9 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 index 096622cc..5b45344e 100755 --- a/app/design/adminhtml/default/default/template/magemonkey/system/config/resetlocal360.phtml +++ b/app/design/adminhtml/default/default/template/magemonkey/system/config/resetlocal360.phtml @@ -16,7 +16,7 @@ } function reloadGroups(evt) { var $list = $('monkey_general_list').getValue(); - var $url = "getUrl('adminhtml/config/getGroups'); ?>" + "list/" + $list; + var $url = "getUrl('adminhtml/config/getGroups'); ?>" + "list/" + $list + '/store/' + "getRequest()->getParam('store'); ?>"; new Ajax.Request($url, { method: 'get', onSuccess: function (transport) { 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 index 5d0e64f6..99f010fa 100755 --- a/app/design/adminhtml/default/default/template/magemonkey/system/config/upgradeforpatch.phtml +++ b/app/design/adminhtml/default/default/template/magemonkey/system/config/upgradeforpatch.phtml @@ -28,12 +28,15 @@ if($this->tableExists()) { array('block_name' => 'ebizmarts_autoresponder/email_wishlist_items', 'is_allowed' => 1), ); foreach($blocks as $item){ - $rowExists = Mage::getResourceModel('admin/block_collection') - ->addFieldToFilter('block_name', array('eq' => $item['block_name'])); - $row = $rowExists->getFirstItem(); - if(!$row->getBlockId()){ - echo $this->getButtonHtml(); - return; + $rowExists = Mage::getResourceModel('admin/block_collection'); + if(is_object($rowExists)) { + $rowExists->addFieldToFilter('block_name', array('eq' => $item['block_name'])); + + $row = $rowExists->getFirstItem(); + if (!$row->getBlockId()) { + echo $this->getButtonHtml(); + return; + } } } }?> \ No newline at end of file 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 index 39d49f81..e0061276 100755 --- 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 @@ -44,6 +44,7 @@ $_quote = $this->getQuote(); $bundled_items = array(); $label = ''; $qty = ''; + $aux_options = array(); foreach ($selectionCollection as $option) { foreach ($options['bundle_options'] as $bundle) { if ($bundle['value'][0]['title'] == $option->getName()) { diff --git a/app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml b/app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml index 213426da..e679ad6d 100755 --- a/app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml +++ b/app/design/frontend/base/default/template/magemonkey/checkout/subscribe.phtml @@ -11,8 +11,9 @@ $force = $this->getForce(); //save old clicked lists and then removes element var subscribeValue = ''; + var checkedLists = ''; if ($('magemonkey-subscribe')) { - var checkedLists = $('magemonkey-subscribe').getValue(); + checkedLists = $('magemonkey-subscribe').getValue(); subscribeValue = checkedLists + ','; $('magemonkey-subscribe').remove(); } @@ -68,7 +69,7 @@ $force = $this->getForce(); } - } + }; addGroupToPost = function (element) { if (element.checked) { @@ -90,7 +91,7 @@ $force = $this->getForce(); $("subscribe" + element.readAttribute('id')).remove(); } } - } + }; addElementToPost = function (element) { var formInputId = element.readAttribute('id') + '-serialize'; if ($(formInputId)) { @@ -106,7 +107,7 @@ $force = $this->getForce(); Element.insert(Form.findFirstElement(payment.form), inp); - } + };
style="display:none;"> @@ -267,4 +268,4 @@ $force = $this->getForce(); addGroupToPost(group); }); }); - \ No newline at end of file + diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/backtostock.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/backtostock.html index 21fca473..0c1766c4 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/backtostock.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/backtostock.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html index 117854d2..ab2bd9bf 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/birthday.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html index 64e1dcd4..ad2e1b6e 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/neworder.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html index 91aba03c..f2abe9da 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/noactivity.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

Our system detect you have no activity since {{var lastlogin}} diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/reviewcoupon.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/reviewcoupon.html index f014f82e..9afac91b 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/reviewcoupon.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/reviewcoupon.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/visitedproducts.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/visitedproducts.html index 992dd31b..17efcbb1 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/visitedproducts.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/visitedproducts.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

Browsed products. diff --git a/app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html b/app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html index b5202abd..771a3d53 100755 --- a/app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html +++ b/app/locale/en_US/template/email/ebizmarts/autoresponder/wishlist.html @@ -14,7 +14,7 @@ -

Hello, +

Hello, {{htmlescape var=$name}}

Thanks for adding new products to your wishlist. diff --git a/js/ebizmarts/autoresponders/visitedproducts.js b/js/ebizmarts/autoresponders/visitedproducts.js index fa88286d..0831c537 100755 --- a/js/ebizmarts/autoresponders/visitedproducts.js +++ b/js/ebizmarts/autoresponders/visitedproducts.js @@ -4,7 +4,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * */ -(function () { +;(function () { function markVisited(productID) { new Ajax.Request('/ebizautoresponder/autoresponder/markVisitedProducts?product_id=' + productID, { method: 'get', diff --git a/js/ebizmarts/autoresponders/visitedproductsstorecodes.js b/js/ebizmarts/autoresponders/visitedproductsstorecodes.js index d2f9d141..109e4119 100755 --- a/js/ebizmarts/autoresponders/visitedproductsstorecodes.js +++ b/js/ebizmarts/autoresponders/visitedproductsstorecodes.js @@ -4,7 +4,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * */ -(function () { +;(function () { function getUrl() { var path = window.location.toString(); var myUrl = path.split('/') diff --git a/js/ebizmarts/magemonkey/campaignCatcher.js b/js/ebizmarts/magemonkey/campaignCatcher.js index b93932c2..0c2b7575 100755 --- a/js/ebizmarts/magemonkey/campaignCatcher.js +++ b/js/ebizmarts/magemonkey/campaignCatcher.js @@ -1,7 +1,7 @@ function getCampaign() { var params = location.search.substr(1).split('&'); - var cookies = []; + var cookies = new Array(); for (var i = 0; i < params.length; i++) { var cookie = params[i].split('='); var key = cookie[0]; diff --git a/lib/Mandrill/Mandrill.php b/lib/Mandrill/Mandrill.php index 0dadd9ef..24fb41da 100755 --- a/lib/Mandrill/Mandrill.php +++ b/lib/Mandrill/Mandrill.php @@ -86,7 +86,9 @@ public function __construct($apikey = null) $this->ch = curl_init(); curl_setopt($this->ch, CURLOPT_USERAGENT, 'Mandrill-PHP/1.0.53'); curl_setopt($this->ch, CURLOPT_POST, true); - curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); + if (!ini_get('open_basedir')) { + curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); + } curl_setopt($this->ch, CURLOPT_HEADER, false); curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 30);