Rejoiner - Version 1.0.9

Version Notes

Added functionality to generate discount coupon code for abandoned transactions.

Download this release

Release Info

Developer Magento Core Team
Extension Rejoiner
Version 1.0.9
Comparing to
See all releases


Version 1.0.9

app/code/community/Rejoiner/Acr/Block/Adminhtml/Notification.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Block to check overriding for checkout by other extensions and show warning message
5
+ *
6
+ * @category Rejoiner
7
+ * @package Rejoiner_Acr
8
+ */
9
+ class Rejoiner_Acr_Block_Adminhtml_Notification extends Mage_Core_Block_Template
10
+ {
11
+
12
+ public function canShow()
13
+ {
14
+ if (Rejoiner_Acr_Model_Notification::isNotificationViewed()) {
15
+ return false;
16
+ }
17
+
18
+ if ($this->_isCoreCheckoutControllerOverridden()
19
+ || $this->_isCoreCheckoutUrlHelperOverridden()
20
+ ) {
21
+ return true;
22
+ }
23
+
24
+ return false;
25
+ }
26
+
27
+ protected function _isCoreCheckoutControllerOverridden()
28
+ {
29
+ $frontController = new Mage_Core_Controller_Varien_Front();
30
+ $frontController->init();
31
+
32
+ $standard = $frontController->getRouter('standard');
33
+
34
+ $modules = $standard->getModuleByFrontName('checkout');
35
+
36
+ return reset($modules) != 'Mage_Checkout';
37
+ }
38
+
39
+ protected function _isCoreCheckoutUrlHelperOverridden()
40
+ {
41
+ return get_class(Mage::helper('checkout/url')) != 'Mage_Checkout_Helper_Url';
42
+ }
43
+
44
+ }
app/code/community/Rejoiner/Acr/Block/Snippets.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Main block for module
5
+ *
6
+ * @category Rejoiner
7
+ * @package Rejoiner_Acr
8
+ */
9
+ class Rejoiner_Acr_Block_Snippets extends Mage_Core_Block_Template
10
+ {
11
+
12
+ public function getCartItems()
13
+ {
14
+ if ($quote = $this->_getQuote()) {
15
+ $items = array();
16
+ $mediaUrl = Mage::getBaseUrl('media');
17
+ foreach ($quote->getAllItems() as $item) {
18
+ if ($item->getParentItem()) {
19
+ continue;
20
+ }
21
+ $newItem = array();
22
+ $newItem['name'] = htmlspecialchars($item->getName());
23
+ $newItem['image_url'] = $mediaUrl . 'catalog/product' . $item->getProduct()->getThumbnail();
24
+ $newItem['price'] = (string) $this->_convertPriceToCents($item->getBaseCalculationPrice());
25
+ $newItem['product_id'] = (string) $item->getSku();
26
+ $newItem['item_qty'] = (string) $item->getQty();
27
+ $newItem['qty_price'] = (string) $this->_convertPriceToCents($item->getBaseRowTotal());
28
+ $items[] = $newItem;
29
+ }
30
+ return $items;
31
+ }
32
+ return '[]';
33
+ }
34
+
35
+ public function getCartData()
36
+ {
37
+ if ($quote = $this->_getQuote()) {
38
+ return '"totalItems":"'.$this->_getQuote()->getItemsQty().'","value":"'.$this->_convertPriceToCents($this->_getQuote()->getBaseSubtotal()).'","returnUrl":"'.Mage::helper('rejoiner_acr')->getRestoreUrl().'"';
39
+ }
40
+ return '';
41
+ }
42
+
43
+
44
+ protected function _getQuote()
45
+ {
46
+ return Mage::getSingleton('checkout/session')->getQuote();
47
+ }
48
+
49
+ protected function _convertPriceToCents($price) {
50
+ return round($price*100);
51
+ }
52
+
53
+ }
app/code/community/Rejoiner/Acr/Helper/Data.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Generic helper for module
5
+ *
6
+ * @category Rejoiner
7
+ * @package Rejoiner_Acr
8
+ */
9
+ class Rejoiner_Acr_Helper_Data extends Mage_Core_Helper_Abstract
10
+ {
11
+
12
+ const XML_PATH_REJOINER_ENABLED = 'checkout/rejoiner_acr/enabled';
13
+ const XML_PATH_REJOINER_SITE_ID = 'checkout/rejoiner_acr/site_id';
14
+ const XML_PATH_REJOINER_DOMAIN = 'checkout/rejoiner_acr/domain';
15
+ const XML_PATH_REJOINER_TRACK_NUMBERS = 'checkout/rejoiner_acr/track_numbers';
16
+ const XML_PATH_REJOINER_PERSIST_FORMS = 'checkout/rejoiner_acr/persist_forms';
17
+
18
+
19
+ public function getRejoinerSiteId()
20
+ {
21
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_SITE_ID);
22
+ }
23
+
24
+
25
+ public function getRestoreUrl()
26
+ {
27
+ $product = array();
28
+ $options = array();
29
+ if (Mage::helper('checkout/cart')->getCart()->getItems()) {
30
+ $items = Mage::helper('checkout/cart')->getCart()->getItems()->load()->getItems();
31
+ foreach ($items as $item) {
32
+ if (!$item->getParentItem()) {
33
+ $options = unserialize($item->getOptionByCode('info_buyRequest')->getValue());
34
+ $options['qty'] = $item->getQty();
35
+ $options['product'] = $item->getProductId();
36
+ $product[] = $options;
37
+ }
38
+ }
39
+ }
40
+ $url = Mage::getUrl('rejoiner/addtocart?'.http_build_query($product));
41
+ return substr($url, 0, strlen($url)-1);
42
+ }
43
+
44
+ public function getDomain()
45
+ {
46
+ $domain = trim(Mage::getStoreConfig(self::XML_PATH_REJOINER_DOMAIN));
47
+ if ($domain[0] == '.') {
48
+ return $domain;
49
+ } else {
50
+ return '.' . $domain;
51
+ }
52
+ }
53
+
54
+ public function getTrackNumberEnabled()
55
+ {
56
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_TRACK_NUMBERS);
57
+ }
58
+
59
+ public function getPersistFormsEnabled()
60
+ {
61
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_PERSIST_FORMS);
62
+ }
63
+
64
+ public function generateCouponCode()
65
+ {
66
+ $couponCode = Mage::helper('checkout/cart')->getCart()->getQuote()->getPromo();
67
+ $rule_id = Mage::getStoreConfig('checkout/rejoiner_acr/salesrule_model');
68
+ $ruleItem = Mage::getModel('salesrule/rule')
69
+ ->getCollection()
70
+ ->addFieldToFilter('rule_id', array('eq' => $rule_id))
71
+ ->getFirstItem();
72
+ if ($ruleItem->getUseAutoGeneration() && !$couponCode)
73
+ {
74
+ $couponCode = Mage::getModel('salesrule/coupon_codegenerator')->generateCode();
75
+
76
+ Mage::getModel('salesrule/coupon')
77
+ ->setRuleId($rule_id)
78
+ ->setCode($couponCode)
79
+ ->setUsageLimit(1)
80
+ ->setCreatedAt(time())
81
+ ->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)
82
+ ->save();
83
+
84
+ Mage::getSingleton('checkout/cart')
85
+ ->getQuote()
86
+ ->setPromo(strlen($couponCode) ? $couponCode : '')
87
+ ->collectTotals()
88
+ ->save();
89
+ }
90
+ return $couponCode;
91
+ }
92
+
93
+ }
app/code/community/Rejoiner/Acr/Model/Notification.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Model_Notification
4
+ {
5
+ protected static $_flagCode = 'admin_notification_rejoiner';
6
+ protected static $_flagModel = null;
7
+
8
+ /**
9
+ * Return core flag model
10
+ *
11
+ * @return Mage_Core_Model_Flag
12
+ */
13
+ protected static function _getFlagModel()
14
+ {
15
+ if (self::$_flagModel === null) {
16
+ self::$_flagModel = Mage::getModel('core/flag', array('flag_code' => self::$_flagCode))->loadSelf();
17
+ }
18
+ return self::$_flagModel;
19
+ }
20
+
21
+ /**
22
+ * Check if notification was viewed
23
+ *
24
+ * @return boolean
25
+ */
26
+ public static function isNotificationViewed()
27
+ {
28
+ $flagData = self::_getFlagModel()->getFlagData();
29
+ if (isset($flagData['notification_viewed']) && $flagData['notification_viewed'] == 1) {
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+
35
+ /**
36
+ * Save notification viewed flag in core flag
37
+ *
38
+ * @param boolean $viewed
39
+ */
40
+ public static function saveNotificationViewed()
41
+ {
42
+ self::_getFlagModel()->setFlagData(array('notification_viewed' => true))->save();
43
+ }
44
+ }
app/code/community/Rejoiner/Acr/Model/Observer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rejoiner_Acr_Model_Observer
3
+ {
4
+ public function orderSuccess(Varien_Event_Observer $observer)
5
+ {
6
+
7
+ if (Mage::getStoreConfig('checkout/rejoiner_acr/email')) {
8
+ $orders = $observer->getOrderIds();
9
+ $orderModel = Mage::getModel('sales/order')->load($orders[0]);
10
+ $customerEmail = $orderModel->getCustomerEmail();
11
+ $fromName = Mage::getStoreConfig('trans_email/ident_general/name');
12
+ $fromEmail = Mage::getStoreConfig('trans_email/ident_general/email');
13
+ $mail = Mage::getModel('core/email');
14
+ $mail->setToName('Rejoiner');
15
+ $mail->setToEmail('remove@rejoiner.com');
16
+ $mail->setBody('');
17
+ $mail->setSubject($customerEmail);
18
+ $mail->setFromEmail($fromEmail);
19
+ $mail->setFromName($fromName);
20
+ $mail->setType('html');
21
+ try {
22
+ $mail->send();
23
+ }
24
+ catch (Exception $e) {
25
+ Mage::log('Error while sending email to remove@rejoiner.com');
26
+ }
27
+ }
28
+ }
29
+ }
app/code/community/Rejoiner/Acr/Model/Resource/Setup.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
4
+ {
5
+ }
6
+
app/code/community/Rejoiner/Acr/Model/System/Config/Source/Salesrule.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Model_System_Config_Source_Salesrule {
4
+
5
+ public function toOptionArray()
6
+ {
7
+ $options = array();
8
+ $additional=array();
9
+ $additional['value'] = 'rule_id';
10
+ $additional['label'] = 'name';
11
+ $collection = Mage::getResourceModel('salesrule/rule_collection')->loadData();
12
+ foreach ($collection as $item) {
13
+ if ($item->getUseAutoGeneration()) {
14
+ foreach ($additional as $code => $field) {
15
+ $data[$code] = $item->getData($field);
16
+ }
17
+ $options[] = $data;
18
+ }
19
+
20
+ }
21
+ array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
22
+
23
+ return $options;
24
+ }
25
+
26
+ }
app/code/community/Rejoiner/Acr/controllers/AddtocartController.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: pavel
5
+ * Date: 5/16/13
6
+ * Time: 12:32 PM
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+ class Rejoiner_Acr_AddtocartController extends Mage_Core_Controller_Front_Action
10
+ {
11
+
12
+ function indexAction()
13
+ {
14
+ Mage::getSingleton('checkout/cart')->truncate();
15
+ $params = $this->getRequest()->getParams();
16
+ $cart = Mage::helper('checkout/cart')->getCart();
17
+ $params = $this->getRequest()->getParams();
18
+ foreach ($params as $product) {
19
+ if ($product) {
20
+ $prodModel = Mage::getModel('catalog/product')->load($product['product']);
21
+ $cart->addProduct($prodModel, $product);
22
+ }
23
+ }
24
+ $cart->save();
25
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
26
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart/'));
27
+ }
28
+
29
+ }
app/code/community/Rejoiner/Acr/controllers/Adminhtml/RejoinerController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Adminhtml_RejoinerController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function denyNotificationAction()
7
+ {
8
+ if ($this->getRequest()->getParam('isAjax', false)) {
9
+ Rejoiner_Acr_Model_Notification::saveNotificationViewed();
10
+ }
11
+ $this->getResponse()->setBody(Zend_Json::encode(array('deny_notification_saved' => 1)));
12
+ }
13
+
14
+ /**
15
+ * Check if user has enough privileges
16
+ *
17
+ * @return boolean
18
+ */
19
+ protected function _isAllowed()
20
+ {
21
+ return Mage::getSingleton('admin/session')->isAllowed('all');
22
+ }
23
+ }
app/code/community/Rejoiner/Acr/etc/config.xml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rejoiner_Acr>
5
+ <version>1.0.1.0</version>
6
+ </Rejoiner_Acr>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <rejoiner_acr>
11
+ <class>Rejoiner_Acr_Block</class>
12
+ </rejoiner_acr>
13
+ </blocks>
14
+ <helpers>
15
+ <rejoiner_acr>
16
+ <class>Rejoiner_Acr_Helper</class>
17
+ </rejoiner_acr>
18
+ </helpers>
19
+ <models>
20
+ <rejoiner_acr>
21
+ <class>Rejoiner_Acr_Model</class>
22
+ </rejoiner_acr>
23
+ </models>
24
+ <resources>
25
+ <rejoiner_setup>
26
+ <setup>
27
+ <module>Rejoiner_Acr</module>
28
+ <class>Rejoiner_Acr_Model_Resource_Setup</class>
29
+ </setup>
30
+ </rejoiner_setup>
31
+ </resources>
32
+ </global>
33
+ <frontend>
34
+ <routers>
35
+ <rejoiner>
36
+ <use>standard</use>
37
+ <args>
38
+ <module>Rejoiner_Acr</module>
39
+ <frontName>rejoiner</frontName>
40
+ </args>
41
+ </rejoiner>
42
+ </routers>
43
+ <layout>
44
+ <updates>
45
+ <rejoiner_acr>
46
+ <file>rejoiner_acr.xml</file>
47
+ </rejoiner_acr>
48
+ </updates>
49
+ </layout>
50
+ <events>
51
+ <checkout_onepage_controller_success_action>
52
+ <observers>
53
+ <rejoiner_order_success>
54
+ <class>rejoiner_acr/observer</class>
55
+ <method>orderSuccess</method>
56
+ </rejoiner_order_success>
57
+ </observers>
58
+ </checkout_onepage_controller_success_action>
59
+ </events>
60
+ </frontend>
61
+ <admin>
62
+ <routers>
63
+ <adminhtml>
64
+ <args>
65
+ <modules>
66
+ <rejoiner_acr before="Mage_Adminhtml">Rejoiner_Acr_Adminhtml</rejoiner_acr>
67
+ </modules>
68
+ </args>
69
+ </adminhtml>
70
+ </routers>
71
+ </admin>
72
+ <adminhtml>
73
+ <translate>
74
+ <modules>
75
+ <Rejoiner_Acr>
76
+ <files>
77
+ <default>Rejoiner_Acr.csv</default>
78
+ </files>
79
+ </Rejoiner_Acr>
80
+ </modules>
81
+ </translate>
82
+ <layout>
83
+ <updates>
84
+ <rejoiner_acr>
85
+ <file>rejoiner_acr.xml</file>
86
+ </rejoiner_acr>
87
+ </updates>
88
+ </layout>
89
+ </adminhtml>
90
+ <default>
91
+ <checkout>
92
+ <rejoiner_acr>
93
+ <email>0</email>
94
+ </rejoiner_acr>
95
+ </checkout>
96
+ </default>
97
+ </config>
app/code/community/Rejoiner/Acr/etc/system.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <checkout>
5
+ <groups>
6
+ <rejoiner_acr translate="label" module="rejoiner_acr">
7
+ <label>Rejoiner Abandoned Cart Recovery</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>100</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <enabled translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </enabled>
23
+ <site_id translate="label">
24
+ <label>Rejoined site-id</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </site_id>
31
+ <domain translate="label">
32
+ <label>Store Domain *</label>
33
+ <!--<comment>Required field</comment>-->
34
+ <validate>required-entry</validate>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>20</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ </domain>
41
+ <email translate="label">
42
+ <label>Email to Rejoiner</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <comment>Email Rejoiner when a successful order occurs</comment>
46
+ <sort_order>40</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </email>
51
+ <track_numbers>
52
+ <label>Track Phone Numbers</label>
53
+ <frontend_type>select</frontend_type>
54
+ <comment>Enable this parameter if you want to track phone numbers.</comment>
55
+ <source_model>adminhtml/system_config_source_yesno</source_model>
56
+ <sort_order>30</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </track_numbers>
61
+ <persist_forms>
62
+ <label>Persist Forms</label>
63
+ <frontend_type>select</frontend_type>
64
+ <comment>If a user returns to the cart, the form fields will repopulate with the data they previously entered (excludes credit card numbers).</comment>
65
+ <source_model>adminhtml/system_config_source_yesno</source_model>
66
+ <sort_order>30</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </persist_forms>
71
+ <coupon_code translate="label">
72
+ <label>Generate Coupon Code</label>
73
+ <frontend_type>select</frontend_type>
74
+ <source_model>adminhtml/system_config_source_yesno</source_model>
75
+ <sort_order>50</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </coupon_code>
80
+ <salesrule_model translate="label">
81
+ <label>Select Shopping Cart Price Rule</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>rejoiner_acr/system_config_source_salesrule</source_model>
84
+ <sort_order>60</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ </salesrule_model>
89
+ </fields>
90
+ </rejoiner_acr>
91
+ </groups>
92
+ </checkout>
93
+ </sections>
94
+ </config>
app/code/community/Rejoiner/Acr/sql/rejoiner_setup/mysql4-install-1.0.0.0.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $installer->endSetup();
app/code/community/Rejoiner/Acr/sql/rejoiner_setup/mysql4-upgrade-1.0.0.0-1.0.1.0.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ ALTER TABLE `{$installer->getTable('sales_flat_quote')}`
8
+ ADD `promo` VARCHAR(255) NULL;
9
+ ");
10
+
11
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/rejoiner_acr.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+
5
+ <default>
6
+ <reference name="notifications">
7
+ <block type="rejoiner_acr/adminhtml_notification" name="notification_rejoiner" template="rejoiner_acr/notification.phtml"></block>
8
+ </reference>
9
+ </default>
10
+
11
+ </layout>
app/design/adminhtml/default/default/template/rejoiner_acr/notification.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Rejoiner_Acr_Block_Adminhtml_Notification
4
+ */
5
+ ?>
6
+ <?php if ($this->canShow()): ?>
7
+ <script type="text/javascript">
8
+ function denyRejoinerNotification() {
9
+ new Ajax.Request('<?php echo $this->getUrl('*/rejoiner/denyNotification', array('_current' => true)); ?>', {
10
+ method: 'post',
11
+ onComplete: function(transport) {
12
+ if (200 == transport.status) {
13
+ if ($('rejoiner_notification'))
14
+ $('rejoiner_notification').remove();
15
+ }
16
+ }
17
+ });
18
+ }
19
+ </script>
20
+ <div id="rejoiner_notification" class="notification-global notification-global-notice">
21
+ <strong>Rejoiner:</strong> <?php echo $this->helper('rejoiner_acr')->__('It looks like your checkout functionality have been overridden by some extension. So there is a chance that Rejoiner Snippets will not work. Please contact us') ?> <a href="mailto:help@rejoiner.com" >help@rejoiner.com</a>. <a href="#" onclick="denyRejoinerNotification(); return false;"><?php echo $this->helper('rejoiner_acr')->__('Remove this notification') ?></a>
22
+ </div>
23
+ <?php endif; ?>
app/design/frontend/base/default/layout/rejoiner_acr.xml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+
5
+ <rejoiner_acr_tracking>
6
+ <reference name="head">
7
+ <block type="rejoiner_acr/snippets" name="rejoiner_tracking" before="-">
8
+ <action method="setTemplate" ifconfig="checkout/rejoiner_acr/enabled"><template>rejoiner_acr/tracking.phtml</template></action>
9
+ </block>
10
+ </reference>
11
+ </rejoiner_acr_tracking>
12
+
13
+ <rejoiner_acr_conversion>
14
+ <reference name="head">
15
+ <block type="rejoiner_acr/snippets" name="rejoiner_tracking" before="-">
16
+ <action method="setTemplate" ifconfig="checkout/rejoiner_acr/enabled"><template>rejoiner_acr/conversion.phtml</template></action>
17
+ </block>
18
+ </reference>
19
+ </rejoiner_acr_conversion>
20
+
21
+ <checkout_cart_index>
22
+ <reference name="rejoiner_tracking">
23
+ <block type="core/template" template="rejoiner_acr/email.phtml" name="rejoiner_email"/>
24
+ </reference>
25
+ <update handle="rejoiner_acr_tracking"/>
26
+ </checkout_cart_index>
27
+
28
+ <checkout_onepage_index>
29
+ <update handle="rejoiner_acr_tracking"/>
30
+ </checkout_onepage_index>
31
+
32
+ <onestepcheckout_index_index>
33
+ <update handle="rejoiner_acr_tracking"/>
34
+ </onestepcheckout_index_index>
35
+
36
+ <checkout_multishipping_addresses>
37
+ <update handle="rejoiner_acr_tracking"/>
38
+ </checkout_multishipping_addresses>
39
+
40
+ <gomage_checkout_onepage_index>
41
+ <update handle="rejoiner_acr_tracking"/>
42
+ </gomage_checkout_onepage_index>
43
+
44
+ <checkout_onepage_success>
45
+ <update handle="rejoiner_acr_conversion"/>
46
+ </checkout_onepage_success>
47
+
48
+ <checkout_multishipping_success>
49
+ <update handle="rejoiner_acr_conversion"/>
50
+ </checkout_multishipping_success>
51
+
52
+ </layout>
app/design/frontend/base/default/template/rejoiner_acr/conversion.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Rejoiner_Acr_Block_Snippets */
3
+ ?>
4
+ <!-- Rejoiner Conversion -->
5
+ <script type="text/javascript">
6
+ var _rejoiner = _rejoiner || [];
7
+ _rejoiner.push(["setAccount", "<?php echo $this->helper('rejoiner_acr')->getRejoinerSiteId() ?>"]);
8
+ _rejoiner.push(["setDomain", "<?php echo $this->helper('rejoiner_acr')->getDomain() ?>"]);
9
+ _rejoiner.push(["sendConversion"]);
10
+
11
+ (function() {
12
+ var s = document.createElement('script'); s.type = 'text/javascript';
13
+ s.async = true; s.src = 'https://s3.amazonaws.com/rejoiner/js/v3/t.js';
14
+ var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
15
+ })();
16
+ </script>
17
+ <!-- End Rejoiner Conversion -->
app/design/frontend/base/default/template/rejoiner_acr/email.phtml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($customer = Mage::getSingleton('customer/session')->isLoggedIn()):
3
+ $customerData = Mage::getModel('customer/customer')->load(Mage::getSingleton('customer/session')->getId())->getData(); ?>
4
+ "email":"<?php echo $customerData['email']?>"
5
+ <?php else:
6
+ return false;
7
+ endif;?>
app/design/frontend/base/default/template/rejoiner_acr/tracking.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Rejoiner_Acr_Block_Snippets */
3
+ ?>
4
+
5
+ <?php if (Mage::helper('checkout/cart')->getCart()->getSummaryQty()):?>
6
+ <?php $items = $this->getCartItems() ?>
7
+
8
+ <script type="text/javascript">
9
+ var _rejoiner = _rejoiner || [];
10
+ _rejoiner.push(["setAccount", "<?php echo $this->helper('rejoiner_acr')->getRejoinerSiteId() ?>"]);
11
+ _rejoiner.push(["setDomain", "<?php echo $this->helper('rejoiner_acr')->getDomain() ?>"]);
12
+
13
+ <?php if ($this->helper('rejoiner_acr')->getTrackNumberEnabled()):?>
14
+ _rejoiner.push(["trackNumbers"]);
15
+ <?php endif ?>
16
+
17
+ <?php if ($this->helper('rejoiner_acr')->getPersistFormsEnabled()):?>
18
+ _rejoiner.push(["persistForms"]);
19
+ <?php endif ?>
20
+ (function() {
21
+ var s = document.createElement('script'); s.type = 'text/javascript';
22
+ s.async = true; s.src = 'https://s3.amazonaws.com/rejoiner/js/v3/t.js';
23
+ var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
24
+ })();
25
+ </script>
26
+
27
+ <script type="text/javascript">
28
+ <?php
29
+ $cartData = $this->getCartData();
30
+ $cartData .= ($this->getChildHtml('rejoiner_email'))? ' ,'.$this->getChildHtml('rejoiner_email'): '';?>
31
+ <?php if (Mage::getStoreConfig('checkout/rejoiner_acr/coupon_code')):?>
32
+ <?php $couponCode = $this->helper('rejoiner_acr')->generateCouponCode();
33
+ $cartData .= ','.'"promo"'.':'.'"'.$couponCode.'"';?>
34
+ <?php endif; ?>
35
+ _rejoiner.push(["setCartData", <?php echo $cartData? "{". $cartData . "}" : ''?>]);
36
+ <?php foreach ($items as $item): ?>
37
+ <?php $itemsAsJson = Mage::helper('core')->jsonEncode($item); ?>
38
+ <?php $itemsAsJson = str_replace('\\', '', $itemsAsJson); ?>
39
+ _rejoiner.push(["setCartItem", <?php echo $itemsAsJson?>]);
40
+ <?php endforeach ?>
41
+ </script>
42
+ <?php endif ?>
app/etc/modules/Rejoiner_Acr.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rejoiner_Acr>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Checkout />
9
+ </depends>
10
+ </Rejoiner_Acr>
11
+ </modules>
12
+ </config>
app/locale/en_US/Rejoiner_Acr.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ "Rejoiner Abandoned Cart Recovery","Rejoiner Abandoned Cart Recovery"
2
+ "Rejoined site-id","Rejoined site-id"
3
+ "It looks like your checkout functionality have been overridden by some extension. So there is a chance that Rejoiner Snippets will not work. Please contact us","It looks like your checkout functionality have been overridden by some extension. So there is a chance that Rejoiner Snippets will not work. Please contact us"
4
+ "Remove this notification","Remove this notification"
5
+ "Generate Coupon Code","Generate Coupon Code"
6
+ "Select Shopping Cart Price Rule","Select Shopping Cart Price Rule"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Rejoiner</name>
4
+ <version>1.0.9</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Rejoiner Cart Abandonment Remarketing</summary>
10
+ <description>Turn abandoned carts into 15% more sales with Rejoiner.</description>
11
+ <notes>Added functionality to generate discount coupon code for abandoned transactions.</notes>
12
+ <authors><author><name>Mike</name><user>auto-converted</user><email>mike@rejoiner.com</email></author></authors>
13
+ <date>2014-02-12</date>
14
+ <time>15:24:58</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Rejoiner_Acr.xml" hash="1aad3601804cead81b6e687dfcb5b83f"/></dir></target><target name="magecommunity"><dir name="Rejoiner"><dir name="Acr"><dir name="Block"><dir name="Adminhtml"><file name="Notification.php" hash="4b4837b59ab85fa886e65be49d511490"/></dir><file name="Snippets.php" hash="e1854b0555146371e75214b9f1b14284"/></dir><dir name="Helper"><file name="Data.php" hash="f35ff29ccfdb985d3ad079d5bf43e222"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="48f66ad159e3d10a21cc04a980ca923e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salesrule.php" hash="a8177bea6817c327fae8bb22cecf0502"/></dir></dir></dir><file name="Notification.php" hash="a03d68e9bbaa820ce87557fca9f8f811"/><file name="Observer.php" hash="df2d853ad73acab825dcae806c1e23e1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RejoinerController.php" hash="c2e5fea12a2fc23905d86f119c2baa39"/></dir><file name="AddtocartController.php" hash="a4c47b73379ab7d6319d4d00efca7c1f"/></dir><dir name="etc"><file name="config.xml" hash="7599dc7571149cb04bc66061590d9207"/><file name="system.xml" hash="7e3be6d652a90327fbb5c6d3d198f5a2"/></dir><dir name="sql"><dir name="rejoiner_setup"><file name="mysql4-install-1.0.0.0.php" hash="8d9a21c9c09fe44c6fe51ddd2106e3e0"/><file name="mysql4-upgrade-1.0.0.0-1.0.1.0.php" hash="36cc70cc6dd37aab7f3c460e0af58d59"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="365a3c5ba3a233c9ccca4bbbed89e745"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="conversion.phtml" hash="13a53b2f28e5f5fa6e0644ea9cf5a6a4"/><file name="email.phtml" hash="05e54d0999953acf865b6a439c4bb6b5"/><file name="tracking.phtml" hash="1fb47f23cd14449a3978c12bb320fdd4"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="3181cf1ca63813a9ce633ed3268659f4"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="notification.phtml" hash="90e1ddade6bbe1ecb0ffb68bf291469d"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash="24fe23f6afe1d770202d94e65373565e"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>