Eyemagine_HubSpot - Version 1.1.7

Version Notes

v.1.1.7: Oct 28, 2016

- Added sync for cross-sell related data.
- Added sync for order comments and order status

Download this release

Release Info

Developer EYEMAGINE
Extension Eyemagine_HubSpot
Version 1.1.7
Comparing to
See all releases


Code changes from version 1.1.6 to 1.1.7

app/code/community/Eyemagine/HubSpot/Helper/Data.php CHANGED
@@ -128,6 +128,7 @@ class Eyemagine_HubSpot_Helper_Data extends Mage_Core_Helper_Abstract
128
  $categories = array();
129
  $related = array();
130
  $upsells = array();
 
131
 
132
  // load product details
133
  if ($item->getProductId()) {
@@ -170,6 +171,24 @@ class Eyemagine_HubSpot_Helper_Data extends Mage_Core_Helper_Abstract
170
  $upsells[$p->getId()] = $this->convertAttributeData($p);
171
  }
172
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  $categoryCollection = $product->getCategoryCollection()
175
  ->addAttributeToSelect('name')
@@ -187,6 +206,7 @@ class Eyemagine_HubSpot_Helper_Data extends Mage_Core_Helper_Abstract
187
 
188
  $product->setRelatedProducts($related);
189
  $product->setUpSellProducts($upsells);
 
190
  }
191
 
192
  $item->setData('product', $product);
128
  $categories = array();
129
  $related = array();
130
  $upsells = array();
131
+ $crossSells = array();
132
 
133
  // load product details
134
  if ($item->getProductId()) {
171
  $upsells[$p->getId()] = $this->convertAttributeData($p);
172
  }
173
  }
174
+
175
+
176
+ $crossSellCollection = $product->getCrossSellProductCollection()
177
+ ->addAttributeToSelect('name')
178
+ ->addAttributeToSelect('sku')
179
+ ->addAttributeToSelect('url_path')
180
+ ->addAttributeToSelect('image')
181
+ ->addAttributeToSelect('visibility')
182
+ ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
183
+ ->setPageSize($maxLimit);
184
+
185
+ foreach ($crossSellCollection as $p) {
186
+ $websiteIds = $p->getWebsiteIds();
187
+ if (in_array($websiteId, $websiteIds) || $multistore) {
188
+ $crossSells[$p->getId()] = $this->convertAttributeData($p);
189
+ }
190
+ }
191
+
192
 
193
  $categoryCollection = $product->getCategoryCollection()
194
  ->addAttributeToSelect('name')
206
 
207
  $product->setRelatedProducts($related);
208
  $product->setUpSellProducts($upsells);
209
+ $product->setCrossSellProducts($crossSells);
210
  }
211
 
212
  $item->setData('product', $product);
app/code/community/Eyemagine/HubSpot/controllers/Adminhtml/.DS_Store ADDED
Binary file
app/code/community/Eyemagine/HubSpot/controllers/LinkController.php CHANGED
@@ -83,60 +83,71 @@ class Eyemagine_HubSpot_LinkController extends Mage_Core_Controller_Front_Action
83
  ->setRedirect($url, ($permanent) ? 301 : 302)
84
  ->sendResponse();
85
  }
86
-
87
-
88
  /**
89
  * Resamples the product image and returns the contents as raw data
90
  */
91
  public function imageAction()
92
  {
93
- // set up min max of values for the resize (smallest 50, largest 640)
94
- $size = (int)($this->getRequest()->getParam('size'));
95
- $size = ($size > 0) ? min(max(50, $size), 640) : 100;
96
-
97
- // render the thumbnail and get the server path
98
- $product = $this->_initProduct(false);
99
- $helper = Mage::helper('catalog/image');
100
- $url = $helper->init($product, 'thumbnail')->resize($size ? min(max(50, $size), 640) : 100);
101
- $serverPath = str_replace(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB), '', (string)$url);
102
- $file = @realpath($serverPath);
103
- $pathinfo = pathinfo($url);
104
-
105
- // add the mime-type header
106
- switch ($pathinfo['extension']) {
107
- case 'jpg':
108
- header('Content-Type: image/jpeg');
109
- break;
110
- case 'png':
111
- header('Content-Type: image/png');
112
- break;
113
- case 'gif':
114
- header('Content-Type: image/gif');
115
- break;
116
- case 'xbm':
117
- header('Content-Type: image/x-xbitmap');
118
- break;
119
- case 'wbpm':
120
- header('Content-Type: image/vnd.wap.wbmp');
121
- break;
122
- default:
123
- header('Content-Type: image/jpeg');
124
- break;
125
- }
126
-
127
- // add the size header, and output
128
- if ($file && file_exists($file)) {
129
- header('Content-Length: ' . filesize($file));
130
- if (ob_get_level()) ob_end_clean();
131
- flush();
132
- readfile($file);
133
- } else {
134
- // alt delivery method that will take more system resources but is
135
- // unlikely to fail on servers running OS versions other than Linux
136
- echo file_get_contents($url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
138
-
139
- exit;
140
  }
141
 
142
 
83
  ->setRedirect($url, ($permanent) ? 301 : 302)
84
  ->sendResponse();
85
  }
