Rejoiner - Version 1.2.1

Version Notes

Passing customer name to the Rejoiner service

Download this release

Release Info

Developer Mike
Extension Rejoiner
Version 1.2.1
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.1

Files changed (32) hide show
  1. app/code/community/Rejoiner/Acr/Block/Adminhtml/Custom/Form.php +19 -0
  2. app/code/community/Rejoiner/Acr/Block/Adminhtml/Form/Field/Source.php +48 -0
  3. app/code/community/Rejoiner/Acr/Block/Adminhtml/Notification.php +42 -0
  4. app/code/community/Rejoiner/Acr/Block/Adminhtml/Preinstalled/Form.php +48 -0
  5. app/code/community/Rejoiner/Acr/Block/Base.php +124 -0
  6. app/code/community/Rejoiner/Acr/Block/Conversion.php +47 -0
  7. app/code/community/Rejoiner/Acr/Block/Customer.php +82 -0
  8. app/code/community/Rejoiner/Acr/Block/Product.php +50 -0
  9. app/code/community/Rejoiner/Acr/Block/Snippets.php +100 -0
  10. app/code/community/Rejoiner/Acr/Helper/Data.php +195 -0
  11. app/code/community/Rejoiner/Acr/Model/Notification.php +41 -0
  12. app/code/community/Rejoiner/Acr/Model/Observer.php +71 -0
  13. app/code/community/Rejoiner/Acr/Model/Resource/Setup.php +6 -0
  14. app/code/community/Rejoiner/Acr/Model/System/Config/Source/Salesrule.php +29 -0
  15. app/code/community/Rejoiner/Acr/controllers/AddbyskuController.php +62 -0
  16. app/code/community/Rejoiner/Acr/controllers/AddtocartController.php +39 -0
  17. app/code/community/Rejoiner/Acr/controllers/Adminhtml/RejoinerController.php +22 -0
  18. app/code/community/Rejoiner/Acr/etc/config.xml +106 -0
  19. app/code/community/Rejoiner/Acr/etc/system.xml +149 -0
  20. app/code/community/Rejoiner/Acr/sql/rejoiner_setup/mysql4-install-1.0.0.0.php +5 -0
  21. app/code/community/Rejoiner/Acr/sql/rejoiner_setup/mysql4-upgrade-1.0.0.0-1.0.1.0.php +11 -0
  22. app/design/adminhtml/default/default/layout/rejoiner_acr.xml +11 -0
  23. app/design/adminhtml/default/default/template/rejoiner_acr/notification.phtml +24 -0
  24. app/design/frontend/base/default/layout/rejoiner_acr.xml +100 -0
  25. app/design/frontend/base/default/template/rejoiner_acr/base.phtml +29 -0
  26. app/design/frontend/base/default/template/rejoiner_acr/conversion.phtml +9 -0
  27. app/design/frontend/base/default/template/rejoiner_acr/customer.phtml +5 -0
  28. app/design/frontend/base/default/template/rejoiner_acr/product.phtml +4 -0
  29. app/design/frontend/base/default/template/rejoiner_acr/tracking.phtml +20 -0
  30. app/etc/modules/Rejoiner_Acr.xml +12 -0
  31. app/locale/en_US/Rejoiner_Acr.csv +10 -0
  32. package.xml +6 -6
