Swiftype_Swiftype - Version 1.0.2

Version Notes

Changelog:

* Ensure Magento product entity index batch upload limit used
* Ensure URI parameters are encoded
* Ensure Swiftype parameters (API key, engine key, engine slug) are stripped of invalid characters

Download this release

Release Info

Developer Swiftype
Extension Swiftype_Swiftype
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Swiftype/Swiftype/Helper/Data.php CHANGED
@@ -243,10 +243,9 @@ class Swiftype_Swiftype_Helper_Data
243
  $uri = Swiftype_Swiftype_Helper_Data::API_URL;
244
 
245
  foreach ($params['uri'] as $name => $value) {
246
- $uri .= "/$name";
247
  if ($value) {
248
- $value = preg_replace('/\s+/', '', $value);
249
- $uri .= "/$value";
250
  }
251
  }
252
 
@@ -296,17 +295,17 @@ class Swiftype_Swiftype_Helper_Data
296
 
297
  final public function getApiKey($store = null)
298
  {
299
- return Mage::getStoreConfig('catalog/search/swiftype_api_key', $store);
300
  }
301
 
302
  final public function getEngineSlug($store = null)
303
  {
304
- return Mage::getStoreConfig('catalog/search/swiftype_engine_slug', $store);
305
  }
306
 
307
  final public function getEngineKey($store = null)
308
  {
309
- return Mage::getStoreConfig('catalog/search/swiftype_engine_key', $store);
310
  }
311
 
312
  final public function getAutocompleteLimit($store = null)
243
  $uri = Swiftype_Swiftype_Helper_Data::API_URL;
244
 
245
  foreach ($params['uri'] as $name => $value) {
246
+ $uri .= '/' . urlencode($name);
247
  if ($value) {
248
+ $uri .= '/' . urlencode($value);
 
249
  }
250
  }
251
 
295
 
296
  final public function getApiKey($store = null)
297
  {
298
+ return preg_replace('/[^A-Za-z0-9\-_]/', '', Mage::getStoreConfig('catalog/search/swiftype_api_key', $store));
299
  }
300
 
301
  final public function getEngineSlug($store = null)
302
  {
303
+ return preg_replace('/[^A-Za-z0-9\-_]/', '', Mage::getStoreConfig('catalog/search/swiftype_engine_slug', $store));
304
  }
305
 
306
  final public function getEngineKey($store = null)
307
  {
308
+ return preg_replace('/[^A-Za-z0-9\-_]/', '', Mage::getStoreConfig('catalog/search/swiftype_engine_key', $store));
309
  }
310
 
311
  final public function getAutocompleteLimit($store = null)
app/code/community/Swiftype/Swiftype/Model/Resource/Fulltext.php CHANGED
@@ -40,15 +40,6 @@ class Swiftype_Swiftype_Model_Resource_Fulltext
40
  return Mage::getResourceSingleton($engine);
41
  }
42
 
43
- final protected function _getSearchableProducts($storeId, array $staticFields, $productIds = null, $lastProductId = 0, $limit = 100)
44
- {
45
- if ($this->_getHelper()->getUseSwiftype($storeId)) {
46
- $limit = null;
47
- }
48
-
49
- return parent::_getSearchableProducts($storeId, $staticFields, $productIds, $lastProductId, $limit);
50
- }
51
-
52
  /**
53
  * @return Swiftype_Swiftype_Helper_Data
54
  */
40
  return Mage::getResourceSingleton($engine);
41
  }
42
 
 
 
 
 
 
 
 
 
 
43
  /**
44
  * @return Swiftype_Swiftype_Helper_Data
45
  */