86
+
 
87
  /**
88
  * Resamples the product image and returns the contents as raw data
89
  */
90
  public function imageAction()
91
  {
92
+ try {
93
+ // set up min max of values for the resize (smallest 50, largest 640)
94
+ $size = (int) ($this->getRequest()->getParam('size'));
95
+ $size = ($size > 0) ? min(max(50, $size), 640) : 100;
96
+
97
+ // render the thumbnail and get the server path
98
+ $product = $this->_initProduct(false);
99
+ $helper = Mage::helper('catalog/image');
100
+ $url = $helper->init($product, 'thumbnail')->resize($size ? min(max(50, $size), 640) : 100);
101
+ $serverPath = str_replace(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB), '', (string) $url);
102
+ $pathinfo = pathinfo($url);
103
+ $file = @realpath($serverPath);
104
+ // add the mime-type header
105
+ switch ($pathinfo['extension']) {
106
+ case 'jpg':
107
+ $content_type = 'image/jpeg';
108
+ break;
109
+ case 'png':
110
+ $content_type = 'image/png';
111
+ break;
112
+ case 'gif':
113
+ $content_type = 'image/gif';
114
+ break;
115
+ case 'xbm':
116
+ $content_type = 'image/x-xbitmap';
117
+ break;
118
+ case 'wbpm':
119
+ $content_type = 'image/vnd.wap.wbmp';
120
+ break;
121
+ default:
122
+ $content_type = 'image/jpeg';
123
+ break;
124
+ }
125
+
126
+ // add the size header, and output
127
+ if ($file && file_exists($file)) {
128
+ header('Content-Type: ' . $content_type);
129
+ header('Content-Length: ' . filesize($file));
130
+ if (ob_get_level())
131
+ ob_end_clean();
132
+ flush();
133
+ readfile($file);
134
+ } else {
135
+ if ($url && $content_type) {
136
+
137
+ $this->getResponse()
138
+ ->setHeader('Content-Type', $content_type)
139
+ ->setBody(file_get_contents((string) $url));
140
+ }
141
+ }
142
+ } catch (Exception $e) {
143
+
144
+ if ($url && $content_type) {
145
+
146
+ $this->getResponse()
147
+ ->setHeader('Content-Type', $content_type)
148
+ ->setBody(file_get_contents((string) $url));
149
+ }
150
  }
 
 
151
  }
152
 
153
 
app/code/community/Eyemagine/HubSpot/controllers/SyncController.php CHANGED
@@ -117,7 +117,8 @@ class Eyemagine_HubSpot_SyncController extends Mage_Core_Controller_Front_Action
117
  $this->_outputJson(array(
118
  'customers' => $customerData,
119
  'website' => $websiteId,
120
- 'store' => $storeId
 
121
  ));
122
  }
123
 
@@ -178,8 +179,16 @@ class Eyemagine_HubSpot_SyncController extends Mage_Core_Controller_Front_Action
178
  $result['shipping_address'] = $helper->convertAttributeData($order->getShippingAddress());
179
  $result['billing_address'] = $helper->convertAttributeData($order->getBillingAddress());
180
  $result['items'] = array();
181
-
182
- foreach ($order->getAllItems() as $item) {
 
 
 
 
 
 
 
 
183
  $helper->loadCatalogData($item, $storeId, $websiteId, $multistore, $maxAssociated);
184
  $result['items'][] = $helper->convertAttributeData($item);
185
  }
@@ -197,7 +206,8 @@ class Eyemagine_HubSpot_SyncController extends Mage_Core_Controller_Front_Action
197
 
198
  $this->_outputJson(array(
199
  'orders' => $ordersData,
200
- 'stores' => $stores
 
201
  ));
202
  }
203
 
117
  $this->_outputJson(array(
118
  'customers' => $customerData,
119
  'website' => $websiteId,
120
+ 'store' => $storeId,
121
+ 'start' => $start
122
  ));