app/code/community/Rejoiner/Acr/Block/Adminhtml/Custom/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Block_Adminhtml_Custom_Form extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->addColumn('attr_name', array(
8
+ 'label' => Mage::helper('adminhtml')->__('Attribute Name'),
9
+ 'style' => 'width:120px',
10
+ ));
11
+ $this->addColumn('value', array(
12
+ 'label' => Mage::helper('adminhtml')->__('Value'),
13
+ 'style' => 'width:120px',
14
+ ));
15
+ $this->_addAfter = false;
16
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
17
+ parent::__construct();
18
+ }
19
+ }
app/code/community/Rejoiner/Acr/Block/Adminhtml/Form/Field/Source.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class Rejoiner_Acr_Block_Adminhtml_Form_Field_Source
4
+ * @method setName(string $name)
5
+ */
6
+ class Rejoiner_Acr_Block_Adminhtml_Form_Field_Source extends Mage_Core_Block_Html_Select
7
+ {
8
+ protected $_metaSources = array(
9
+ 'utm_source' => 'Campaign Source',
10
+ 'utm_medium' => 'Campaign Medium',
11
+ 'utm_campaign' => 'Campaign Name',
12
+ );
13
+
14
+ protected $_addGroupAllOption = true;
15
+
16
+
17
+ /**
18
+ * @return array
19
+ */
20
+ protected function _getMetaSources()
21
+ {
22
+ return $this->_metaSources;
23
+ }
24
+
25
+ /**
26
+ * @param $value
27
+ * @return mixed
28
+ */
29
+ public function setInputName($value)
30
+ {
31
+ return $this->setName($value);
32
+ }
33
+
34
+ /**
35
+ * Render block HTML
36
+ *
37
+ * @return string
38
+ */
39
+ public function _toHtml()
40
+ {
41
+ if (!$this->getOptions()) {
42
+ foreach ($this->_getMetaSources() as $groupId => $groupLabel) {
43
+ $this->addOption($groupId, Mage::helper('adminhtml')->__(addslashes($groupLabel)));
44
+ }
45
+ }
46
+ return parent::_toHtml();
47
+ }
48
+ }
app/code/community/Rejoiner/Acr/Block/Adminhtml/Notification.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block to check overriding for checkout by other extensions and show warning message
4
+ *
5
+ * @category Rejoiner
6
+ * @package Rejoiner_Acr
7
+ */
8
+ class Rejoiner_Acr_Block_Adminhtml_Notification extends Mage_Core_Block_Template
9
+ {
10
+ /**
11
+ * @return bool
12
+ */
13
+ public function canShow()
14
+ {
15
+ if (Rejoiner_Acr_Model_Notification::isNotificationViewed()) {
16
+ return false;
17
+ }
18
+ return ($this->_isCoreCheckoutControllerOverridden() || $this->_isCoreCheckoutUrlHelperOverridden());
19
+ }
20
+
21
+ /**
22
+ * @return bool
23
+ */
24
+ protected function _isCoreCheckoutControllerOverridden()
25
+ {
26
+ $frontController = new Mage_Core_Controller_Varien_Front();
27
+ $frontController->init();
28
+
29
+ /** @var Mage_Core_Controller_Varien_Router_Standard $standardRouter */
30
+ $standardRouter = $frontController->getRouter('standard');
31
+ $modules = $standardRouter->getModuleByFrontName('checkout');
32
+ return reset($modules) != 'Mage_Checkout';
33
+ }
34
+
35
+ /**
36
+ * @return bool
37
+ */
38
+ protected function _isCoreCheckoutUrlHelperOverridden()
39
+ {
40
+ return get_class(Mage::helper('checkout/url')) != 'Mage_Checkout_Helper_Url';
41
+ }
42
+ }
app/code/community/Rejoiner/Acr/Block/Adminhtml/Preinstalled/Form.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Block_Adminhtml_Preinstalled_Form extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $_sourceRenderer;
6
+
7
+ protected function _prepareToRender()
8
+ {
9
+ $this->addColumn('attr_name', array(
10
+ 'label' => Mage::helper('adminhtml')->__('Attribute Name'),
11
+ 'style' => 'width:120px',
12
+ 'renderer' => $this->_getSourceRenderer()
13
+ ));
14
+ $this->addColumn('value', array(
15
+ 'label' => Mage::helper('adminhtml')->__('Value'),
16
+ 'style' => 'width:120px',
17
+ ));
18
+ $this->_addAfter = false;
19
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
20
+ }
21
+
22
+ /**
23
+ * @return Mage_Core_Block_Abstract|Rejoiner_Acr_Block_Adminhtml_Form_Field_Source
24
+ */
25
+ protected function _getSourceRenderer()
26
+ {
27
+ if (!$this->_sourceRenderer) {
28
+ $this->_sourceRenderer = $this->getLayout()->createBlock(
29
+ 'rejoiner_acr/adminhtml_form_field_source', 'google_anal',
30
+ array('is_render_to_js_template' => true)
31
+ );
32
+ }
33
+ return $this->_sourceRenderer;
34
+ }
35
+
36
+ /**
37
+ * @param Varien_Object $row
38
+ */
39
+ protected function _prepareArrayRow(Varien_Object $row)
40
+ {
41
+ /** @var Rejoiner_Acr_Block_Adminhtml_Form_Field_Source $sourceRenderer */
42
+ $sourceRenderer = $this->_getSourceRenderer();
43
+ $row->setData(
44
+ 'option_extra_attr_' . $sourceRenderer->calcOptionHash($row->getData('attr_name')),
45
+ 'selected="selected"'
46
+ );
47
+ }
48
+ }
app/code/community/Rejoiner/Acr/Block/Base.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Block_Base extends Mage_Core_Block_Template
4
+ {
5
+ const XML_PATH_REJOINER_TRACK_PRICE_WITH_TAX = 'checkout/rejoiner_acr/price_with_tax';
6
+
7
+ /**
8
+ * @return array
9
+ */
10
+ public function getCartItems()
11
+ {
12
+ $items = array();
13
+ if ($quote = $this->_getQuote()) {
14
+ $displayPriceWithTax = $this->getTrackPriceWithTax();
15
+ $mediaUrl = Mage::getBaseUrl('media');
16
+ $quoteItems = $quote->getAllItems();
17
+ /** @var Rejoiner_Acr_Helper_Data $rejoinerHelper */
18
+ $rejoinerHelper = Mage::helper('rejoiner_acr');
19
+ $parentToChild = array();
20
+ $categories = array();
21
+ /** @var Mage_Sales_Model_Quote_Item $item */
22
+ foreach ($quoteItems as $item) {
23
+ /** @var Mage_Sales_Model_Quote_Item $parent */
24
+ if ($parent = $item->getParentItem()) {
25
+ if ($parent->getProductType() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
26
+ $parentToChild[$parent->getId()] = $item;
27
+ }
28
+ }
29
+ $categories = array_merge($categories, $item->getProduct()->getCategoryIds());
30
+ }
31
+
32
+ /** @var Mage_Catalog_Model_Resource_Category_Collection $categoryCollection */
33
+ $categoryCollection = Mage::getModel('catalog/category')->getCollection();
34
+ $categoryCollection
35
+ ->addAttributeToSelect('name')
36
+ ->addFieldToFilter('entity_id', array('in' => array_unique($categories)));
37
+ $imageHelper = Mage::helper('catalog/image');
38
+
39
+ foreach ($quoteItems as $item) {
40
+ if ($item->getParentItem()) {
41
+ continue;
42
+ }
43
+ $product = $item->getProduct();
44
+ // Collection is loaded only once, so it is ok to do $categoryCollection->getItems() inside the loop
45
+ // From the other hand we won't ever get here if not needed
46
+ $productCategories = $rejoinerHelper->getProductCategories($product, $categoryCollection->getItems());
47
+ $thumbnail = 'no_selection';
48
+
49
+ // get thumbnail from configurable product
50
+ if ($product->getData('thumbnail') && ($product->getData('thumbnail') != 'no_selection')) {
51
+ $thumbnail = $product->getData('thumbnail');
52
+ // or try finding it in the simple one
53
+ } elseif ($item->getProductType() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
54
+ /** @var Mage_Sales_Model_Quote_Item $simpleItem */
55
+ $simpleItem = $parentToChild[$item->getId()];
56
+ $simpleProduct = $simpleItem->getProduct();
57
+ if ($simpleProduct->getData('thumbnail') && ($simpleProduct->getData('thumbnail') != 'no_selection')) {
58
+ $thumbnail = $simpleProduct->getData('thumbnail');
59
+ }
60
+ }
61
+ if (!file_exists(Mage::getBaseDir('media') . '/catalog/product' . $thumbnail)) {
62
+ $thumbnail = 'no_selection';
63
+ }
64
+ // use placeholder image if nor simple nor configurable products does not have images
65
+ if ($thumbnail == 'no_selection') {
66
+ $imageHelper->init($product, 'thumbnail');
67
+ $image = Mage::getDesign()->getSkinUrl($imageHelper->getPlaceholder());
68
+ } elseif($imagePath = $rejoinerHelper->resizeImage($thumbnail)) {
69
+ $image = str_replace(Mage::getBaseDir('media') . '/', $mediaUrl, $imagePath);
70
+ } else {
71
+ $image = $mediaUrl . 'catalog/product' . $thumbnail;
72
+ }
73
+
74
+ if ($displayPriceWithTax) {
75
+ $prodPrice = $item->getPriceInclTax();
76
+ $rowTotal = $item->getRowTotalInclTax();
77
+ } else {
78
+ $prodPrice = $item->getBaseCalculationPrice();
79
+ $rowTotal = $item->getBaseRowTotal();
80
+ }
81
+ $newItem = array(
82
+ 'name' => $item->getName(),
83
+ 'image_url' => $image,
84
+ 'price' => $this->_convertPriceToCents($prodPrice),
85
+ 'product_id' => (string) $item->getSku(),
86
+ 'product_url' => (string) $item->getProduct()->getProductUrl(),
87
+ 'item_qty' => $item->getQty(),
88
+ 'qty_price' => $this->_convertPriceToCents($rowTotal),
89
+ 'category' => $productCategories
90
+ );
91
+ $items[] = $newItem;
92
+ }
93
+ }
94
+ return $items;
95
+ }
96
+
97
+
98
+
99
+ /**
100
+ * @param $price float
101
+ * @return float
102
+ */
103
+ protected function _convertPriceToCents($price) {
104
+ return round($price * 100);
105
+ }
106
+
107
+ /**
108
+ * @return bool
109
+ */
110
+ protected function getTrackPriceWithTax()
111
+ {
112
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_TRACK_PRICE_WITH_TAX);
113
+ }
114
+
115
+ /**
116
+ * @return Mage_Sales_Model_Quote
117
+ */
118
+ protected function _getQuote()
119
+ {
120
+ /** @var Mage_Checkout_Model_Session $session */
121
+ $session = Mage::getSingleton('checkout/session');
122
+ return $session->getQuote();
123
+ }
124
+ }
app/code/community/Rejoiner/Acr/Block/Conversion.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rejoiner_Acr_Block_Conversion extends Rejoiner_Acr_Block_Base
3
+ {
4
+ const XML_PATH_REJOINER_TRACK_PRICE_WITH_TAX = 'checkout/rejoiner_acr/price_with_tax';
5
+
6
+ /**
7
+ * @return array
8
+ */
9
+ public function getCartData()
10
+ {
11
+ $cartData = array();
12
+ if ($quote = $this->_getQuote()) {
13
+ /** @var Mage_Checkout_Model_Session $session */
14
+ $session = Mage::getSingleton('checkout/session');
15
+ if ($this->getTrackPriceWithTax()) {
16
+ $total = $quote->getGrandTotal();
17
+ } else {
18
+ $total = $quote->getSubtotal();
19
+ }
20
+ $cartData = array(
21
+ 'cart_value' => $this->_convertPriceToCents($total),
22
+ 'cart_item_count' => intval($quote->getItemsQty()),
23
+ 'customer_order_number' => $session->getLastRealOrderId(),
24
+ 'return_url' => Mage::getUrl('sales/order/view/', array('order_id' => $session->getLastOrderId()))
25
+ );
26
+
27
+ if ($promo = $quote->getCouponCode()) {
28
+ $cartData['promo'] = $promo;
29
+ }
30
+
31
+ }
32
+ return $cartData;
33
+ }
34
+
35
+ /**
36
+ * @return Mage_Sales_Model_Quote
37
+ */
38
+ protected function _getQuote()
39
+ {
40
+ $quote = Mage::getModel('sales/quote');
41
+ if ($quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId()) {
42
+ $quote->load($quoteId);
43
+ }
44
+ return $quote;
45
+ }
46
+
47
+ }
app/code/community/Rejoiner/Acr/Block/Customer.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rejoiner_Acr_Block_Customer extends Rejoiner_Acr_Block_Base
3
+ {
4
+ protected $customer;
5
+
6
+ /**
7
+ * @return Mage_Customer_Model_Customer
8
+ */
9
+ protected function getCurrentCustomer()
10
+ {
11
+ if (!$this->customer) {
12
+ $this->customer = Mage::getSingleton('customer/session')->getCustomer();
13
+ }
14
+ return $this->customer;
15
+ }
16
+
17
+ /**
18
+ * @return string
19
+ */
20
+ public function getCustomerInfo()
21
+ {
22
+ $customerData = array(
23
+ 'age' => $this->getCustomerAge(),
24
+ 'gender' => $this->getGender(),
25
+ 'en' => substr(Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE,0),0,2),
26
+ 'name' => $this->getCurrentCustomer()->getName()
27
+ );
28
+ return json_encode($customerData);
29
+ }
30
+
31
+ /**
32
+ * @return string
33
+ */
34
+ protected function _toHtml()
35
+ {
36
+ if ($this->getCurrentCustomer()->getId()) {
37
+ $html = parent::_toHtml();
38
+ } else {
39
+ $html = '';
40
+ }
41
+
42
+ return $html;
43
+ }
44
+
45
+ /**
46
+ * @return int
47
+ */
48
+ protected function getCustomerAge()
49
+ {
50
+ $age = 0;
51
+ if ($dob = $this->getCurrentCustomer()->getDob()) {
52
+ $birthdayDate = new DateTime($dob);
53
+ $now = new DateTime();
54
+ $interval = $now->diff($birthdayDate);
55
+ $age = $interval->y;
56
+ }
57
+ return $age;
58
+ }
59
+
60
+ /**
61
+ * @return string
62
+ */
63
+ protected function getGender()
64
+ {
65
+ $genderText = $this->getCurrentCustomer()
66
+ ->getResource()
67
+ ->getAttribute('gender')
68
+ ->getSource()
69
+ ->getOptionText($this->getCurrentCustomer()->getData('gender'));
70
+
71
+ return $genderText? $genderText : '';
72
+ }
73
+
74
+ /**
75
+ * @return string
76
+ */
77
+ public function getCustomerEmail()
78
+ {
79
+ return str_replace('\\/', '/', json_encode(array('email' => $this->getCurrentCustomer()->getEmail())));
80
+ }
81
+
82
+ }
app/code/community/Rejoiner/Acr/Block/Product.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rejoiner_Acr_Block_Product extends Rejoiner_Acr_Block_Base
3
+ {
4
+ /**
5
+ * @return string
6
+ */
7
+ public function getCurrentProductInfo()
8
+ {
9
+ $product = Mage::registry('current_product');
10
+ $imageHelper = Mage::helper('catalog/image');
11
+ $rejoinerHelper = Mage::helper('rejoiner_acr');
12
+ $mediaUrl = Mage::getBaseUrl('media');
13
+ $thumbnail = 'no_selection';
14
+ $categories = array();
15
+ $categoryCollection = Mage::getModel('catalog/category')->getCollection();
16
+ $categoryCollection->addAttributeToSelect('name');
17
+ $categoryCollection->addFieldToFilter('entity_id', array('in' => $product->getCategoryIds()));
18
+ /** @var Mage_Catalog_Model_Category $category */
19
+ foreach ($categoryCollection as $category) {
20
+ $categories[] = $category->getName();
21
+ }
22
+
23
+ if ($product->getData('thumbnail') && ($product->getData('thumbnail') != 'no_selection')) {
24
+ $thumbnail = $product->getData('thumbnail');
25
+ }
26
+
27
+ if (!file_exists(Mage::getBaseDir('media') . '/catalog/product' . $thumbnail)) {
28
+ $thumbnail = 'no_selection';
29
+ }
30
+ // use placeholder image if nor simple nor configurable products does not have images
31
+ if ($thumbnail == 'no_selection') {
32
+ $imageHelper->init($product, 'thumbnail');
33
+ $image = Mage::getDesign()->getSkinUrl($imageHelper->getPlaceholder());
34
+ } elseif($imagePath = $rejoinerHelper->resizeImage($thumbnail)) {
35
+ $image = str_replace(Mage::getBaseDir('media') . '/', $mediaUrl, $imagePath);
36
+ } else {
37
+ $image = (string) $mediaUrl . 'catalog/product' . $thumbnail;
38
+ }
39
+
40
+ $productData = array(
41
+ 'name' => (string) $product->getName(),
42
+ 'image_url' => (string) $image,
43
+ 'price' => $this->_convertPriceToCents((string) $product->getPrice()),
44
+ 'product_id' => (string) $product->getSku(),
45
+ 'product_url' => (string) $product->getProductUrl(),
46
+ 'category' => $categories
47
+ );
48
+ return str_replace('\\/', '/', json_encode($productData));
49
+ }
50
+ }
app/code/community/Rejoiner/Acr/Block/Snippets.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Rejoiner_Acr_Block_Base
10
+ {
11
+
12
+ const XML_PATH_REJOINER_TRACK_PRICE_WITH_TAX = 'checkout/rejoiner_acr/price_with_tax';
13
+
14
+ /**
15
+ * @return array
16
+ */
17
+ public function getCartData()
18
+ {
19
+ $cartData = array();
20
+ if ($quote = $this->_getQuote()) {
21
+ if ($this->getTrackPriceWithTax()) {
22
+ $total = $this->_getQuote()->getGrandTotal();
23
+ } else {
24
+ $total = $this->_getQuote()->getSubtotal();
25
+ }
26
+
27
+ $cartData = array(
28
+ 'total_items_count' => intval($this->_getQuote()->getItemsQty()),
29
+ 'cart_value' => $this->_convertPriceToCents($total),
30
+ 'return_url' => (string) Mage::helper('rejoiner_acr')->getRestoreUrl(),
31
+ );
32
+ if (Mage::getStoreConfig('checkout/rejoiner_acr/coupon_code')) {
33
+ $cartData['promo'] = (string) $this->_generateCouponCode();
34
+ }
35
+ }
36
+ return $cartData;
37
+ }
38
+
39
+ /**
40
+ * @return string
41
+ */
42
+ protected function _generateCouponCode()
43
+ {
44
+ /** @var Mage_Checkout_Helper_Cart $cartHelper */
45
+ $cartHelper = Mage::helper('checkout/cart');
46
+ /** @var Mage_Sales_Model_Quote $quote */
47
+ $quote = $cartHelper->getCart()->getQuote();
48
+ $couponCode = $quote->getPromo();
49
+ $ruleId = Mage::getStoreConfig('checkout/rejoiner_acr/salesrule_model');
50
+ /** @var Mage_SalesRule_Model_Rule $ruleItem */
51
+ $ruleItem = Mage::getModel('salesrule/rule')
52
+ ->getCollection()
53
+ ->addFieldToFilter('rule_id', array('eq' => $ruleId))
54
+ ->getFirstItem();
55
+
56
+ if ($ruleItem->getUseAutoGeneration() && !$couponCode) {
57
+ /** @var Mage_SalesRule_Model_Coupon_Codegenerator $codeGenerator */
58
+ $codeGenerator = Mage::getModel('salesrule/coupon_codegenerator');
59
+ $couponCode = $codeGenerator->generateCode();
60
+
61
+ /** @var Mage_SalesRule_Model_Coupon $coupon */
62
+ $coupon = Mage::getModel('salesrule/coupon');
63
+ $coupon->setRuleId($ruleId)
64
+ ->setCode($couponCode)
65
+ ->setUsageLimit(1)
66
+ ->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)
67
+ ->save();
68
+
69
+ $cartHelper->getCart()
70
+ ->getQuote()
71
+ ->setPromo(strlen($couponCode) ? $couponCode : '')
72
+ ->save();
73
+ }
74
+ return $couponCode;
75
+ }
76
+
77
+ /**
78
+ * @return Mage_Sales_Model_Quote
79
+ */
80
+ protected function _getQuote()
81
+ {
82
+ return Mage::getSingleton('checkout/session')->getQuote();
83
+ }
84
+
85
+ /**
86
+ * @param $price
87
+ * @return float
88
+ */
89
+ protected function _convertPriceToCents($price) {
90
+ return round($price*100);
91
+ }
92
+
93
+ /**
94
+ * @return bool
95
+ */
96
+ protected function getTrackPriceWithTax()
97
+ {
98
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_TRACK_PRICE_WITH_TAX);
99
+ }
100
+ }
app/code/community/Rejoiner/Acr/Helper/Data.php ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ const XML_PATH_REJOINER_THUMBNAIL_SIZE = 'checkout/rejoiner_acr/thumbnail_size';
18
+ const XML_PATH_REJOINER_DEBUG_ENABLED = 'checkout/rejoiner_acr/debug_enabled';
19
+ const REMOVED_CART_ITEM_SKU_VARIABLE = 'rejoiner_sku';
20
+
21
+ protected $_currentProtocolSecurity = null;
22
+
23
+ public function getRejoinerSiteId()
24
+ {
25
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_SITE_ID);
26
+ }
27
+
28
+ public function getRestoreUrl()
29
+ {
30
+ $product = array();
31
+ /** @var Mage_Checkout_Helper_Cart $cartHelper */
32
+ $cartHelper = Mage::helper('checkout/cart');
33
+
34
+ if ($itemsCollection = $cartHelper->getCart()->getItems()) {
35
+ /** @var Mage_Sales_Model_Quote_Item $item */
36
+ foreach ($itemsCollection as $item) {
37
+ if (!$item->getParentItem()) {
38
+ $options = unserialize($item->getOptionByCode('info_buyRequest')->getValue());
39
+ $options['qty'] = $item->getQty();
40
+ $options['product'] = $item->getProductId();
41
+ $product[] = $options;
42
+ }
43
+ }
44
+ }
45
+ $googleAttributesArray = $this->returnGoogleAttributes();
46
+ $customAttributesArray = $this->returnCustomAttributes();
47
+
48
+ $queryParams = array_merge($product, $googleAttributesArray, $customAttributesArray);
49
+ $url = Mage::getUrl('rejoiner/addtocart/', array(
50
+ '_query' => $queryParams,
51
+ '_secure' => true
52
+ ));
53
+ return substr($url, 0, strlen($url)-1);
54
+ }
55
+
56
+ public function getDomain()
57
+ {
58
+ $domain = trim(Mage::getStoreConfig(self::XML_PATH_REJOINER_DOMAIN));
59
+ if ($domain[0] == '.') {
60
+ return $domain;
61
+ } else {
62
+ return '.' . $domain;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * @return bool
68
+ */
69
+ public function getTrackNumberEnabled()
70
+ {
71
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_TRACK_NUMBERS);
72
+ }
73
+
74
+ /**
75
+ * @return bool
76
+ */
77
+ public function getPersistFormsEnabled()
78
+ {
79
+ return Mage::getStoreConfig(self::XML_PATH_REJOINER_PERSIST_FORMS);
80
+ }
81
+
82
+ /**
83
+ * @return bool
84
+ */
85
+ public function checkHttps()
86
+ {
87
+ if (empty($this->_currentProtocolSecurity)) {
88
+ $this->_currentProtocolSecurity = Mage::app()->getStore()->isCurrentlySecure();
89
+ }
90
+ return $this->_currentProtocolSecurity;
91
+ }
92
+
93
+ /**
94
+ * @param $productImageName
95
+ * @return bool
96
+ */
97
+
98
+ public function resizeImage($productImageName)
99
+ {
100
+ if($size = $this->_parseSize(Mage::getStoreConfig(self::XML_PATH_REJOINER_THUMBNAIL_SIZE))) {
101
+ $imageResized = Mage::getBaseDir('media') . '/catalog/resized/' . $size['width'] . 'x' . $size['height'] . $productImageName;
102
+ if (!file_exists($imageResized)) {
103
+ $imageObj = new Varien_Image(Mage::getBaseDir('media') . '/catalog/product' . $productImageName);
104
+ $imageObj->resize($size['width'], $size['height']);
105
+ $imageObj->save($imageResized);
106
+ }
107
+ } else {
108
+ return false;
109
+ }
110
+ return $imageResized;
111
+ }
112
+
113
+ /**
114
+ * @param $string
115
+ * @return array|bool
116
+ */
117
+
118
+ protected function _parseSize($string)
119
+ {
120
+ $size = explode('x', strtolower($string));
121
+ if (sizeof($size) == 2) {
122
+ return array(
123
+ 'width' => ($size[0] > 0) ? $size[0] : null,
124
+ 'height' => ($size[1] > 0) ? $size[1] : null,
125
+ );
126
+ }
127
+ return false;
128
+ }
129
+
130
+ /**
131
+ * @return bool
132
+ */
133
+
134
+ /**
135
+ * @return bool|mixed
136
+ */
137
+ public function checkRemovedItem()
138
+ {
139
+ $session = Mage::getSingleton('core/session', array('name' => 'frontend'));
140
+ if ($session->hasData(self::REMOVED_CART_ITEM_SKU_VARIABLE)) {
141
+ $removedItems = $session->getData(self::REMOVED_CART_ITEM_SKU_VARIABLE);
142
+ $session->unsetData(self::REMOVED_CART_ITEM_SKU_VARIABLE);
143
+ return $removedItems;
144
+ }
145
+ return false;
146
+ }
147
+
148
+ /**
149
+ * @return array
150
+ */
151
+ public function returnGoogleAttributes() {
152
+ $result=array();
153
+ if ($googleAnalitics = Mage::getStoreConfig('checkout/rejoiner_acr/google_attributes')) {
154
+ foreach (unserialize($googleAnalitics) as $attr) {
155
+ if ($attr['attr_name'] && $attr['value']) {
156
+ $result[$attr['attr_name']] = $attr['value'];
157
+ }
158
+ }
159
+ }
160
+ return $result;
161
+ }
162
+
163
+ /**
164
+ * @return array
165
+ */
166
+ public function returnCustomAttributes() {
167
+ $result=array();
168
+ if ($customAttr = Mage::getStoreConfig('checkout/rejoiner_acr/custom_attributes')) {
169
+ foreach (unserialize($customAttr) as $attr) {
170
+ if ($attr['attr_name'] && $attr['value']) {
171
+ $result[$attr['attr_name']] = $attr['value'];
172
+ }
173
+ }
174
+ }
175
+ return $result;
176
+ }
177
+
178
+
179
+ /**
180
+ * @param Mage_Catalog_Model_Product $product
181
+ * @param $categoriesArray
182
+ * @return array
183
+ */
184
+
185
+ public function getProductCategories(Mage_Catalog_Model_Product $product, $categoriesArray)
186
+ {
187
+ $result = array();
188
+ foreach ($product->getCategoryIds() as $catId) {
189
+ if (isset($categoriesArray[$catId])) {
190
+ $result[] = $categoriesArray[$catId]->getName();
191
+ }
192
+ }
193
+ return implode(' ', $result);
194
+ }
195
+ }
app/code/community/Rejoiner/Acr/Model/Notification.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ return isset($flagData['notification_viewed']) && $flagData['notification_viewed'] == 1;
30
+
31
+ }
32
+
33
+ /**
34
+ * Save notification viewed flag in core flag
35
+ *
36
+ */
37
+ public static function saveNotificationViewed()
38
+ {
39
+ self::_getFlagModel()->setFlagData(array('notification_viewed' => true))->save();
40
+ }
41
+ }
app/code/community/Rejoiner/Acr/Model/Observer.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Rejoiner_Acr_Model_Observer
3
+ {
4
+ const REJOINER_API_URL = 'https://app.rejoiner.com';
5
+ const REJOINER_API_REQUEST_PATH = '/api/1.0/site/%s/lead/convert';
6
+ const REJOINER_API_LOG_FILE = 'rejoiner_api.log';
7
+
8
+ const XML_PATH_REJOINER_API_KEY = 'checkout/rejoiner_acr/api_key';
9
+ const XML_PATH_REJOINER_API_SECRET = 'checkout/rejoiner_acr/api_secret';
10
+ const XML_PATH_REJOINER_API_SITE_ID = 'checkout/rejoiner_acr/site_id';
11
+
12
+ public function trackOrderSuccessConversion(Varien_Event_Observer $observer)
13
+ {
14
+ $apiKey = Mage::getStoreConfig(self::XML_PATH_REJOINER_API_KEY);
15
+ $apiSecret = utf8_encode(Mage::getStoreConfig(self::XML_PATH_REJOINER_API_SECRET));
16
+
17
+ if ($apiKey && $apiSecret) {
18
+ /** @var Mage_Checkout_Model_Session $session */
19
+ $lastOrderId = $observer->getEvent()->getData('order_ids');
20
+ /** @var Mage_Sales_Model_Order $order */
21
+ $order = Mage::getModel('sales/order')->load($lastOrderId[0]);
22
+ $customerEmail = $order->getBillingAddress()->getEmail();
23
+
24
+ $siteId = Mage::getStoreConfig(self::XML_PATH_REJOINER_API_SITE_ID);
25
+ $requestPath = sprintf(self::REJOINER_API_REQUEST_PATH, $siteId);
26
+ $requestBody = utf8_encode(sprintf('{"email": "%s"}', $customerEmail));
27
+ $hmacData = utf8_encode(implode("\n", array(Varien_Http_Client::POST, $requestPath, $requestBody)));
28
+
29
+ $codedApiSecret = base64_encode(hash_hmac('sha1', $hmacData, $apiSecret, true));
30
+ $authorization = sprintf('Rejoiner %s:%s', $apiKey , $codedApiSecret);
31
+ $client = new Varien_Http_Client(self::REJOINER_API_URL . $requestPath);
32
+ $client->setRawData($requestBody);
33
+ $client->setHeaders(array('Authorization' => $authorization, 'Content-type' => 'application/json;' ));
34
+ try{
35
+ $response = $client->request(Varien_Http_Client::POST);
36
+ switch ($response->getStatus()) {
37
+ case '200':
38
+ Mage::log(print_r($response->getStatus(), true) . ' Everything is alright.', null, self::REJOINER_API_LOG_FILE);
39
+ break;
40
+ case '400':
41
+ Mage::log(print_r($response->getStatus(), true) . ' required params were not specified and/or the body was malformed', null, self::REJOINER_API_LOG_FILE);
42
+ break;
43
+ case '403':
44
+ Mage::log(print_r($response->getStatus(), true) . ' failed authentication and/or incorrect signature', null, self::REJOINER_API_LOG_FILE);
45
+ break;
46
+ case '500':
47
+ Mage::log(print_r($response->getStatus(), true) . ' internal error, contact us for details', null, self::REJOINER_API_LOG_FILE);
48
+ break;
49
+ default:
50
+ Mage::log(print_r($response->getStatus(), true) . ' unexpected response code', null, self::REJOINER_API_LOG_FILE);
51
+ break;
52
+ }
53
+ } catch (Exception $e) {
54
+ Mage::log($e->getMessage(), null, 'exception.log');
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @param Varien_Event_Observer $observer
61
+ */
62
+ public function removeCartItem(Varien_Event_Observer $observer)
63
+ {
64
+ $session = Mage::getSingleton('core/session', array('name' => 'frontend'));
65
+ /** @var Mage_Sales_Model_Quote_Item $quote */
66
+ if ($quote = $observer->getQuoteItem()) {
67
+ $removedItem[] = $quote->getSku();
68
+ $session->setData(Rejoiner_Acr_Helper_Data::REMOVED_CART_ITEM_SKU_VARIABLE, $removedItem);
69
+ }
70
+ }
71
+ }
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,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Model_System_Config_Source_Salesrule {
4
+
5
+ /**
6
+ * @return array
7
+ */
8
+ public function toOptionArray()
9
+ {
10
+ $options = array();
11
+ $additional= array(
12
+ 'value' => 'rule_id',
13
+ 'label' => 'name'
14
+ );
15
+ $collection = Mage::getResourceModel('salesrule/rule_collection')->loadData();
16
+ foreach ($collection as $item) {
17
+ if ($item->getUseAutoGeneration()) {
18
+ $data = array();
19
+ foreach ($additional as $code => $field) {
20
+ $data[$code] = $item->getData($field);
21
+ }
22
+ $options[] = $data;
23
+ }
24
+ }
25
+ array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
26
+ return $options;
27
+ }
28
+
29
+ }
app/code/community/Rejoiner/Acr/controllers/AddbyskuController.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_AddbyskuController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ const XML_PATH_REJOINER_DEBUG_ENABLED = 'checkout/rejoiner_acr/debug_enabled';
6
+
7
+ public function indexAction()
8
+ {
9
+ $params = $this->getRequest()->getParams();
10
+ /** @var Mage_Checkout_Helper_Cart $cart */
11
+ $cart = Mage::helper('checkout/cart');
12
+ $quote = $cart->getQuote();
13
+
14
+ $successMessage = '';
15
+ foreach ($params as $key => $product) {
16
+ if ($product && is_array($product)) {
17
+ if (!isset($product['sku'])) {
18
+ continue;
19
+ }
20
+ /** @var Mage_Catalog_Model_Product $productModel */
21
+ $productModel = Mage::getModel('catalog/product');
22
+ /** @var Mage_Catalog_Model_Product $productBySKU */
23
+ $productBySKU = $productModel->loadByAttribute('sku', $product['sku']);
24
+ if (!$productBySKU->getId()) {
25
+ continue;
26
+ }
27
+ $productId = $productBySKU->getId();
28
+ if ($productId) {
29
+ /** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */
30
+ $stockItem = Mage::getModel('cataloginventory/stock_item');
31
+ $qty = $stockItem->loadByProduct($productId)->getQty();
32
+ try {
33
+ if(!$quote->hasProductId($productId) && is_numeric($product['qty']) && $qty > $product['qty']) {
34
+ $quote->addProduct($productBySKU, (int)$product['qty']);
35
+ $successMessage .= $this->__('%s was added to your shopping cart.'.'</br>', Mage::helper('core')->escapeHtml($productBySKU->getName()));
36
+ }
37
+ unset($params[$key]);
38
+ } catch (Exception $e) {
39
+ if(Mage::getStoreConfig(Rejoiner_Acr_Helper_Data::XML_PATH_REJOINER_DEBUG_ENABLED)) {
40
+ Mage::log($e->getMessage(), null, 'rejoiner.log');
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ if ($params['coupon_code']) {
47
+ $quote->setCouponCode($params['coupon_code'])->collectTotals()->save();;
48
+ }
49
+ try {
50
+ $quote->save();
51
+ } catch (Exception $e) {
52
+ if(Mage::getStoreConfig(self::XML_PATH_REJOINER_DEBUG_ENABLED)) {
53
+ Mage::log($e->getMessage(), null, 'rejoiner.log');
54
+ }
55
+ }
56
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
57
+ if($successMessage) {
58
+ Mage::getSingleton('core/session')->addSuccess($successMessage);
59
+ }
60
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart/'));
61
+ }
62
+ }
app/code/community/Rejoiner/Acr/controllers/AddtocartController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_AddtocartController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ /** @var Mage_Checkout_Model_Cart $cart */
8
+ $cart = Mage::getSingleton('checkout/cart');
9
+ $cart->truncate();
10
+ $params = $this->getRequest()->getParams();
11
+ foreach ($params as $key => $product) {
12
+ if ($product && is_array($product)) {
13
+ $prodModel = Mage::getModel('catalog/product');
14
+ $prodModel->load((int)$product['product']);
15
+ if (!$prodModel->getId()) {
16
+ continue;
17
+ }
18
+ try {
19
+ $cart->addProduct($prodModel, $product);
20
+ unset($params[$key]);
21
+ } catch (Exception $e) {
22
+ if(Mage::getStoreConfig(Rejoiner_Acr_Helper_Data::XML_PATH_REJOINER_DEBUG_ENABLED)) {
23
+ Mage::log($e->getMessage(), null, 'rejoiner.log');
24
+ }
25
+ }
26
+ }
27
+ }
28
+ if ($params['coupon_code']) {
29
+ $cart->getQuote()->setCouponCode($params['coupon_code'])->collectTotals()->save();;
30
+ }
31
+ $cart->save();
32
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
33
+
34
+ /** @var Rejoiner_Acr_Helper_Data $rejoinerHelper */
35
+ $rejoinerHelper = Mage::helper('rejoiner_acr');
36
+ $queryParams = array_merge($rejoinerHelper->returnGoogleAttributes(), $params);
37
+ $this->getResponse()->setRedirect(Mage::getUrl('checkout/cart/', array('_query' => $queryParams)));
38
+ }
39
+ }
app/code/community/Rejoiner/Acr/controllers/Adminhtml/RejoinerController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Rejoiner_Acr_Adminhtml_RejoinerController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ public function denyNotificationAction()
6
+ {
7
+ if ($this->getRequest()->getParam('isAjax', false)) {
8
+ Rejoiner_Acr_Model_Notification::saveNotificationViewed();
9
+ }
10
+ $this->getResponse()->setBody(Zend_Json::encode(array('deny_notification_saved' => 1)));
11
+ }
12
+
13
+ /**
14
+ * Check if user has enough privileges
15
+ *
16
+ * @return boolean
17
+ */
18
+ protected function _isAllowed()
19
+ {
20
+ return Mage::getSingleton('admin/session')->isAllowed('all');
21
+ }
22
+ }
app/code/community/Rejoiner/Acr/etc/config.xml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Rejoiner_Acr>
5
+ <version>1.2.1</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>trackOrderSuccessConversion</method>
56
+ </rejoiner_order_success>
57
+ </observers>
58
+ </checkout_onepage_controller_success_action>
59
+ <sales_quote_remove_item>
60
+ <observers>
61
+ <remove_cart_item>
62
+ <class>rejoiner_acr/observer</class>
63
+ <method>removeCartItem</method>
64
+ </remove_cart_item>
65
+ </observers>
66
+ </sales_quote_remove_item>
67
+ </events>
68
+ </frontend>
69
+ <admin>
70
+ <routers>
71
+ <adminhtml>
72
+ <args>
73
+ <modules>
74
+ <rejoiner_acr before="Mage_Adminhtml">Rejoiner_Acr_Adminhtml</rejoiner_acr>
75
+ </modules>
76
+ </args>
77
+ </adminhtml>
78
+ </routers>
79
+ </admin>
80
+ <adminhtml>
81
+ <translate>
82
+ <modules>
83
+ <Rejoiner_Acr>
84
+ <files>
85
+ <default>Rejoiner_Acr.csv</default>
86
+ </files>
87
+ </Rejoiner_Acr>
88
+ </modules>
89
+ </translate>
90
+ <layout>
91
+ <updates>
92
+ <rejoiner_acr>
93
+ <file>rejoiner_acr.xml</file>
94
+ </rejoiner_acr>
95
+ </updates>
96
+ </layout>
97
+ </adminhtml>
98
+ <default>
99
+ <checkout>
100
+ <rejoiner_acr>
101
+ <email>0</email>
102
+ <debug_enabled>1</debug_enabled>
103
+ </rejoiner_acr>
104
+ </checkout>
105
+ </default>
106
+ </config>
app/code/community/Rejoiner/Acr/etc/system.xml ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <checkout>
5
+ <groups>
6
+ <rejoiner_acr translate="label" module="rejoiner_acr">
7
+ <label>eCommerce Lifecycle Email by Rejoiner</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>Rejoiner 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
+ <api_key translate="label">
32
+ <label>Rejoiner API key</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>30</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </api_key>
39
+ <api_secret translate="label">
40
+ <label>Rejoiner API secret</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>40</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </api_secret>
47
+ <domain translate="label">
48
+ <label>Store Domain *</label>
49
+ <!--<comment>Required field</comment>-->
50
+ <validate>required-entry</validate>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>50</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </domain>
57
+ <track_numbers>
58
+ <label>Track Phone Numbers</label>
59
+ <frontend_type>select</frontend_type>
60
+ <comment>Enable this parameter if you want to track phone numbers.</comment>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>70</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </track_numbers>
67
+ <price_with_tax>
68
+ <label>Track Prices with Taxes</label>
69
+ <frontend_type>select</frontend_type>
70
+ <comment>Enable this parameter if you want to track price with taxes.</comment>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>75</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </price_with_tax>
77
+ <persist_forms>
78
+ <label>Persist Forms</label>
79
+ <frontend_type>select</frontend_type>
80
+ <comment>If a user returns to the cart, the form fields will repopulate with the data they previously entered (excludes credit card numbers).</comment>
81
+ <source_model>adminhtml/system_config_source_yesno</source_model>
82
+ <sort_order>80</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </persist_forms>
87
+ <coupon_code translate="label">
88
+ <label>Generate Coupon Code</label>
89
+ <frontend_type>select</frontend_type>
90
+ <source_model>adminhtml/system_config_source_yesno</source_model>
91
+ <sort_order>90</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </coupon_code>
96
+ <salesrule_model translate="label">
97
+ <label>Select Shopping Cart Price Rule</label>
98
+ <frontend_type>select</frontend_type>
99
+ <source_model>rejoiner_acr/system_config_source_salesrule</source_model>
100
+ <sort_order>100</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ </salesrule_model>
105
+ <thumbnail_size>
106
+ <label>Thumbnail Default Size</label>
107
+ <comment>Example format: 200x300.</comment>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>120</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>0</show_in_website>
112
+ <show_in_store>0</show_in_store>
113
+ </thumbnail_size>
114
+ <google_attributes translate="label">
115
+ <label>Google Analytics data</label>
116
+ <frontend_model>rejoiner_acr/adminhtml_preinstalled_form</frontend_model>
117
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
118
+ <sort_order>130</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ <depends><show_standard>0</show_standard></depends>
123
+ </google_attributes>
124
+ <custom_attributes translate="label">
125
+ <label>Custom parameters</label>
126
+ <frontend_model>rejoiner_acr/adminhtml_custom_form</frontend_model>
127
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
128
+ <sort_order>140</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ <depends><show_standard>0</show_standard></depends>
133
+ </custom_attributes>
134
+ <debug_enabled translate="label">
135
+ <label>Debug Mode</label>
136
+ <frontend_type>select</frontend_type>
137
+ <comment>Enable this parameter if you want to enabled debug extension.</comment>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <sort_order>150</sort_order>
140
+ <show_in_default>1</show_in_default>
141
+ <show_in_website>1</show_in_website>
142
+ <show_in_store>1</show_in_store>
143
+ </debug_enabled>
144
+ </fields>
145
+ </rejoiner_acr>
146
+ </groups>
147
+ </checkout>
148
+ </sections>
149
+ </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"/>
8
+ </reference>
9
+ </default>
10
+
11
+ </layout>
app/design/adminhtml/default/default/template/rejoiner_acr/notification.phtml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @see Rejoiner_Acr_Block_Adminhtml_Notification
4
+ */
5
+ ?>
6
+ <?php if ($this->canShow()): ?>
7
+ <?php $secure = Mage::helper('rejoiner_acr')->checkHttps(); ?>
8
+ <script type="text/javascript">
9
+ function denyRejoinerNotification() {
10
+ new Ajax.Request('<?php echo $this->getUrl('*/rejoiner/denyNotification', array('_current' => true, '_secure' => $secure)); ?>', {
11
+ method: 'post',
12
+ onComplete: function(transport) {
13
+ if (200 == transport.status) {
14
+ if ($('rejoiner_notification'))
15
+ $('rejoiner_notification').remove();
16
+ }
17
+ }
18
+ });
19
+ }
20
+ </script>
21
+ <div id="rejoiner_notification" class="notification-global notification-global-notice">
22
+ <strong>Rejoiner:</strong> <?php echo $this->helper('rejoiner_acr')->__('It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email') ?> <a href="mailto:support@rejoiner.com" >support@rejoiner.com</a><?php echo $this->helper('rejoiner_acr')->__(' to verify that your Rejoiner tags are injecting properly') ?>. <a href="#" onclick="denyRejoinerNotification(); return false;"><?php echo $this->helper('rejoiner_acr')->__('Never show this message again') ?></a>
23
+ </div>
24
+ <?php endif; ?>
app/design/frontend/base/default/layout/rejoiner_acr.xml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+
5
+ <default>
6
+ <reference name="head">
7
+ <block type="rejoiner_acr/base" name="rejoiner_base" before="-">
8
+ <action method="setTemplate" ifconfig="checkout/rejoiner_acr/enabled"><template>rejoiner_acr/base.phtml</template></action>
9
+ <block type="rejoiner_acr/customer" name="rejoiner_customer" template="rejoiner_acr/customer.phtml" />
10
+ </block>
11
+ </reference>
12
+ </default>
13
+
14
+ <catalog_product_view>
15
+ <reference name="rejoiner_base">
16
+ <block type="rejoiner_acr/product" name="rejoiner_product" template="rejoiner_acr/product.phtml" />
17
+ </reference>
18
+ </catalog_product_view>
19
+
20
+ <checkout_cart_index>
21
+ <update handle="rejoiner_acr_tracking"/>
22
+ </checkout_cart_index>
23
+
24
+ <rejoiner_acr_tracking>
25
+ <reference name="rejoiner_base">
26
+ <block type="rejoiner_acr/snippets" name="rejoiner_tracking" before="-">
27
+ <action method="setTemplate" ifconfig="checkout/rejoiner_acr/enabled"><template>rejoiner_acr/tracking.phtml</template></action>
28
+ </block>
29
+ </reference>
30
+ </rejoiner_acr_tracking>
31
+
32
+ <rejoiner_acr_conversion>
33
+ <reference name="rejoiner_base">
34
+ <block type="rejoiner_acr/conversion" name="rejoiner_conversion" before="-">
35
+ <action method="setTemplate" ifconfig="checkout/rejoiner_acr/enabled"><template>rejoiner_acr/conversion.phtml</template></action>
36
+ </block>
37
+ </reference>
38
+ </rejoiner_acr_conversion>
39
+
40
+ <checkout_onepage_index>
41
+ <update handle="rejoiner_acr_tracking"/>
42
+ </checkout_onepage_index>
43
+
44
+ <onestepcheckout_index_index>
45
+ <update handle="rejoiner_acr_tracking"/>
46
+ </onestepcheckout_index_index>
47
+
48
+ <checkout_multishipping_addresses>
49
+ <update handle="rejoiner_acr_tracking"/>
50
+ </checkout_multishipping_addresses>
51
+
52
+ <gomage_checkout_onepage_index>
53
+ <update handle="rejoiner_acr_tracking"/>
54
+ </gomage_checkout_onepage_index>
55
+
56
+ <checkout_onepage_success>
57
+ <update handle="rejoiner_acr_conversion"/>
58
+ </checkout_onepage_success>
59
+
60
+ <checkout_multishipping_success>
61
+ <update handle="rejoiner_acr_conversion"/>
62
+ </checkout_multishipping_success>
63
+
64
+ <aitcheckout_checkout_default>
65
+ <update handle="rejoiner_acr_tracking"/>
66
+ </aitcheckout_checkout_default>
67
+
68
+ <aitcheckout_checkout_index>
69
+ <update handle="rejoiner_acr_tracking"/>
70
+ </aitcheckout_checkout_index>
71
+
72
+ <firecheckout_index_index>
73
+ <update handle="rejoiner_acr_tracking"/>
74
+ </firecheckout_index_index>
75
+
76
+ <firecheckout_index_updatecheckout>
77
+ <update handle="rejoiner_acr_tracking"/>
78
+ </firecheckout_index_updatecheckout>
79
+
80
+ <firecheckout_index_saveorder>
81
+ <update handle="rejoiner_acr_tracking"/>
82
+ </firecheckout_index_saveorder>
83
+
84
+ <onepagecheckout_index_success>
85
+ <update handle="rejoiner_acr_tracking"/>
86
+ </onepagecheckout_index_success>
87
+
88
+ <onepagecheckout_index_updatecheckout>
89
+ <update handle="rejoiner_acr_tracking"/>
90
+ </onepagecheckout_index_updatecheckout>
91
+
92
+ <opc_index_index>
93
+ <update handle="rejoiner_acr_tracking"/>
94
+ </opc_index_index>
95
+
96
+ <checkout_prime_index>
97
+ <update handle="rejoiner_acr_tracking"/>
98
+ </checkout_prime_index>
99
+
100
+ </layout>
app/design/frontend/base/default/template/rejoiner_acr/base.phtml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Rejoiner_Acr_Block_Snippets */
3
+ ?>
4
+ <script type="text/javascript">
5
+ var _rejoiner = _rejoiner || [];
6
+ _rejoiner.push(["setAccount", "<?php echo $this->helper('rejoiner_acr')->getRejoinerSiteId() ?>"]);
7
+ _rejoiner.push(["setDomain", "<?php echo $this->helper('rejoiner_acr')->getDomain() ?>"]);
8
+
9
+ <?php echo $this->getChildHtml();?>
10
+
11
+ (function() {
12
+ var s = document.createElement('script'); s.type = 'text/javascript';
13
+ s.async = true;
14
+ s.src = 'https://cdn.rejoiner.com/js/v4/rejoiner.lib.js';
15
+ var x = document.getElementsByTagName('script')[0];
16
+ x.parentNode.insertBefore(s, x);
17
+ })();
18
+ </script>
19
+
20
+ <?php if ($removedItems = $this->helper('rejoiner_acr')->checkRemovedItem()): ?>
21
+ <script type="text/javascript">
22
+ /** removeCartItem **/
23
+ //<![CDATA[
24
+ <?php foreach ($removedItems as $item): ?>
25
+ _rejoiner.push(['removeCartItem', {product_id: '<?php echo $item ?>'}]);
26
+ <?php endforeach; ?>
27
+ //]]>
28
+ </script>
29
+ <?php endif; ?>
app/design/frontend/base/default/template/rejoiner_acr/conversion.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var Rejoiner_Acr_Block_Conversion $this */
3
+ ?>
4
+ <?php $card = array(
5
+ 'cart_data' => $this->getCartData(),
6
+ 'cart_items' => $this->getCartItems()
7
+
8
+ ); ?>
9
+ _rejoiner.push(['sendConversion', <?php echo str_replace('\\/', '/', json_encode($card)); ?>]);
app/design/frontend/base/default/template/rejoiner_acr/customer.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Rejoiner_Acr_Block_Customer */
3
+ ?>
4
+ _rejoiner.push(['setCustomerEmail', <?php echo $this->getCustomerEmail(); ?>]);
5
+ _rejoiner.push(['setCustomerData', <?php echo $this->getCustomerInfo(); ?>]);
app/design/frontend/base/default/template/rejoiner_acr/product.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /* @var $this Rejoiner_Acr_Block_Product */
3
+ ?>
4
+ _rejoiner.push(['trackProductView', <?php echo $this->getCurrentProductInfo() ?>]);
app/design/frontend/base/default/template/rejoiner_acr/tracking.phtml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /** @var Rejoiner_Acr_Block_Snippets $this */ ?>
2
+ <?php
3
+ /** @var Rejoiner_Acr_Helper_Data $rejoinerHelper */
4
+ $rejoinerHelper = $this->helper('rejoiner_acr');
5
+ /** @var Mage_Checkout_Helper_Cart $cartHelper */
6
+ $cartHelper = Mage::helper('checkout/cart');
7
+ ?>
8
+ <?php if ($rejoinerHelper->getTrackNumberEnabled()): ?>
9
+ _rejoiner.push(["trackNumbers"]);
10
+ <?php endif; ?>
11
+ <?php if ($rejoinerHelper->getPersistFormsEnabled()): ?>
12
+ _rejoiner.push(["persistForms"]);
13
+ <?php endif; ?>
14
+
15
+ <?php if ($cartHelper->getCart()->getSummaryQty()): ?>
16
+ _rejoiner.push(["setCartData", <?php echo str_replace('\\/', '/', json_encode($this->getCartData())); ?>]);
17
+ <?php foreach ($this->getCartItems() as $item): ?>
18
+ _rejoiner.push(["setCartItem", <?php echo str_replace('\\/', '/', json_encode($item)); ?>]);
19
+ <?php endforeach; ?>
20
+ <?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,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ "Rejoiner Abandoned Cart Recovery","Rejoiner Abandoned Cart Recovery"
2
+ "Rejoiner site-id","Rejoiner site-id"
3
+ "Rejoiner API key","Rejoiner API key"
4
+ "Rejoiner API secret","Rejoiner API secret"
5
+ "It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email","It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email"
6
+ "to verify that your Rejoiner tags are injecting properly", "to verify that your Rejoiner tags are injecting properly"
7
+ "Never show this message again", "Never show this message again"
8
+ "Remove this notification","Remove this notification"
9
+ "Generate Coupon Code","Generate Coupon Code"
10
+ "Select Shopping Cart Price Rule","Select Shopping Cart Price Rule"
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rejoiner</name>
4
- <version>1.2.0</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>Migrated to updated JS lib v4</notes>
12
  <authors><author><name>Mike</name><user>rejoiner</user><email>mike@rejoiner.com</email></author></authors>
13
- <date>2016-09-21</date>
14
- <time>10:21:18</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Rejoiner_Acr.xml" hash=""/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash=""/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash=""/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash=""/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Rejoiner</name>
4
+ <version>1.2.1</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>Passing customer name to the Rejoiner service</notes>
12
  <authors><author><name>Mike</name><user>rejoiner</user><email>mike@rejoiner.com</email></author></authors>
13
+ <date>2016-09-22</date>
14
+ <time>12:50:14</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"><dir name="Custom"><file name="Form.php" hash="9aa505a9a27584d241fcfae803ca5d1a"/></dir><dir name="Form"><dir name="Field"><file name="Source.php" hash="4cfc6c0c33e5090efb825c68bd46f3b2"/></dir></dir><file name="Notification.php" hash="9755c2b45ce39bfa6e731fad9210a9c8"/><dir name="Preinstalled"><file name="Form.php" hash="9a7928e2e659e7b337fc54f0cdcc6c7a"/></dir></dir><file name="Base.php" hash="955a15b1881e5f8c298424f4b5fe4082"/><file name="Conversion.php" hash="b42b63140dbb7e67cd1dd224e8319b50"/><file name="Customer.php" hash="a28692e87c0c510053a8af65782371d3"/><file name="Product.php" hash="c44351a0d0283631463c14d4e132da8f"/><file name="Snippets.php" hash="cb634e2b368fe54e160618b4651b7c12"/></dir><dir name="Helper"><file name="Data.php" hash="c72a8a6d99bd1ccebbb157c45029e4e9"/></dir><dir name="Model"><file name="Notification.php" hash="fcaa63417db72268528fed03066ff808"/><file name="Observer.php" hash="aa49bd5d35234bf43973e6f578dba942"/><dir name="Resource"><file name="Setup.php" hash="48f66ad159e3d10a21cc04a980ca923e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salesrule.php" hash="43ec14e93984bf1160900754f61668f5"/></dir></dir></dir></dir><dir name="controllers"><file name="AddbyskuController.php" hash="78bc6382ac0f8d59020fa924f6e238c2"/><file name="AddtocartController.php" hash="4eb895c63658ba68c94952178a8bbb1c"/><dir name="Adminhtml"><file name="RejoinerController.php" hash="0c1a1df3d91d5596ae4026c484a4bd1f"/></dir></dir><dir name="etc"><file name="config.xml" hash="571a057b4e2fc08b0c6ca94793fe4df7"/><file name="system.xml" hash="13cdcf93f5638abf82c1499db974dec5"/></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="03be091dcc6dfc203871ecd4bddad362"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="base.phtml" hash="98288f08530dfd42edb75ec6558f65b4"/><file name="conversion.phtml" hash="ebe3e1c4cba407bd73f74dd551e82bcf"/><file name="customer.phtml" hash="8037067aa44942175b660c1f3af0ff1f"/><file name="product.phtml" hash="f52bf4de76279a5a07711d8430031187"/><file name="tracking.phtml" hash="786720850765d3296c6e4cb5e7baf521"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="eae0005d21a98027d5be43ab548f220d"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="notification.phtml" hash="3a3872e6434bf7d2ca7fa0edfe6f9726"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash="9015e31d97b9bc4746bc0a5241f8013b"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>7.0.9</max></php></required></dependencies>
18
  </package>