SimpleRelevance_Integration - Version 0.0.4

Version Notes

-- version 0.0.4
Bug fixes, new data on product import, debug facility

-- version 0.0.1
First release

Download this release

Release Info

Developer Magento Core Team
Extension SimpleRelevance_Integration
Version 0.0.4
Comparing to
See all releases


Code changes from version 0.0.1 to 0.0.4

app/code/community/SimpleRelevance/Integration/Model/Api.php CHANGED
@@ -178,9 +178,13 @@ class SimpleRelevance_Integration_Model_Api
178
  $data['async'] = $this->async;
179
 
180
  //Request data
181
- $data['data'] = json_encode(array($params));
182
 
183
  $url = $this->apiUrl . $method;
 
 
 
 
184
  $requestParams = http_build_query($data);
185
 
186
  $curlSession = curl_init();
@@ -198,8 +202,9 @@ class SimpleRelevance_Integration_Model_Api
198
 
199
  $result = curl_exec($curlSession);
200
 
201
- if(!$result){
202
 
 
203
  $errstr = curl_error($curlSession);
204
  $errno = curl_errno($curlSession);
205
 
@@ -233,4 +238,19 @@ class SimpleRelevance_Integration_Model_Api
233
 
234
  }
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
178
  $data['async'] = $this->async;
179
 
180
  //Request data
181
+ $data['data'] = json_encode(array($params), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
182
 
183
  $url = $this->apiUrl . $method;
184
+
185
+ $this->_log($url);
186
+ $this->_log($data);
187
+
188
  $requestParams = http_build_query($data);
189
 
190
  $curlSession = curl_init();
202
 
203
  $result = curl_exec($curlSession);
204
 
205
+ $this->_log($result);
206
 
207
+ if(!$result){
208
  $errstr = curl_error($curlSession);
209
  $errno = curl_errno($curlSession);
210
 
238
 
239
  }
240
 
241
+ /**
242
+ * Log data to debug log file
243
+ *
244
+ * @param mixed $data
245
+ * @return void
246
+ */
247
+ protected function _log($text)
248
+ {
249
+ if(!Mage::getStoreConfigFlag('simple_relevance/general/debug')){
250
+ return;
251
+ }
252
+
253
+ Mage::log($text, null, 'SimpleRelevance_Integration.log');
254
+ }
255
+
256
  }
app/code/community/SimpleRelevance/Integration/controllers/Adminhtml/ExportController.php CHANGED
@@ -68,14 +68,29 @@ class SimpleRelevance_Integration_Adminhtml_ExportController extends Mage_Adminh
68
 
69
  $smallImageUrl = '';