123
  }
124
 
179
  $result['shipping_address'] = $helper->convertAttributeData($order->getShippingAddress());
180
  $result['billing_address'] = $helper->convertAttributeData($order->getBillingAddress());
181
  $result['items'] = array();
182
+ $result['comment'] = $order->getStatusHistoryCollection()->getFirstItem()->getComment();
183
+
184
+
185
+ $ordertItems = $order->getItemsCollection()
186
+
187
+ ->setOrder('base_price', Varien_Data_Collection::SORT_ORDER_DESC)
188
+ ->setPageSize($maxAssociated);
189
+
190
+
191
+ foreach ($ordertItems as $item) {
192
  $helper->loadCatalogData($item, $storeId, $websiteId, $multistore, $maxAssociated);
193
  $result['items'][] = $helper->convertAttributeData($item);
194
  }
206
 
207
  $this->_outputJson(array(
208
  'orders' => $ordersData,
209
+ 'stores' => $stores,
210
+ 'start' => $start
211
  ));
212
  }
213
 
app/code/community/Eyemagine/HubSpot/etc/config.xml CHANGED
@@ -15,7 +15,7 @@
15
  <config>
16
  <modules>
17
  <Eyemagine_HubSpot>
18
- <version>1.1.6</version>
19
  </Eyemagine_HubSpot>
20
  </modules>
21
  <global>
15
  <config>
16
  <modules>
17
  <Eyemagine_HubSpot>
18
+ <version>1.1.7</version>
19
  </Eyemagine_HubSpot>
20
  </modules>
21
  <global>
app/code/community/Eyemagine/HubSpot/readme.txt CHANGED
@@ -43,8 +43,9 @@ COMPATIBILITY:
43
  -------------------------------------------------------------------------------
44
  RELEASE NOTES:
45
  -------------------------------------------------------------------------------
46
- v.1.1.6: Sep 8, 2016
47
- - Improved performance for downloading order data.
 
48
 
49
  v.1.1.5: Sep 8, 2016
50
  - Fixed product and media url for multistores.
43
  -------------------------------------------------------------------------------
44
  RELEASE NOTES:
45
  -------------------------------------------------------------------------------
46
+ v.1.1.7: Oct 28, 2016
47
+ - Added sync for cross-sell related data.
48
+ - Added sync for order comments and order status
49
 
50
  v.1.1.5: Sep 8, 2016
51
  - Fixed product and media url for multistores.
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Eyemagine_HubSpot</name>
4
- <version>1.1.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.eyemaginetech.com/license">Custom</license>
7
  <channel>community</channel>
@@ -49,13 +49,14 @@ HubSpot's Social Inbox and Smart Content tools help you break out of the inbox a
49
  Attribute revenue generated to specific marketing channels and campaigns.&#xD;
50
  &#xD;
51
  HubSpot's suite of analytics and reporting tools allows you to quickly and easily see which traffic sources or marketing actions turned into revenue for you during any given time period. Generate a report in seconds and email it to anyone in the company--you can even set up recurring reports so everyone can keep track of the company's progress.</description>
52
- <notes>v.1.1.6: Sep 8, 2016&#xD;
53
  &#xD;
54
- - Improved performance for downloading order data.</notes>
 
55
  <authors><author><name>EYEMAGINE</name><user>eyemagine</user><email>andy@eyemaginetech.com</email></author></authors>
56
- <date>2016-09-08</date>
57
- <time>05:31:10</time>
58
- <contents><target name="magecommunity"><dir name="Eyemagine"><dir name="HubSpot"><dir name="Block"><dir name="Adminhtml"><dir name="Frontend"><dir name="Button"><file name="Regen.php" hash="da45b06b8577c597efd5d21954da7338"/><file name="._Regen.php" hash="03ec92c7aa4a80b83dab35ae888c547b"/></dir><dir name="Eyemagine"><file name="Info.php" hash="241764d8a2ef0cea19590ed1e278459f"/><file name="Support.php" hash="af9992b0108aa1b45f847cd00dfde88d"/><file name="Version.php" hash="7e587492716799a25b9a9c8a898d872a"/><file name="._Info.php" hash="ce0cf7ed20da8016624555bbb5968191"/><file name="._Support.php" hash="d7af6eacee8bbc688f3be8c5b681b7bb"/><file name="._Version.php" hash="aa0f9e438f113f370a375ec75e45dfdc"/></dir><file name="Utk.php" hash="ae331d527c62a9afc50dabc05dfda90f"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="dc9a89227ea1a103a272e4811062b51b"/></dir><dir name="Model"><file name="Observer.php" hash="b6324baf056a15b740db37596174c8e6"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Hubspot"><file name="IndexController.php" hash="ce74c1cbb68569a834c55e530884fdf3"/></dir></dir><file name="LinkController.php" hash="ae5c25108f9dd6a72d379e98137c1637"/><file name="SyncController.php" hash="b33a57535bb69c7dad12da033cdd508d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="30c1e3594efb50975820d190c6152122"/><file name="config.xml" hash="c36234ef9199111d61888db748e832b4"/><file name="system.xml" hash="e0d5b580d7094942555662d527c02dbc"/></dir><file name="readme.txt" hash="9e61a2529dcf21d3e45e3e59f44c0d52"/><dir name="sql"><dir name="eyehubspot_setup"><file name="mysql4-install-1.0.0.php" hash="a0f5a0a9fa39c641c70771ba1056be80"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eyemagine_HubSpot.xml" hash="0442e65d79b182a43b1cdb58e95e6e36"/></dir></target></contents>
59
  <compatible/>
