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

Commit

Permalink
Merge branch 'santisp_dev' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiagoebizmarts committed Aug 10, 2016
2 parents 4402621 + cae6ddc commit ea659f1
Show file tree
Hide file tree
Showing 353 changed files with 700 additions and 408 deletions.
Empty file modified README.md
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/AbandonedCart/Helper/Data.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/AbandonedCart/Model/Abtesting.php
100755 → 100644
Empty file.
1 change: 0 additions & 1 deletion app/code/community/Ebizmarts/AbandonedCart/Model/Config.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions app/code/community/Ebizmarts/AbandonedCart/Model/Cron.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
Expand All @@ -344,6 +344,7 @@ protected function _proccessCollection($quote, $storeId)
$quote->removeItem($item->getId());
}
}
return $quote;
}
protected function _sendPopupCoupon($storeId)
{
Expand Down
Empty file.
Empty file modified app/code/community/Ebizmarts/AbandonedCart/Model/Mailssent.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/AbandonedCart/Model/Popup.php
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
14 changes: 0 additions & 14 deletions app/code/community/Ebizmarts/AbandonedCart/controllers/AbandonedController.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -71,24 +67,14 @@ 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);
} else {
Mage::getSingleton('customer/session')->addNotice("Login to complete your order");
$this->_redirect('customer/account');
}
}
}
}
}
// $this->_redirect('checkout/cart');
}
Expand Down
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/AbandonedCart/etc/adminhtml.xml
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion app/code/community/Ebizmarts/AbandonedCart/etc/config.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<config>
<modules>
<Ebizmarts_AbandonedCart>
<version>1.2.2.1</version>
<version>1.2.3</version>
</Ebizmarts_AbandonedCart>
</modules>
<global>
Expand Down
13 changes: 0 additions & 13 deletions app/code/community/Ebizmarts/AbandonedCart/etc/system.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,6 @@
<active>1</active>
</depends>
</customer>
<autologin translate="label comment">
<label>Auto Login link</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>65</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment><![CDATA[The client will be autologed when click on mail link]]></comment>
<depends>
<active>1</active>
</depends>
</autologin>
</fields>
</general>
<coupon>
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/Autoresponder/Helper/Data.php
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/Autoresponder/Model/Config.php
100755 → 100644
Empty file.
9 changes: 8 additions & 1 deletion app/code/community/Ebizmarts/Autoresponder/Model/Cron.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/Autoresponder/Model/Review.php
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
*
* @category Ebizmarts
* @package Ebizmarts_Autoresponder
* @author Ebizmarts Team <[email protected]>
* @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;
}
}
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/Autoresponder/Model/Visited.php
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/Autoresponder/etc/adminhtml.xml
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion app/code/community/Ebizmarts/Autoresponder/etc/config.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<config>
<modules>
<Ebizmarts_Autoresponder>
<version>1.2.1.1</version>
<version>1.2.2</version>
</Ebizmarts_Autoresponder>
</modules>
<global>
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ebizmarts/Autoresponder/etc/system.xml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@
<customer_coupon translate="label comment">
<label>Customer Groups for coupon</label>
<frontend_type>multiselect</frontend_type>
<source_model>ebizmarts_autoresponder/system_config_customergroup</source_model>
<source_model>ebizmarts_autoresponder/system_config_registeredcustomergroup</source_model>
<sort_order>110</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Block/Lists.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Block/Signup.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Helper/Cache.php
100755 → 100644
Empty file.
108 changes: 81 additions & 27 deletions app/code/community/Ebizmarts/MageMonkey/Helper/Data.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

}
Expand All @@ -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();
Expand All @@ -964,28 +1015,29 @@ 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)
->addFieldToFilter('email', $email)
->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;
}
Expand All @@ -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);
}
}
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
Empty file modified app/code/community/Ebizmarts/MageMonkey/Helper/Export.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Helper/Oauth2.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Model/Api.php
100755 → 100644
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Model/Asyncorders.php
100755 → 100644
Empty file.
Empty file.
22 changes: 22 additions & 0 deletions app/code/community/Ebizmarts/MageMonkey/Model/Asyncwebhooks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Author : Ebizmarts <[email protected]>
* 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');
}
}
Empty file.
Empty file.
Empty file modified app/code/community/Ebizmarts/MageMonkey/Model/Cache.php
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions app/code/community/Ebizmarts/MageMonkey/Model/Config.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading

0 comments on commit ea659f1

Please sign in to comment.