70
  if($product->getSmallImage()){
71
- $smallImageUrl = Mage::helper('catalog/image')->init($product, 'small_image')->resize(75);
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
 
74
  $dict = array(
75
- 'url_path' => $product->getUrlPath(),
 
76
  'sku' => $product->getSku(),
77
  'category_ids' => $product->getCategoryIds(),
78
- 'image_url' => (string)$smallImageUrl,
 
 
79
  );
80
  $data = array(
81
  'item_name' => $product->getName(),
68
 
69
  $smallImageUrl = '';
70
  if($product->getSmallImage()){
71
+ try{
72
+ $smallImageUrl = Mage::helper('catalog/image')->init($product, 'small_image')->resize(75);
73
+ }catch(Exception $e){
74
+ Mage::logException($e);
75
+ }
76
+ }
77
+ $baseImageUrl = '';
78
+ if($product->getImage()){
79
+ try{
80
+ $baseImageUrl = Mage::helper('catalog/image')->init($product, 'image');
81
+ }catch(Exception $e){
82
+ Mage::logException($e);
83
+ }
84
  }
85
 
86
  $dict = array(
87
+ 'item_url' => $product->getUrlPath(),
88
+ 'price' => $product->getPrice(),
89
  'sku' => $product->getSku(),
90
  'category_ids' => $product->getCategoryIds(),
91
+ 'image_url_small' => (string)$smallImageUrl,
92
+ 'image_url' => (string)$baseImageUrl,
93
+ 'description' => $product->getDescription(),
94
  );
95
  $data = array(
96
  'item_name' => $product->getName(),
app/code/community/SimpleRelevance/Integration/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <SimpleRelevance_Integration>
5
- <version>0.0.1</version>
6
  </SimpleRelevance_Integration>
7
  </modules>
8
  <global>
@@ -85,6 +85,7 @@
85
  <simple_relevance>
86
  <general>
87
  <active>0</active>
 
88
  </general>
89
  </simple_relevance>
90
  </default>
2
  <config>
3
  <modules>
4
  <SimpleRelevance_Integration>
5
+ <version>0.0.4</version>
6
  </SimpleRelevance_Integration>
7
  </modules>
8
  <global>
85
  <simple_relevance>
86
  <general>
87
  <active>0</active>
88
+ <debug>0</debug>
89
  </general>
90
  </simple_relevance>
91
  </default>
app/code/community/SimpleRelevance/Integration/etc/system.xml CHANGED
@@ -36,6 +36,16 @@
36
  <show_in_store>1</show_in_store>
37
  <comment><![CDATA[Your SimpleRelevance API Key.<br />You can find it on your SimpleRelevance admin panel under <i>Help and Support -> Your API Key</i>]]></comment>
38
  </apikey>
 
 
 
 
 
 
 
 
 
 
39
  </fields>
40
  </general>
41
  </groups>
36
  <show_in_store>1</show_in_store>
37
  <comment><![CDATA[Your SimpleRelevance API Key.<br />You can find it on your SimpleRelevance admin panel under <i>Help and Support -> Your API Key</i>]]></comment>
38
  </apikey>
39
+ <debug translate="label comment">
40
+ <label>Debug Mode</label>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>adminhtml/system_config_source_yesno</source_model>
43
+ <sort_order>30</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment><![CDATA[If enabled will log ALL API calls to <i>MAGENTO_ROOT/var/log/SimpleRelevance_Integration.log</i>]]></comment>
48
+ </debug>
49
  </fields>
50
  </general>
51
  </groups>
package.xml CHANGED
@@ -1,19 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SimpleRelevance_Integration</name>
4
- <version>0.0.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>SimpleRelevance integration module</summary>
10
  <description>Featuring customers, products and orders.</description>
11
- <notes>-- version 0.0.1
 
 
 
12
  First release</notes>
13
  <authors><author><name>SimpleRelevance DEV team</name><user>auto-converted</user><email>info@simplerelevance.com</email></author></authors>
14
- <date>2012-02-24</date>
15
- <time>10:56:21</time>
16
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="simple_relevance.xml" hash="f0d73f30b7aeff70f63b295327ac906c"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="simple_relevance"><dir name="images"><file name="box-tab.png" hash="208977131fcbe078f10af53295ac686c"/><file name="simplerelevance-header.png" hash="c25099645618a32b8fdb8d4d7786cf2c"/></dir><file name="css.css" hash="c354dd9c0e48bdb99089b1756058efc1"/><file name="js.js" hash="5831e6e503ebd86f93e07230b56a6d2f"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SimpleRelevance_Integration.csv" hash="05e3ba1c882990c307dbe510bc0bea36"/></dir></target><target name="mageetc"><dir name="modules"><file name="SimpleRelevance_Integration.xml" hash="6ad0b704a9e62de159f09babfe2482d5"/></dir></target><target name="magecommunity"><dir name="SimpleRelevance"><dir name="Integration"><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="aebfe1b8317830ddbffae80f07848198"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="18e9829f6252920f6bf01a5340377b3a"/><file name="config.xml" hash="c441f6bae9a08e8e7e4aac3eb3253143"/><file name="system.xml" hash="9021a2bcf95bc2e79b548d529134af09"/></dir><dir name="Helper"><file name="Data.php" hash="9c0aaa6454c1e3d72b0b88e6933ed500"/></dir><dir name="Model"><file name="Api.php" hash="6bac0e7ca347318e814ec67c225f1235"/><file name="Observer.php" hash="191abba7ea01505797b61b0f3bd8ab24"/><file name="Purchase.php" hash="f073c1b379a0946a96ee5fcbfda6cc47"/></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies/>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>SimpleRelevance_Integration</name>
4
+ <version>0.0.4</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>SimpleRelevance integration module</summary>
10
  <description>Featuring customers, products and orders.</description>
11
+ <notes>-- version 0.0.4
12
+ Bug fixes, new data on product import, debug facility
13
+
14
+ -- version 0.0.1
15
  First release</notes>
16
  <authors><author><name>SimpleRelevance DEV team</name><user>auto-converted</user><email>info@simplerelevance.com</email></author></authors>
17
+ <date>2012-04-09</date>
18
+ <time>12:08:16</time>
19
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="simple_relevance.xml" hash="f0d73f30b7aeff70f63b295327ac906c"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="simple_relevance"><dir name="images"><file name="box-tab.png" hash="208977131fcbe078f10af53295ac686c"/><file name="simplerelevance-header.png" hash="c25099645618a32b8fdb8d4d7786cf2c"/></dir><file name="css.css" hash="c354dd9c0e48bdb99089b1756058efc1"/><file name="js.js" hash="5831e6e503ebd86f93e07230b56a6d2f"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SimpleRelevance_Integration.csv" hash="05e3ba1c882990c307dbe510bc0bea36"/></dir></target><target name="mageetc"><dir name="modules"><file name="SimpleRelevance_Integration.xml" hash="6ad0b704a9e62de159f09babfe2482d5"/></dir></target><target name="magecommunity"><dir name="SimpleRelevance"><dir name="Integration"><dir name="controllers"><dir name="Adminhtml"><file name="ExportController.php" hash="d85775935a57432a0e673626a629f6b4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="18e9829f6252920f6bf01a5340377b3a"/><file name="config.xml" hash="63cad149856139d78344ce39ef0e6f3c"/><file name="system.xml" hash="638f6aac1d2d19b8b9d9ca4fed0065f5"/></dir><dir name="Helper"><file name="Data.php" hash="9c0aaa6454c1e3d72b0b88e6933ed500"/></dir><dir name="Model"><file name="Api.php" hash="3598b602c1adf8f425a57836a743e44f"/><file name="Observer.php" hash="191abba7ea01505797b61b0f3bd8ab24"/><file name="Purchase.php" hash="f073c1b379a0946a96ee5fcbfda6cc47"/></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies/>
22
  </package>