Monetate_Track - Version 1.0.0

Version Notes

First stable version

Download this release

Release Info

Developer Monetate, Inc.
Extension Monetate_Track
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Monetate/Track/Block/Abstract.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Abstract Block with general functionality
23
+ */
24
+ abstract class Monetate_Track_Block_Abstract extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * Returns HTML content to display
28
+ *
29
+ * @return string
30
+ */
31
+ abstract protected function _getMonetateHtml();
32
+
33
+ /**
34
+ * Render block HTML
35
+ *
36
+ * @return string
37
+ */
38
+ protected function _toHtml()
39
+ {
40
+ if (Mage::getStoreConfigFlag('monetate/configuration/enable_tracking')) {
41
+ return $this->_getMonetateHtml();
42
+ }
43
+ return '';
44
+ }
45
+ }
app/code/community/Monetate/Track/Block/AddCartRows.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Block with 'addCartRows' method implementation
23
+ *
24
+ * This block is independent of the other blocks because
25
+ * there are special caching considerations for it.
26
+ */
27
+ class Monetate_Track_Block_AddCartRows extends Monetate_Track_Block_Abstract
28
+ {
29
+ /**
30
+ * Render block HTML
31
+ *
32
+ * @return string
33
+ */
34
+ protected function _getMonetateHtml()
35
+ {
36
+ $cartItems = $this->_getCartItems();
37
+ if (count($cartItems)) {
38
+ $html = '
39
+ <!-- Begin Monetate ExpressTag - AddCartRows -->
40
+ <script type="text/javascript">
41
+ //<![CDATA[
42
+ window.monetateData.cartRows = ' . $this->helper('core')->jsonEncode($cartItems) . ';
43
+ //]]>
44
+ </script>
45
+ <!-- End Monetate ExpressTag -->
46
+ ';
47
+ return $html;
48
+ }
49
+ return '';
50
+ }
51
+
52
+ /**
53
+ * Get items currently in the customers cart
54
+ *
55
+ * @return array
56
+ */
57
+ protected function _getCartItems()
58
+ {
59
+ $cartItems = array();
60
+ $quote = Mage::getModel('checkout/cart')->getQuote();
61
+ if ($quote->hasItems()) {
62
+ $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
63
+ foreach ($quote->getAllItems() as $item) {
64
+ if (($item->getParentItem() && $item->getParentItem()->getProduct()->getTypeId() != 'configurable')
65
+ || $item->getProduct()->getTypeId() == 'configurable') {
66
+ continue;
67
+ } elseif ($item->getParentItem()
68
+ && $item->getParentItem()->getProduct()->getTypeId() == 'configurable') {
69
+ $price = $item->getParentItem()->getPrice();
70
+ $qty = (int) $item->getParentItem()->getQty();
71
+ } else {
72
+ $price = $item->getPrice();
73
+ $qty = (int) $item->getQty();
74
+ }
75
+ $sku = str_replace(' ', '', $this->helper('core/string')->truncate($item->getSku(), 32, ''));
76
+ $cartItems[] = array(
77
+ 'productId' => $item->getProductId(),
78
+ 'quantity' => $qty,
79
+ 'unitPrice' => number_format($price, '2', '.', ''),
80
+ 'currency' => $currencyCode,
81
+ 'sku' => $sku,
82
+ );
83
+ }
84
+ }
85
+ return $cartItems;
86
+ }
87
+ }
app/code/community/Monetate/Track/Block/Init.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Block with Monetate tag initialization functionality
23
+ */
24
+ class Monetate_Track_Block_Init extends Monetate_Track_Block_Abstract
25
+ {
26
+ /**
27
+ * Render block HTML
28
+ *
29
+ * @return string
30
+ */
31
+ protected function _getMonetateHtml()
32
+ {
33
+ $html = Mage::getStoreConfig('monetate/configuration/tag');
34
+ $html .= '
35
+ <!-- Begin Monetate ExpressTag - Init -->
36
+ <script type="text/javascript">
37
+ //<![CDATA[
38
+ window.monetateQ = window.monetateQ || [];
39
+ window.monetateData = window.monetateData || {};
40
+ window.monetateData.pageType = "'.$this->_getPageType().'";
41
+ //]]>
42
+ </script>
43
+ <!-- End Monetate ExpressTag -->
44
+ ';
45
+ return $html;
46
+ }
47
+
48
+ /**
49
+ * Get page identifier
50
+ *
51
+ * @return string
52
+ */
53
+ protected function _getPageType()
54
+ {
55
+ $pageIdentifier = $this->getAction()->getFullActionName();
56
+ switch ($pageIdentifier) {
57
+ /**
58
+ * Home Page / Catalog Pages
59
+ */
60
+ case 'cms_index_index':
61
+ return 'main';
62
+ case 'catalog_category_view':
63
+ $category = Mage::registry('current_category');
64
+ if ($category && $category->getId() && $category->getDisplayMode() == 'PAGE') {
65
+ return 'category';
66
+ }
67
+ return 'index';
68
+ case 'catalog_product_view':
69
+ return 'product';
70
+ case 'catalogsearch_result_index':
71
+ case 'catalogsearch_advanced_result':
72
+ return 'search';
73
+
74
+ /**
75
+ * Account Pages
76
+ */
77
+ case 'customer_account_login':
78
+ return 'login';
79
+ case 'customer_account_create':
80
+ return 'signup';
81
+ case 'customer_account_index':
82
+ return 'account';
83
+ case 'sales_order_view':
84
+ return 'orderstatus';
85
+ case 'wishlist_index_index':
86
+ case 'wishlist_index_share':
87
+ return 'wishlist';
88
+
89
+ /**
90
+ * Cart/Checkout
91
+ */
92
+ case 'checkout_cart_index':
93
+ return 'cart';
94
+ case 'checkout_onepage_index':
95
+ if ($this->helper('customer')->isLoggedIn()) {
96
+ return 'billing';
97
+ }
98
+ return 'checkoutLogin';
99
+ case 'checkout_onepage_success':
100
+ return 'purchase';
101
+ case 'checkout_multishipping_login':
102
+ return 'checkoutLogin';
103
+ case 'checkout_multishipping_register':
104
+ return 'signup';
105
+ case 'checkout_multishipping_addresses':
106
+ case 'checkout_multishipping_address_newShipping':
107
+ case 'checkout_multishipping_address_editShipping':
108
+ case 'checkout_multishipping_shipping':
109
+ return 'shipping';
110
+ case 'checkout_multishipping_billing':
111
+ case 'checkout_multishipping_address_selectBilling':
112
+ case 'checkout_multishipping_address_newBilling':
113
+ case 'checkout_multishipping_address_editBilling':
114
+ return 'billing';
115
+ case 'checkout_multishipping_overview':
116
+ return 'checkout';
117
+ case 'checkout_multishipping_success':
118
+ return 'purchase';
119
+ }
120
+ return 'unknown';
121
+ }
122
+ }
app/code/community/Monetate/Track/Block/TrackData.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Block with 'trackData' method implementation
23
+ */
24
+ class Monetate_Track_Block_TrackData extends Monetate_Track_Block_Abstract
25
+ {
26
+ /**
27
+ * Push items to render
28
+ */
29
+ protected $_pushItems = array();
30
+
31
+ /**
32
+ * Render block HTML
33
+ *
34
+ * @return string
35
+ */
36
+ protected function _getMonetateHtml()
37
+ {
38
+ //Start Javascript
39
+ $html = '
40
+ <!-- Begin Monetate ExpressTag - TrackData -->
41
+ <script type="text/javascript">
42
+ //<![CDATA[
43
+ window.monetateQ.push(["setPageType", window.monetateData.pageType]);
44
+ if(window.monetateData.cartRows) window.monetateQ.push(["addCartRows", window.monetateData.cartRows]);';
45
+
46
+ //Add Push Items
47
+ $this->addPushItem('trackData');
48
+ foreach ($this->_pushItems as $key => $data) {
49
+ if ($data === null) {
50
+ $html .= '
51
+ window.monetateQ.push(["' . $key . '"]);';
52
+ } else {
53
+ $html .= '
54
+ window.monetateQ.push(["' . $key . '", ' . $this->helper('core')->jsonEncode($data) . ']);';
55
+ }
56
+ }
57
+
58
+ //Add Onepage Checkout Observer
59
+ if ($this->getOnepageEnabled()) {
60
+ $html .= '
61
+
62
+ if (window.checkout != undefined && window.checkout.accordion != undefined
63
+ && typeof window.checkout.accordion.openSection === "function") {
64
+ window.checkout.accordion.openSection = function(section){
65
+ Accordion.prototype.openSection.call(this, section);
66
+ var map = { "opc-login":"checkoutLogin", "opc-billing":"billing", "opc-shipping":"shipping",
67
+ "opc-shipping_method":"shipping", "opc-payment":"billing", opc-review":"checkout" };
68
+ window.monetateData.pageType = map[this.currentSection] || "unknown";
69
+ window.monetateQ.push(["setPageType", window.monetateData.pageType]);
70
+ if(window.monetateData.cartRows) window.monetateQ.push(["addCartRows", window.monetateData.cartRows]);
71
+ window.monetateQ.push(["trackData"]);
72
+ };
73
+ }';
74
+ }
75
+
76
+ //Finish Javascript
77
+ $html .= '
78
+ //]]>
79
+ </script>
80
+ <!-- End Monetate ExpressTag -->
81
+ ';
82
+ return $html;
83
+ }
84
+
85
+ /**
86
+ * Edit item to push data
87
+ *
88
+ * @param string $key
89
+ * @param mixed $data
90
+ */
91
+ public function addPushItem($key, $data = null)
92
+ {
93
+ $this->_pushItems[$key] = $data;
94
+ }
95
+
96
+ /**
97
+ * Implement 'addCategories' functionality
98
+ */
99
+ public function addCategories()
100
+ {
101
+ $category = Mage::registry('current_category');
102
+ if ($category->getId()) {
103
+ $this->addPushItem('addCategories', array($category->getId()));
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Implement 'addProducts' functionality
109
+ *
110
+ * @param Mage_Catalog_Model_Resource_Product_Collection $collection
111
+ */
112
+ public function addProducts($collection)
113
+ {
114
+ if ($collection instanceof Varien_Data_Collection) {
115
+ $productIds = $collection->getColumnValues('entity_id');
116
+ if (count($productIds)) {
117
+ $this->addPushItem('addProducts', $productIds);
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Implement 'addProductDetails' functionality
124
+ */
125
+ public function addProductDetails()
126
+ {
127
+ $product = Mage::registry('current_product');
128
+ if ($product->getId()) {
129
+ $productIds = array($product->getId());
130
+ if ($product->getTypeId() == 'grouped') {
131
+ $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
132
+ if ($associatedProducts) {
133
+ $productIds = array();
134
+ foreach ($associatedProducts as $associatedProduct) {
135
+ $productIds[] = $associatedProduct->getId();
136
+ }
137
+ }
138
+ }
139
+ $this->addPushItem('addProductDetails', $productIds);
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Implement 'addPurchaseRows' functionality
145
+ */
146
+ public function addPurchaseRows($orderIds)
147
+ {
148
+ if (is_array($orderIds)) {
149
+ $purchasedRows = array();
150
+ foreach ($orderIds as $orderId) {
151
+ $order = Mage::getModel('sales/order')->load($orderId);
152
+ if ($order->getId()) {
153
+ $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
154
+ foreach ($order->getAllItems() as $item) {
155
+ $price = $qty = 0;
156
+ $parent = $item->getParentItem();
157
+ if (($parent !== null && $parent->getProductType() != 'configurable')
158
+ || $item->getProductType() == 'configurable') {
159
+ continue;
160
+ } elseif ($parent && $parent->getProductType() == 'configurable') {
161
+ $price = $item->getParentItem()->getPrice();
162
+ $qty = (int) $item->getParentItem()->getQtyOrdered();
163
+ } else {
164
+ $price = $item->getPrice();
165
+ $qty = (int) $item->getQtyOrdered();
166
+ }
167
+ $sku = str_replace(' ', '', $this->helper('core/string')->truncate($item->getSku(), 32, ''));
168
+ $purchasedRows[] = array(
169
+ 'purchaseId' => $order->getIncrementId(),
170
+ 'productId' => $item->getProductId(),
171
+ 'quantity' => (int) $qty,
172
+ 'unitPrice' => number_format($price, '2', '.', ''),
173
+ 'currency' => $currencyCode,
174
+ 'sku' => $sku,
175
+ );
176
+ }
177
+ }
178
+ }
179
+ if (count($purchasedRows)) {
180
+ $this->addPushItem('addPurchaseRows', $purchasedRows);
181
+ }
182
+ }
183
+ }
184
+ }
app/code/community/Monetate/Track/Helper/Data.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Monetate_Track module's default helper
23
+ */
24
+ class Monetate_Track_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+ }
app/code/community/Monetate/Track/Model/Adminhtml/ExportProductFeed.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Export product feed settings model
23
+ */
24
+ class Monetate_Track_Model_Adminhtml_ExportProductFeed extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * Outputs comment under the element in configuration
28
+ *
29
+ * @param Mage_Core_Model_Config_Element $element
30
+ * @param string $currentValue
31
+ *
32
+ * @return string
33
+ */
34
+ public function getCommentText(Mage_Core_Model_Config_Element $element, $currentValue)
35
+ {
36
+ $helper = Mage::helper('monetate_track');
37
+ $result = '<a id="monetate_sftp_test_connection" href="#" onclick="sftp_connection_test();">' . $helper->__('Test SFTP Connection') . '</a><br />';
38
+ $result .= '<a id="monetate_export_run" href="#" onclick="product_feed_export()">' . $helper->__('Run Product Feed Export') . '</a><br />';
39
+ $result .= $helper->__('Product Feed Data Exports Statuses file is located in {{base_dir}}/var/monetate.log<br />');
40
+ $result .= $helper->__('Product Feed Data Export Detailed files are located in {{base_dir}}/var/monetate/<br />');
41
+ $result .= '<script type="text/javascript">';
42
+ $result .= "
43
+ function sftp_connection_test()
44
+ {
45
+ parameters = {
46
+ host: '" . Mage::getStoreConfig('monetate/export/monetate_sftp_host') . "',
47
+ username: $('monetate_export_sftp_user').getValue(),
48
+ password: $('monetate_export_sftp_password').getValue(),
49
+ port: '" . Mage::getStoreConfig('monetate/export/monetate_sftp_port') . "',
50
+ timeout: '" . Mage::getStoreConfig('monetate/export/monetate_sftp_timeout') . "'
51
+ };
52
+ send_ajax_request('" . Mage::helper('adminhtml')->getUrl('monetate_track/adminhtml_sftp_connection/test') . "', parameters, 'monetate_sftp_test_connection', 'monetate_sftp_test_connection_result');
53
+ }
54
+
55
+ function product_feed_export()
56
+ {
57
+ parameters = {};
58
+ send_ajax_request('" . Mage::helper('adminhtml')->getUrl('monetate_track/adminhtml_productfeed/export') . "', parameters, 'monetate_export_run', 'monetate_export_run_result');
59
+ }
60
+
61
+ function send_ajax_request(url, parameters, buttonId, resultId)
62
+ {
63
+ if ($(resultId) == undefined) {
64
+ $(buttonId).insert({after: '<span id=\'' + resultId + '\' class=\'bold\'>&nbsp;Processing</span>'});
65
+ } else {
66
+ $(resultId).update('&nbsp;" . $helper->__('Processing') . "');
67
+ $(resultId).style.color = 'black';
68
+ }
69
+ new Ajax.Request(url, {
70
+ method: 'post',
71
+ parameters: parameters,
72
+ timeout: 3000,
73
+ onSuccess: function(response) {
74
+ if (response.responseText == 'Success') {
75
+ $(resultId).update('&nbsp;" . $helper->__('Success') . "');
76
+ $(resultId).style.color = 'green';
77
+ } else {
78
+ $(resultId).update('&nbsp;' + '" . $helper->__('Fail') . "');
79
+ $(resultId).style.color = 'red';
80
+ responseText = response.responseText
81
+ .replace(/(<([^>]+)>)/ig, '')
82
+ .replace(/^\\s*$[\\n\\r]{1,}/gm, '')
83
+ .split('\\n')[0];
84
+ console.log(responseText);
85
+ }
86
+ },
87
+ onFailure: function(response) {
88
+ $(resultId).update('&nbsp;" . $helper->__('Fail') . "');
89
+ $(resultId).style.color = 'red';
90
+ },
91
+ });
92
+ }";
93
+ $result .= '</script>';
94
+ return $result;
95
+ }
96
+ }
app/code/community/Monetate/Track/Model/Observer.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Monetate_Track module's observer
23
+ */
24
+ class Monetate_Track_Model_Observer
25
+ {
26
+ /**
27
+ * Add 'addProductsBlock' block's HTML to blocks' HTML with type 'catalog/product_list'
28
+ *
29
+ * @param Varien_Event_Observer $observer
30
+ */
31
+ public function observeProductListCollection(Varien_Event_Observer $observer) {
32
+ $block = Mage::app()->getLayout()->getBlock('monetate.track.track.data');
33
+ if ($block instanceof Monetate_Track_Block_TrackData) {
34
+ $block->addProducts($observer->getCollection());
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Add Purchase Rows to page
40
+ *
41
+ * @param Varien_Event_Observer $observer
42
+ */
43
+ public function observeOrderSuccess(Varien_Event_Observer $observer)
44
+ {
45
+ $block = Mage::app()->getLayout()->getBlock('monetate.track.track.data');
46
+ if ($block instanceof Monetate_Track_Block_TrackData) {
47
+ $block->addPurchaseRows($observer->getOrderIds());
48
+ }
49
+ }
50
+ }
app/code/community/Monetate/Track/Model/PageCache/Container.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Container model for blocks that should not be cached
23
+ */
24
+ class Monetate_Track_Model_PageCache_Container extends Enterprise_PageCache_Model_Container_Advanced_Quote
25
+ {
26
+ /**
27
+ * Cache tag prefix
28
+ */
29
+ const CACHE_TAG_PREFIX = 'monetate_track_';
30
+
31
+ /**
32
+ * Get identifier from cookies
33
+ *
34
+ * @return string
35
+ */
36
+ protected function _getIdentifier()
37
+ {
38
+ return $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CART, '')
39
+ . $this->_getCookieValue(Enterprise_PageCache_Model_Cookie::COOKIE_CUSTOMER, '');
40
+ }
41
+
42
+ /**
43
+ * Render block content
44
+ *
45
+ * @return string
46
+ */
47
+ protected function _renderBlock()
48
+ {
49
+ $blockClass = $this->_placeholder->getAttribute('block');
50
+ $block = new $blockClass;
51
+ return $block->toHtml();
52
+ }
53
+ }
app/code/community/Monetate/Track/Model/ProductFeed.php ADDED
@@ -0,0 +1,537 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Export products functionality
23
+ */
24
+ class Monetate_Track_Model_ProductFeed extends Mage_Core_Model_Abstract
25
+ {
26
+ /** Feed specification version */
27
+ const PRODUCT_FEED_SPECIFICATION_VERSION = '5.0';
28
+
29
+ /** Feed export files storage directory name */
30
+ const PRODUCT_FEED_DIR = 'monetate';
31
+
32
+ /** @var array Keys are product attributes, that are placed in product data array, and XML nodes' names as values */
33
+ protected $_dataAttrs = array(
34
+ 'product_id' => 'entity_id',
35
+ 'product_name' => 'name',
36
+ 'product_description' => 'description',
37
+ );
38
+
39
+ /** @var array Attributes to load for the product */
40
+ protected $_productAttrs = array(
41
+ 'type_id', 'name', 'description', 'image', 'small_image',
42
+ 'price', 'special_price', 'special_from_date', 'special_to_date'
43
+ );
44
+
45
+ /** @var array Cache of Product Type Instances */
46
+ protected $_productTypeInstances = array();
47
+
48
+ /** @var Varien_Io_File */
49
+ protected $_filesystem;
50
+
51
+ /**
52
+ * Set variables and open connection with local filesystem
53
+ *
54
+ * @see Varien_Object::_construct()
55
+ */
56
+ protected function _construct()
57
+ {
58
+ $this->setFilename('product-feed-export-' . date('y-m-d-H-i', time()) . '.xml');
59
+ $this->setProductModel(Mage::getSingleton('catalog/product'));
60
+ $this->setXmlDir(Mage::getBaseDir('var') . DS . self::PRODUCT_FEED_DIR . DS);
61
+ $this->setExportResult(true);
62
+ $this->_openFilesystemConnection();
63
+ return parent::_construct();
64
+ }
65
+
66
+ /**
67
+ * Export function
68
+ *
69
+ * @param bool $isLaunchedManually
70
+ * @return string|bool
71
+ */
72
+ public function export($isLaunchedManually = false)
73
+ {
74
+ $message = 'Export process failed';
75
+ $result = false;
76
+ $exportEnabled = (bool) Mage::getStoreConfig('monetate/export/enable_cron');
77
+ if ($exportEnabled || $isLaunchedManually) {
78
+ Mage::log('Export process started', null, 'monetate.log', true);
79
+
80
+ $doc = new DOMDocument('1.0', 'UTF-8');
81
+ // Write XML header to the file
82
+ $this->_saveXmlLocally($doc, false, false);
83
+ // Write 'catalog' opening node and version node
84
+ $this->_saveXmlLocally(false, $this->_getXmlStartAsText(), false);
85
+
86
+ // Process the product collection
87
+ $products = $this->getProductModel()->getCollection()->addAttributeToSelect($this->_productAttrs, 'left');
88
+ $select = $products->getSelect();
89
+ unset($products);
90
+ Mage::getSingleton('core/resource_iterator')
91
+ ->walk($select, array(array($this, 'productCallback')));
92
+
93
+ // Write 'catalog' closing node
94
+ $result = (bool) $this->_saveXmlLocally(false, $this->_getXmlEndAsText(), false);
95
+
96
+ if ($result) {
97
+ $message = 'Export process completed. Data saved in ' . $this->getFilename();
98
+ if (!$this->_uploadXml()) {
99
+ $message .= ' (File not uploaded via SFTP)';
100
+ }
101
+ }
102
+ }
103
+ Mage::log($message, null, 'monetate.log', true);
104
+ if (!$result) {
105
+ $result = $message;
106
+ }
107
+ return $result;
108
+ }
109
+
110
+ /**
111
+ * Get XML document's beginning as a text
112
+ *
113
+ * @return string
114
+ */
115
+ protected function _getXmlStartAsText()
116
+ {
117
+ return '<catalog><version>' . self::PRODUCT_FEED_SPECIFICATION_VERSION . '</version>';
118
+ }
119
+
120
+ /**
121
+ * Get XML document's end as a text
122
+ *
123
+ * @return string
124
+ */
125
+ protected function _getXmlEndAsText()
126
+ {
127
+ return '</catalog>';
128
+ }
129
+
130
+ /**
131
+ * Callback for walk() function. Run for each product.
132
+ *
133
+ * @param array $args
134
+ */
135
+ public function productCallback($args)
136
+ {
137
+ // Init Product (without loading)
138
+ $product = $this->getProductModel()
139
+ ->reset()
140
+ ->setData($args['row']);
141
+ $this->setProductTypeInstance($product);
142
+
143
+ // Skip Virtual Products
144
+ if ($product->getTypeId() === 'virtual') {
145
+ return;
146
+ }
147
+
148
+ // Load Product Options
149
+ if ($product->getHasOptions()) {
150
+ foreach ($product->getProductOptionsCollection() as $option) {
151
+ $option->setProduct($product);
152
+ $product->addOption($option);
153
+ }
154
+ }
155
+
156
+ // Add Product to XML
157
+ $doc = new DOMDocument('1.0', 'UTF-8');
158
+ $this->_createProductAttrsNodes($doc, $product);
159
+ $result = (bool) $this->_saveXmlLocally($doc, false, $this->getFilename());
160
+ if (!$result) {
161
+ $this->setExportResult(false);
162
+ }
163
+ return;
164
+ }
165
+
166
+ /**
167
+ * ReDefine Product Type Instance to Product
168
+ *
169
+ * @param Mage_Catalog_Model_Product $product
170
+ */
171
+ public function setProductTypeInstance(Mage_Catalog_Model_Product $product)
172
+ {
173
+ $type = $product->getTypeId();
174
+ if (!isset($this->_productTypeInstances[$type])) {
175
+ $this->_productTypeInstances[$type] = Mage::getSingleton('catalog/product_type')
176
+ ->factory($product, true);
177
+ }
178
+ $product->setTypeInstance($this->_productTypeInstances[$type], true);
179
+ }
180
+
181
+ /**
182
+ * Create product attributes' nodes
183
+ *
184
+ * @param DOMDocument $doc
185
+ * @param Mage_Catalog_Model_Product $product
186
+ */
187
+ protected function _createProductAttrsNodes(DOMDocument $doc, Mage_Catalog_Model_Product $product)
188
+ {
189
+ $stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());
190
+ $productNode = $doc->createElement('product');
191
+ $doc->appendChild($productNode);
192
+
193
+ // product_id, product_name, product_description
194
+ foreach ($this->_dataAttrs as $key => $value) {
195
+ $node = $doc->createElement($key, htmlspecialchars(strip_tags($product->getData($value))));
196
+ $productNode->appendChild($node);
197
+ }
198
+
199
+ // price, alt_price
200
+ $this->_createPriceNodes($product, 'price', $doc, $productNode);
201
+
202
+ // url
203
+ $this->_createUrlNode($product, $doc, $productNode);
204
+
205
+ // product_image_url
206
+ $this->_createImageUrlNodes($product, 'product_image_url', $doc, $productNode);
207
+
208
+ // categories
209
+ $this->_createCategoriesNodes($product, $doc, $productNode);
210
+
211
+ // brand_name
212
+ $this->_createBrandNode($product, $doc, $productNode);
213
+
214
+ // endcap_image_url
215
+ $this->_createImageUrlNodes($product, 'endcap_image_url', $doc, $productNode);
216
+
217
+ // search_image_url
218
+ $this->_createImageUrlNodes($product, 'search_image_url', $doc, $productNode);
219
+
220
+ // skus
221
+ $this->_createSkuNodes($product, $doc, $productNode);
222
+
223
+ // availability
224
+ $this->_createStockNodes($stock, 'availability', 'is_in_stock', $doc, $productNode);
225
+
226
+ // ats
227
+ $this->_createStockNodes($stock, 'ats', 'min_qty', $doc, $productNode);
228
+
229
+ // allocation
230
+ $this->_createStockNodes($stock, 'allocation', 'qty', $doc, $productNode);
231
+
232
+ // variations
233
+ $this->_createVariationsNodes($product, $doc, $productNode);
234
+
235
+ // rating
236
+ $this->_createRatingNode($product, $doc, $productNode);
237
+ }
238
+
239
+ /**
240
+ * Create category nodes
241
+ *
242
+ * @param Mage_Catalog_Model_Product $product
243
+ * @param DOMDocument $doc
244
+ * @param DOMElement $productNode
245
+ */
246
+ protected function _createCategoriesNodes(Mage_Catalog_Model_Product $product, DOMDocument $doc,
247
+ DOMElement $productNode)
248
+ {
249
+ $categoriesNode = $doc->createElement('categories');
250
+ $productNode->appendChild($categoriesNode);
251
+ $categories = $product->getCategoryCollection()->addAttributeToSelect('name');
252
+ foreach ($categories as $category) {
253
+ $categoryNode = $doc->createElement('category');
254
+ $categoriesNode->appendChild($categoryNode);
255
+ $categoryNameNode = $doc->createElement('category_name', htmlspecialchars($category->getName()));
256
+ $categoryIdNode = $doc->createElement('category_id', $category->getId());
257
+ $categoryNode->appendChild($categoryIdNode);
258
+ $categoryNode->appendChild($categoryNameNode);
259
+ }
260
+ }
261
+
262
+ /**
263
+ * Create variations nodes
264
+ *
265
+ * @param Mage_Catalog_Model_Product $product
266
+ * @param DOMDocument $doc
267
+ * @param DOMElement $productNode
268
+ */
269
+ protected function _createVariationsNodes(Mage_Catalog_Model_Product $product, DOMDocument $doc,
270
+ DOMElement $productNode)
271
+ {
272
+ $variationsNode = $doc->createElement('variations');
273
+ $productNode->appendChild($variationsNode);
274
+ if ($product->getTypeId() === 'configurable') {
275
+ $configurableAttributes = $product->getTypeInstance(true)
276
+ ->getConfigurableAttributesAsArray($product);
277
+ foreach ($configurableAttributes as $attr) {
278
+ $label = strtolower(preg_replace('|[^a-z]*|i', '', $attr['label']));
279
+ $attributeNode = $doc->createElement($label);
280
+ $variationsNode->appendChild($attributeNode);
281
+ foreach ($attr['values'] as $option) {
282
+ $label = strtolower(preg_replace('|[^a-z]*|i', '', $option['label']));
283
+ $optionNode = $doc->createElement('option', $label);
284
+ $attributeNode->appendChild($optionNode);
285
+ }
286
+ }
287
+ }
288
+ if ($product->getOptions()) {
289
+ foreach ($product->getOptions() as $option) {
290
+ $title = strtolower(preg_replace('|[^a-z]*|i', '', $option->getTitle()));
291
+ $attributeNode = $doc->createElement($title);
292
+ $variationsNode->appendChild($attributeNode);
293
+ $values = $option->getValues();
294
+ foreach ($values as $v) {
295
+ $optionNode = $doc->createElement('option', $v->getSku());
296
+ $attributeNode->appendChild($optionNode);
297
+ }
298
+ }
299
+ }
300
+ }
301
+
302
+ /**
303
+ * Create price nodes
304
+ *
305
+ * @param Mage_Catalog_Model_Product $product
306
+ * @param string $type
307
+ * @param DOMDocument $doc
308
+ * @param DOMElement $productNode
309
+ */
310
+ protected function _createPriceNodes(Mage_Catalog_Model_Product $product, $type, DOMDocument $doc,
311
+ DOMElement $productNode)
312
+ {
313
+ list($altPrice, $price) = $this->_getProductPrice($product, $type);
314
+ $node = $doc->createElement('price', number_format($price, 2, '.', ''));
315
+ $productNode->appendChild($node);
316
+ $node = $doc->createElement('alt_price', number_format($altPrice, 2, '.', ''));
317
+ $productNode->appendChild($node);
318
+ }
319
+
320
+ /**
321
+ * Return product price
322
+ *
323
+ * @param Mage_Catalog_Model_Product $product
324
+ *
325
+ * @return array
326
+ */
327
+ protected function _getProductPrice(Mage_Catalog_Model_Product $product)
328
+ {
329
+ if ($product->getTypeId() === 'bundle') {
330
+ $priceModel = $product->getPriceModel();
331
+ $stores = Mage::app()->getStores();
332
+ $price = 0;
333
+ foreach ($stores as $store) {
334
+ $product->setStoreId($store->getId());
335
+ if (method_exists($priceModel, 'getTotalPrices')) {
336
+ list($minimalPrice, $maximalPrice) = $priceModel->getTotalPrices($product, null, null, false);
337
+ } else {
338
+ list($minimalPrice, $maximalPrice) = $priceModel->getPricesDependingOnTax($product);
339
+ }
340
+ if ($price == 0 || $price > (float) $minimalPrice) {
341
+ $price = $minimalPrice;
342
+ }
343
+ }
344
+ return array($price, $product->getFinalPrice());
345
+ } elseif ($product->getTypeId() === 'grouped') {
346
+ $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product);
347
+ $price = array();
348
+ foreach ($associatedProducts as $item) {
349
+ $price[] = $item->getFinalPrice();
350
+ }
351
+ sort($price);
352
+ return array($price[0], $product->getFinalPrice());
353
+ } elseif ($product->getTypeId() === 'giftcard' && $product->getGiftcardAmounts()) {
354
+ $prices = Mage::getBlockSingleton('enterprise_giftcard/catalog_product_view_type_giftcard')
355
+ ->getAmounts($product);
356
+ if ($prices) {
357
+ return $prices[0];
358
+ }
359
+ return array(0, $product->getFinalPrice());
360
+ } else {
361
+ return array($product->getPrice(), $product->getFinalPrice());
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Create ats, availability, allocation nodes
367
+ *
368
+ * @param Mage_CatalogInventory_Model_Stock_Item $stock
369
+ * @param string $nodeName
370
+ * @param string $attrName
371
+ * @param DOMDocument $doc
372
+ * @param DOMElement $productNode
373
+ */
374
+ protected function _createStockNodes(Mage_CatalogInventory_Model_Stock_Item $stock, $nodeName, $attrName,
375
+ DOMDocument $doc, DOMElement $productNode)
376
+ {
377
+ if ($attrName == 'is_in_stock') {
378
+ $value = $stock->getData('is_in_stock') ? 'In Stock' : 'Out of Stock';
379
+ } else {
380
+ $value = (int) $stock->getData($attrName);
381
+ }
382
+ $node = $doc->createElement($nodeName, $value);
383
+ $productNode->appendChild($node);
384
+ }
385
+
386
+ /**
387
+ * Create image urls nodes
388
+ *
389
+ * @param Mage_Catalog_Model_Product $product
390
+ * @param string $type
391
+ * @param DOMDocument $doc
392
+ * @param DOMElement $productNode
393
+ */
394
+ protected function _createImageUrlNodes(Mage_Catalog_Model_Product $product, $type, DOMDocument $doc,
395
+ DOMElement $productNode)
396
+ {
397
+ $url = '';
398
+ try {
399
+ if ($type == 'endcap_image_url') {
400
+ $url = Mage::getDesign()
401
+ ->getSkinUrl('images/catalog/product/placeholder/small_image.jpg', array('_area' => 'frontend'));
402
+ } elseif ($type == 'product_image_url' && $product->getData('image')
403
+ && $product->getData('image') != 'no_selection') {
404
+ $url = Mage::helper('catalog/image')->init($product, 'image');
405
+ } elseif ($type == 'search_image_url' && $product->getData('small_image')
406
+ && $product->getData('small_image') != 'no_selection') {
407
+ $url = Mage::helper('catalog/image')->init($product, 'small_image');
408
+ }
409
+ $url = str_replace(Mage::getStoreConfig('web/unsecure/base_url'), Mage::getStoreConfig('web/secure/base_url'), $url);
410
+ $imageUrlNode = $doc->createElement($type, $url);
411
+ $productNode->appendChild($imageUrlNode);
412
+ } catch (Exception $e) {
413
+ Mage::log($e->getMessage(), null, 'monetate.log', true);
414
+ }
415
+ }
416
+
417
+ /**
418
+ * Create product url node
419
+ *
420
+ * @param Mage_Catalog_Model_Product $product
421
+ * @param DOMDocument $doc
422
+ * @param DOMElement $productNode
423
+ */
424
+ protected function _createUrlNode(Mage_Catalog_Model_Product $product, DOMDocument $doc, DOMElement $productNode)
425
+ {
426
+ $url = $product->getProductUrl();
427
+ $urlNode = $doc->createElement('url', $url);
428
+ $productNode->appendChild($urlNode);
429
+ }
430
+
431
+ /**
432
+ * Create rating node
433
+ *
434
+ * @param Mage_Catalog_Model_Product $product
435
+ * @param DOMDocument $doc
436
+ * @param DOMElement $productNode
437
+ */
438
+ protected function _createRatingNode(Mage_Catalog_Model_Product $product, DOMDocument $doc, DOMElement $productNode)
439
+ {
440
+ $summaryData = Mage::getModel('review/review_summary')->load($product->getId());
441
+ $ratingNode = $doc->createElement('rating', (int) $summaryData->getRatingSummary());
442
+ $productNode->appendChild($ratingNode);
443
+ }
444
+
445
+ /**
446
+ * Create skus nodes
447
+ *
448
+ * @param Mage_Catalog_Model_Product $product
449
+ * @param DOMDocument $doc
450
+ * @param DOMElement $productNode
451
+ */
452
+ protected function _createSkuNodes(Mage_Catalog_Model_Product $product, DOMDocument $doc, DOMElement $productNode)
453
+ {
454
+ $skusNode = $doc->createElement('skus');
455
+ $skuNode = $doc->createElement('sku', $product->getSku());
456
+ $skusNode->appendChild($skuNode);
457
+ $productNode->appendChild($skusNode);
458
+ }
459
+
460
+ /**
461
+ * Create brand node
462
+ *
463
+ * @param Mage_Catalog_Model_Product $product
464
+ * @param DOMDocument $doc
465
+ * @param DOMElement $productNode
466
+ */
467
+ protected function _createBrandNode(Mage_Catalog_Model_Product $product, DOMDocument $doc, DOMElement $productNode)
468
+ {
469
+ $brandNode = $doc->createElement('brand_name', htmlspecialchars($product->getAttributeText('manufacturer')));
470
+ $productNode->appendChild($brandNode);
471
+ }
472
+
473
+ /**
474
+ * Saves document on server
475
+ *
476
+ * @param DOMDocument|false $doc
477
+ * @param string|false $content
478
+ * @param bool $excludeHeader
479
+ *
480
+ * @return bool|string
481
+ */
482
+ protected function _saveXmlLocally($doc, $content, $excludeHeader = true)
483
+ {
484
+ $result = false;
485
+ $this->_filesystem->checkAndCreateFolder($this->getXmlDir());
486
+ if ($excludeHeader && !$content) {
487
+ $content = $doc->saveXml($doc->documentElement);
488
+ } elseif (!$content) {
489
+ $content = $doc->saveXml();
490
+ }
491
+ if ($content) {
492
+ $result = @file_put_contents($this->getXmlDir() . $this->getFilename(), $content, FILE_APPEND);
493
+ }
494
+ return $result;
495
+ }
496
+
497
+ /**
498
+ * Upload document to Monetate server via SFTP
499
+ *
500
+ * @return string|bool
501
+ */
502
+ protected function _uploadXml()
503
+ {
504
+ // Close connection with local filesystem
505
+ $this->_filesystem->cd(getcwd());
506
+
507
+ $accessData = array(
508
+ 'host' => Mage::getStoreConfig('monetate/export/monetate_sftp_host'),
509
+ 'username' => Mage::getStoreConfig('monetate/export/sftp_user'),
510
+ 'password' => Mage::getStoreConfig('monetate/export/sftp_password'),
511
+ 'port' => Mage::getStoreConfig('monetate/export/monetate_sftp_port'),
512
+ 'timeout' => Mage::getStoreConfig('monetate/export/monetate_sftp_timeout'),
513
+ );
514
+ if (empty($accessData['host']) || empty($accessData['username']) || empty($accessData['password'])) {
515
+ return false;
516
+ }
517
+ include('phpseclib/Net/SFTP.php');
518
+ $netSftpConnection = new Net_SFTP($accessData['host'], $accessData['port'], $accessData['timeout']);
519
+ if (!$netSftpConnection->login($accessData['username'], $accessData['password'])) {
520
+ Mage::log('Login on SFTP server failed', null, 'monetate.log', true);
521
+ } else if ($netSftpConnection->put('/upload/' . $this->getFilename(), $this->getXmlDir() . $this->getFilename(),
522
+ NET_SFTP_LOCAL_FILE)) {
523
+ return $this->getXmlDir() . $this->getFilename();
524
+ }
525
+ return false;
526
+ }
527
+
528
+ /**
529
+ * Open connection with local filesystem
530
+ */
531
+ protected function _openFilesystemConnection()
532
+ {
533
+ $this->_filesystem = new Varien_Io_File;
534
+ $this->_filesystem->open();
535
+ $this->_filesystem->cd($this->_filesystem->pwd());
536
+ }
537
+ }
app/code/community/Monetate/Track/controllers/Adminhtml/ProductfeedController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * Product feed data econtroller
23
+ */
24
+ class Monetate_Track_Adminhtml_ProductfeedController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /**
27
+ * Export action
28
+ */
29
+ public function exportAction()
30
+ {
31
+ if ($this->getRequest()->isAjax()) {
32
+ try {
33
+ $result = Mage::getSingleton('monetate_track/productFeed')->export(true);
34
+ if ($result === true) {
35
+ echo 'Success';
36
+ } else {
37
+ echo $result;
38
+ }
39
+ } catch (Exception $e) {
40
+ Mage::log($e->getMessage(), null, 'monetate.log', true);
41
+ echo $this->__($e->getMessage());
42
+ }
43
+ } else {
44
+ return $this->_redirect('*/*');
45
+ }
46
+ }
47
+ }
app/code/community/Monetate/Track/controllers/Adminhtml/Sftp/ConnectionController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Monetate
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to support@monetate.com so we can send you a copy immediately.
14
+ *
15
+ * @category Monetate
16
+ * @package Monetate_Track
17
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ /**
22
+ * SFTP connection controller
23
+ */
24
+ class Monetate_Track_Adminhtml_Sftp_ConnectionController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /**
27
+ * Test SFTP connection
28
+ *
29
+ * @return string
30
+ */
31
+ public function testAction()
32
+ {
33
+ $connection = new Varien_Io_Sftp();
34
+ try {
35
+ $connection->open($this->getRequest()->getPost());
36
+ echo $this->__('Success');
37
+ } catch (Exception $e) {
38
+ echo $this->__('Fail');
39
+ }
40
+ }
41
+ }
app/code/community/Monetate/Track/etc/adminhtml.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Monetate
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@monetate.com so we can send you a copy immediately.
15
+ *
16
+ * @category Monetate
17
+ * @package Monetate_Track
18
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <acl>
24
+ <resources>
25
+ <admin>
26
+ <children>
27
+ <system>
28
+ <children>
29
+ <config>
30
+ <children>
31
+ <monetate>
32
+ <title>Monetate Configuration</title>
33
+ </monetate>
34
+ </children>
35
+ </config>
36
+ </children>
37
+ </system>
38
+ </children>
39
+ </admin>
40
+ </resources>
41
+ </acl>
42
+ </config>
app/code/community/Monetate/Track/etc/cache.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Monetate
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@monetate.com so we can send you a copy immediately.
15
+ *
16
+ * @category Monetate
17
+ * @package Monetate_Track
18
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <placeholders>
24
+ <monetate_track_add_cart_rows>
25
+ <block>monetate_track/addCartRows</block>
26
+ <name>monetate.track.add.cart.rows</name>
27
+ <placeholder>MONETATE_TRACK_PLACEHOLDER</placeholder>
28
+ <container>Monetate_Track_Model_PageCache_Container</container>
29
+ <cache_lifetime>86400</cache_lifetime>
30
+ </monetate_track_add_cart_rows>
31
+ </placeholders>
32
+ </config>
app/code/community/Monetate/Track/etc/config.xml ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Monetate
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@monetate.com so we can send you a copy immediately.
15
+ *
16
+ * @category Monetate
17
+ * @package Monetate_Track
18
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Monetate_Track>
25
+ <version>1.0.0</version>
26
+ </Monetate_Track>
27
+ </modules>
28
+ <global>
29
+ <blocks>
30
+ <monetate_track>
31
+ <class>Monetate_Track_Block</class>
32
+ </monetate_track>
33
+ </blocks>
34
+ <helpers>
35
+ <monetate_track>
36
+ <class>Monetate_Track_Helper</class>
37
+ </monetate_track>
38
+ </helpers>
39
+ <models>
40
+ <monetate_track>
41
+ <class>Monetate_Track_Model</class>
42
+ </monetate_track>
43
+ </models>
44
+ </global>
45
+ <admin>
46
+ <routers>
47
+ <monetate_track>
48
+ <use>admin</use>
49
+ <args>
50
+ <frontName>monetate_track</frontName>
51
+ <module>Monetate_Track</module>
52
+ </args>
53
+ </monetate_track>
54
+ </routers>
55
+ </admin>
56
+ <frontend>
57
+ <events>
58
+ <catalog_block_product_list_collection>
59
+ <observers>
60
+ <monetate_track_product_list>
61
+ <type>singleton</type>
62
+ <class>monetate_track/observer</class>
63
+ <method>observeProductListCollection</method>
64
+ </monetate_track_product_list>
65
+ </observers>
66
+ </catalog_block_product_list_collection>
67
+ <checkout_onepage_controller_success_action>
68
+ <observers>
69
+ <monetate_track_order_success>
70
+ <class>monetate_track/observer</class>
71
+ <method>observeOrderSuccess</method>
72
+ </monetate_track_order_success>
73
+ </observers>
74
+ </checkout_onepage_controller_success_action>
75
+ <checkout_multishipping_controller_success_action>
76
+ <observers>
77
+ <monetate_track_order_success>
78
+ <class>monetate_track/observer</class>
79
+ <method>observeOrderSuccess</method>
80
+ </monetate_track_order_success>
81
+ </observers>
82
+ </checkout_multishipping_controller_success_action>
83
+ </events>
84
+ <layout>
85
+ <updates>
86
+ <monetate_track>
87
+ <file>monetate/track.xml</file>
88
+ </monetate_track>
89
+ </updates>
90
+ </layout>
91
+ </frontend>
92
+ <default>
93
+ <monetate>
94
+ <configuration>
95
+ <monetate_enable_tracking>0</monetate_enable_tracking>
96
+ </configuration>
97
+ <export>
98
+ <monetate_product_feed_enable_cron>0</monetate_product_feed_enable_cron>
99
+ <monetate_sftp_host>sftp.monetate.net</monetate_sftp_host>
100
+ <monetate_sftp_port>22</monetate_sftp_port>
101
+ <monetate_sftp_timeout>10</monetate_sftp_timeout>
102
+ </export>
103
+ </monetate>
104
+ </default>
105
+ <crontab>
106
+ <jobs>
107
+ <monetate_product_feed_export>
108
+ <schedule>
109
+ <cron_expr>0 1 * * *</cron_expr>
110
+ </schedule>
111
+ <run>
112
+ <model>monetate_track/productFeed::export</model>
113
+ </run>
114
+ </monetate_product_feed_export>
115
+ </jobs>
116
+ </crontab>
117
+ </config>
app/code/community/Monetate/Track/etc/system.xml ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Monetate
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@monetate.com so we can send you a copy immediately.
15
+ *
16
+ * @category Monetate
17
+ * @package Monetate_Track
18
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <sections>
24
+ <monetate translate="label" module="monetate_track">
25
+ <label>Monetate</label>
26
+ <tab>general</tab>
27
+ <sort_order>1002</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ <groups>
32
+ <configuration translate="label">
33
+ <label>Configuration</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>1</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <fields>
40
+ <tag translate="label">
41
+ <label>Monetate Tag</label>
42
+ <frontend_type>textarea</frontend_type>
43
+ <depends><enable_tracking>1</enable_tracking></depends>
44
+ <sort_order>2</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </tag>
49
+ <enable_tracking translate="label">
50
+ <label>Tracking Enabled</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>1</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </enable_tracking>
58
+ </fields>
59
+ </configuration>
60
+ <export translate="label">
61
+ <label>Export Product Feed</label>
62
+ <frontend_type>text</frontend_type>
63
+ <sort_order>2</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ <fields>
68
+ <sftp_user translate="label">
69
+ <label>Monetate SFTP Username</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>1</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ </sftp_user>
76
+ <sftp_password translate="label">
77
+ <label>Monetate SFTP Password</label>
78
+ <frontend_type>password</frontend_type>
79
+ <source_model>adminhtml/system_config_source_yesno</source_model>
80
+ <validate>validate-password</validate>
81
+ <sort_order>2</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </sftp_password>
86
+ <enable_cron translate="label">
87
+ <label>Product Feed Export On Schedule Enable</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <comment>
91
+ <model>monetate_track/adminhtml_exportProductFeed</model>
92
+ </comment>
93
+ <sort_order>3</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </enable_cron>
98
+ </fields>
99
+ </export>
100
+ </groups>
101
+ </monetate>
102
+ </sections>
103
+ </config>
app/design/frontend/base/default/layout/monetate/track.xml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Monetate
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@monetate.com so we can send you a copy immediately.
15
+ *
16
+ * @category Monetate
17
+ * @package Monetate_Track
18
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+
23
+ <!--
24
+ /**
25
+ * @category design
26
+ * @package base_default
27
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
28
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
+ */
30
+ -->
31
+ <layout version="0.1.0">
32
+ <default>
33
+ <reference name="head">
34
+ <block type="monetate_track/init" name="monetate.track.init" before="-" />
35
+ </reference>
36
+ <reference name="before_body_end">
37
+ <block type="monetate_track/trackData" name="monetate.track.track.data" after="-" />
38
+ <block type="monetate_track/addCartRows" name="monetate.track.add.cart.rows"
39
+ before="monetate.track.track.data">
40
+ </block>
41
+ </reference>
42
+ </default>
43
+ <catalog_category_view>
44
+ <reference name="monetate.track.track.data">
45
+ <action method="addCategories" />
46
+ </reference>
47
+ </catalog_category_view>
48
+ <catalog_product_view>
49
+ <reference name="monetate.track.track.data">
50
+ <action method="addProductDetails" />
51
+ </reference>
52
+ </catalog_product_view>
53
+ <checkout_onepage_index>
54
+ <reference name="monetate.track.track.data">
55
+ <action method="setOnepageEnabled"><value>1</value></action>
56
+ </reference>
57
+ </checkout_onepage_index>
58
+ </layout>
app/etc/modules/Monetate_Track.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Monetate
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@monetate.com so we can send you a copy immediately.
15
+ *
16
+ * @category Monetate
17
+ * @package Monetate_Track
18
+ * @copyright Copyright (c) 2014 Monetate, Inc. All rights reserved. (http://www.monetate.com)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Monetate_Track>
25
+ <active>true</active>
26
+ <codePool>community</codePool>
27
+ </Monetate_Track>
28
+ </modules>
29
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Monetate_Track</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>The official Monetate extension to fully integrate with Magento Community and Enterprise.</summary>
10
+ <description>The Monetate extension for Magento allows you to quickly and easily integrate Monetate with your Magento ecommerce storefront. Once integrated and with a valid account, all of Monetate features are enabled and available allowing you to create personalized site experiences across your site, conduct A/B and multivariate tests, and more.&#xD;
11
+ You'll be able to do this using the industry's most user-friendly testing, personalization, and optimization platform used by more of the largest and most successful ecommerce and retail brands to truly move and impact their business than any other platform.&#xD;
12
+ Monetate generates billions of dollars of new revenue for businesses, helping them grow 39% faster than the industry average. Brands such as Best Buy, Macy's, Patagonia, Dick's Sporting Goods, Godiva, Brooks Brothers, and QVC rely on Monetate to put the customer first, creating winning customer experiences that drive a sustained, competitive advantage.&#xD;
13
+ Monetate connects two crucial elements that have always been treated separately within organizations: knowledge about the customer and marketing actions to deliver a better experience. Delight your customers with winning customer experiences that build authentic relationships and drive new revenue across any channel, all within one seamless solution.</description>
14
+ <notes>First stable version</notes>
15
+ <authors><author><name>Monetate, Inc.</name><user>monetate</user><email>support@monetate.com</email></author></authors>
16
+ <date>2014-10-01</date>
17
+ <time>17:53:41</time>
18
+ <contents><target name="mageetc"><dir name="modules"><file name="Monetate_Track.xml" hash="6c81ac4e5e790df6a85c37a58032613d"/></dir></target><target name="magecommunity"><dir name="Monetate"><dir name="Track"><dir name="Block"><file name="Abstract.php" hash="87cfeb808d16ad10c598b8a80f7d026f"/><file name="AddCartRows.php" hash="768e20eb43a96c99228c256a1f43b8b1"/><file name="Init.php" hash="35b04cc2cf215409c5349f9a6e93da5d"/><file name="TrackData.php" hash="c6c71c7a286bfd87806c09130a8324c5"/></dir><dir name="Helper"><file name="Data.php" hash="6ef4229ef8a8ed453b073bb549ed74bf"/></dir><dir name="Model"><dir name="Adminhtml"><file name="ExportProductFeed.php" hash="b8e0a7bcec8b21a84657381147569b34"/></dir><file name="Observer.php" hash="4efbc69c863079d4503cd6adbd03db7e"/><dir name="PageCache"><file name="Container.php" hash="02022ffe338d675824edf699dd438380"/></dir><file name="ProductFeed.php" hash="54a32d71facd0f9d5e5dd3348c692787"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductfeedController.php" hash="0b91362fe5c4b545250906e79330a513"/><dir name="Sftp"><file name="ConnectionController.php" hash="f27ae84b166bebb453e7db46edffa649"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="bd7ab1fd0e73fb67e3d6db1a76c184af"/><file name="cache.xml" hash="4379b3e3846540c9fcbd561f05bd25fd"/><file name="config.xml" hash="8147f0fed3122783808ae605e37a0570"/><file name="system.xml" hash="86765ce44cd1624ca0d93f9e3f665d9a"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="monetate"><file name="track.xml" hash="b8344dfbdf718e4aa6ce0cd29508b7bd"/></dir></dir></dir></dir></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
21
+ </package>