app/design/frontend/base/default/template/swiftype/ajax/suggest.phtml CHANGED
@@ -36,8 +36,8 @@ foreach ($products as $product) {
36
  <li title="<?php echo str_replace('"', '', $suggestDatum['title']);?>" class="<?php echo str_replace('"', '', $suggestDatum['row_class']); ?>" style="background: #fff;">
37
  <a href="<?php echo $suggestDatum['href']; ?>" onClick="<?php echo $suggestDatum['onClick']; ?>" style="display: block; position: relative; background: #fff; text-decoration: none; margin: 0; padding: 0 0 6px;">
38
  <img style="position: absolute; left: -2px; top: 2px; margin: 0; border: 0;" src="<?php echo $this->helper('catalog/image')->init($suggestDatum['product'], 'thumbnail')->resize(56, 56); ?>" width="56" height="56"/>
39
- <div style="padding: 8px 5px 0 60px; font-size: 11px; line-height: 1.4; font-weight: bold;"><?php echo htmlentities($suggestDatum['name']); ?></div>
40
- <div style="padding: 2px 5px 5px 60px; min-height: 36px; overflow: hidden; font-size: 10px; line-height: 1.33; color: #777;"><?php echo htmlentities($suggestDatum['description']); ?></div>
41
  </a>
42
  </li>
43
  <?php endforeach; ?>
36
  <li title="<?php echo str_replace('"', '', $suggestDatum['title']);?>" class="<?php echo str_replace('"', '', $suggestDatum['row_class']); ?>" style="background: #fff;">
37
  <a href="<?php echo $suggestDatum['href']; ?>" onClick="<?php echo $suggestDatum['onClick']; ?>" style="display: block; position: relative; background: #fff; text-decoration: none; margin: 0; padding: 0 0 6px;">
38
  <img style="position: absolute; left: -2px; top: 2px; margin: 0; border: 0;" src="<?php echo $this->helper('catalog/image')->init($suggestDatum['product'], 'thumbnail')->resize(56, 56); ?>" width="56" height="56"/>
39
+ <div style="padding: 8px 5px 0 60px; font-size: 11px; line-height: 1.4; font-weight: bold;"><?php echo strip_tags($suggestDatum['name']); ?></div>
40
+ <div style="padding: 2px 5px 5px 60px; min-height: 36px; overflow: hidden; font-size: 10px; line-height: 1.33; color: #777;"><?php echo strip_tags($suggestDatum['description']); ?></div>
41
  </a>
42
  </li>
43
  <?php endforeach; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swiftype_Swiftype</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/agpl.html">AGPL</license>
7
  <channel>community</channel>
@@ -16,12 +16,13 @@
16
  * Autocomplete: Sometimes a search isn't even necessary; our search engines come with autocomplete built-in, and your users will thank you for having it.</description>
17
  <notes>Changelog:&#xD;
18
  &#xD;
19
- * Ensure custom search result ordering is based on order documents are returned in, rather than score.&#xD;
20
- * Ensure whitespace is removed from URI parameters.</notes>
 
21
  <authors><author><name>Swiftype</name><user>swiftypeteam</user><email>team@swiftype.com</email></author></authors>
22
- <date>2014-06-25</date>
23
- <time>17:30:57</time>
24
- <contents><target name="magecommunity"><dir name="Swiftype"><dir name="Swiftype"><dir name="Block"><dir name="Ajax"><file name="Suggest.php" hash="e5b55a9c41709eeffe31a6ea266876bc"/></dir><file name="Autocomplete.php" hash="f42063444facdccc951700591a82f8ca"/></dir><dir name="Helper"><file name="Data.php" hash="7240ab186b3fb12e03939f202173265a"/><file name="Log.php" hash="544a2a7075d3dec2d8c81eef0656f8a4"/></dir><dir name="Model"><dir name="Observer"><file name="Adminhtml.php" hash="6a1420a1fe9c7a7d7f3b90b5260af196"/><file name="Frontend.php" hash="923f4348d2b2785dfca43df9f2355e40"/><file name="Global.php" hash="8764a09f34b456cb729543616e0de889"/></dir><dir name="Request"><file name="Processor.php" hash="ca7fbb10d1dc0920ddb9605f7c9e310c"/></dir><dir name="Resource"><dir name="Fulltext"><file name="Engine.php" hash="5d95d1b7ea2d13c05478c4fec69d27d5"/></dir><file name="Fulltext.php" hash="7140192d2aa3434b9b0bbfe66b939b8e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Search"><file name="Engine.php" hash="a9faa3a31d39cedf2e20fa6e50cc1a66"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="0d61e11d4d332041f75981304546ff1b"/><file name="AnalyticsController.php" hash="8c8742944ddcf89182f6a03f49e747c4"/></dir><dir name="etc"><file name="config.xml" hash="3227643a18db99d75417eea199ed136c"/><file name="system.xml" hash="a372d79b32358f00aac38cf8864ca715"/></dir><dir name="sql"><dir name="swiftype_setup"><file name="install-1.php" hash="720c6d503a3493b9be8e34ff9af49528"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swiftype.xml" hash="b32acb6177dbf205ede8e0b0c2601705"/></dir><dir name="template"><dir name="swiftype"><dir name="ajax"><file name="suggest.phtml" hash="5c527591144181cc4615efd806a128d6"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swiftype_Swiftype.xml" hash="6894235a6d3edae4c2f5aa04407274d6"/></dir><dir name="."><file name="swiftype.xml" hash="20e640f1fa6945f853c2d29e3c2f94d9"/></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.3.0</min><max>5.7.0</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swiftype_Swiftype</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/agpl.html">AGPL</license>
7
  <channel>community</channel>
16
  * Autocomplete: Sometimes a search isn't even necessary; our search engines come with autocomplete built-in, and your users will thank you for having it.</description>
17
  <notes>Changelog:&#xD;
18
  &#xD;
19
+ * Ensure Magento product entity index batch upload limit used&#xD;
20
+ * Ensure URI parameters are encoded&#xD;
21
+ * Ensure Swiftype parameters (API key, engine key, engine slug) are stripped of invalid characters</notes>
22
  <authors><author><name>Swiftype</name><user>swiftypeteam</user><email>team@swiftype.com</email></author></authors>
23
+ <date>2014-06-26</date>
24
+ <time>20:05:48</time>
25
+ <contents><target name="magecommunity"><dir name="Swiftype"><dir name="Swiftype"><dir name="Block"><dir name="Ajax"><file name="Suggest.php" hash="e5b55a9c41709eeffe31a6ea266876bc"/></dir><file name="Autocomplete.php" hash="f42063444facdccc951700591a82f8ca"/></dir><dir name="Helper"><file name="Data.php" hash="e620dce46e1af6183cb135f966656fba"/><file name="Log.php" hash="544a2a7075d3dec2d8c81eef0656f8a4"/></dir><dir name="Model"><dir name="Observer"><file name="Adminhtml.php" hash="6a1420a1fe9c7a7d7f3b90b5260af196"/><file name="Frontend.php" hash="923f4348d2b2785dfca43df9f2355e40"/><file name="Global.php" hash="8764a09f34b456cb729543616e0de889"/></dir><dir name="Request"><file name="Processor.php" hash="ca7fbb10d1dc0920ddb9605f7c9e310c"/></dir><dir name="Resource"><dir name="Fulltext"><file name="Engine.php" hash="5d95d1b7ea2d13c05478c4fec69d27d5"/></dir><file name="Fulltext.php" hash="9ddc2b606a2bf4d3b8ff8ab9e930c7db"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Catalog"><dir name="Search"><file name="Engine.php" hash="a9faa3a31d39cedf2e20fa6e50cc1a66"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="0d61e11d4d332041f75981304546ff1b"/><file name="AnalyticsController.php" hash="8c8742944ddcf89182f6a03f49e747c4"/></dir><dir name="etc"><file name="config.xml" hash="3227643a18db99d75417eea199ed136c"/><file name="system.xml" hash="a372d79b32358f00aac38cf8864ca715"/></dir><dir name="sql"><dir name="swiftype_setup"><file name="install-1.php" hash="720c6d503a3493b9be8e34ff9af49528"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swiftype.xml" hash="b32acb6177dbf205ede8e0b0c2601705"/></dir><dir name="template"><dir name="swiftype"><dir name="ajax"><file name="suggest.phtml" hash="bd7164f8033e2157adb4127e4eacde26"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swiftype_Swiftype.xml" hash="6894235a6d3edae4c2f5aa04407274d6"/></dir><dir name="."><file name="swiftype.xml" hash="20e640f1fa6945f853c2d29e3c2f94d9"/></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.3.0</min><max>5.7.0</max></php></required></dependencies>
28
  </package>