60
  <dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php></required></dependencies>
61
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Eyemagine_HubSpot</name>
4
+ <version>1.1.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.eyemaginetech.com/license">Custom</license>
7
  <channel>community</channel>
49
  Attribute revenue generated to specific marketing channels and campaigns.&#xD;
50
  &#xD;
51
  HubSpot's suite of analytics and reporting tools allows you to quickly and easily see which traffic sources or marketing actions turned into revenue for you during any given time period. Generate a report in seconds and email it to anyone in the company--you can even set up recurring reports so everyone can keep track of the company's progress.</description>
52
+ <notes>v.1.1.7: Oct 28, 2016&#xD;
53
  &#xD;
54
+ - Added sync for cross-sell related data.&#xD;
55
+ - Added sync for order comments and order status</notes>
56
  <authors><author><name>EYEMAGINE</name><user>eyemagine</user><email>andy@eyemaginetech.com</email></author></authors>
57
+ <date>2016-10-31</date>
58
+ <time>18:38:36</time>
59
+ <contents><target name="magecommunity"><dir name="Eyemagine"><dir name="HubSpot"><dir name="Block"><dir name="Adminhtml"><dir name="Frontend"><dir name="Button"><file name="Regen.php" hash="da45b06b8577c597efd5d21954da7338"/><file name="._Regen.php" hash="03ec92c7aa4a80b83dab35ae888c547b"/></dir><dir name="Eyemagine"><file name="Info.php" hash="241764d8a2ef0cea19590ed1e278459f"/><file name="Support.php" hash="af9992b0108aa1b45f847cd00dfde88d"/><file name="Version.php" hash="7e587492716799a25b9a9c8a898d872a"/><file name="._Info.php" hash="ce0cf7ed20da8016624555bbb5968191"/><file name="._Support.php" hash="d7af6eacee8bbc688f3be8c5b681b7bb"/><file name="._Version.php" hash="aa0f9e438f113f370a375ec75e45dfdc"/></dir><file name="Utk.php" hash="ae331d527c62a9afc50dabc05dfda90f"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="80b353bad679602d68e939446c22d664"/></dir><dir name="Model"><file name="Observer.php" hash="b6324baf056a15b740db37596174c8e6"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Hubspot"><file name="IndexController.php" hash="ce74c1cbb68569a834c55e530884fdf3"/></dir><file name=".DS_Store" hash="99afa5d6f042ec44f5661080a02ed4ab"/></dir><file name="LinkController.php" hash="3179c792d39904a65f54cec8723ec331"/><file name="SyncController.php" hash="c43ffaffd5e7c050808be26b4c62a547"/></dir><dir name="etc"><file name="adminhtml.xml" hash="30c1e3594efb50975820d190c6152122"/><file name="config.xml" hash="7e6e59911946ba09dfc780fb28cceb24"/><file name="system.xml" hash="e0d5b580d7094942555662d527c02dbc"/></dir><file name="readme.txt" hash="c98856b20dfb7f5ab600164491bd8fa0"/><dir name="sql"><dir name="eyehubspot_setup"><file name="mysql4-install-1.0.0.php" hash="a0f5a0a9fa39c641c70771ba1056be80"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eyemagine_HubSpot.xml" hash="0442e65d79b182a43b1cdb58e95e6e36"/></dir></target></contents>
60
  <compatible/>
61
  <dependencies><required><php><min>5.3.0</min><max>7.0.0</max></php></required></dependencies>
62
  </package>