Version Notes
Change Log: https://github.com/algolia/algoliasearch-magento/blob/master/CHANGELOG.md
Download this release
Release Info
Developer | Algolia Team |
Extension | algoliasearch |
Version | 1.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.8.0 to 1.8.1
- app/code/community/Algolia/Algoliasearch/Helper/Algoliahelper.php +118 -66
- app/code/community/Algolia/Algoliasearch/Helper/Config.php +6 -0
- app/code/community/Algolia/Algoliasearch/Helper/Data.php +9 -9
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Categoryhelper.php +1 -1
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Pagehelper.php +1 -1
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php +37 -5
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Suggestionhelper.php +1 -1
- app/code/community/Algolia/Algoliasearch/Model/Observer.php +5 -0
- app/code/community/Algolia/Algoliasearch/Model/Queue.php +29 -16
- app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php +1 -3
- app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext/Collection.php +1 -1
- app/code/community/Algolia/Algoliasearch/Model/System/IndexVisibility.php +17 -0
- app/code/community/Algolia/Algoliasearch/etc/config.xml +2 -1
- app/code/community/Algolia/Algoliasearch/etc/system.xml +17 -1
- app/etc/modules/Algolia_Algoliasearch.xml +1 -1
- js/algoliasearch/.DS_Store +0 -0
- js/algoliasearch/instantsearch.js +4 -7
- js/algoliasearch/internals/.DS_Store +0 -0
- package.xml +5 -5
app/code/community/Algolia/Algoliasearch/Helper/Algoliahelper.php
CHANGED
@@ -12,6 +12,12 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
|
|
12 |
/** @var Algolia_Algoliasearch_Helper_Config */
|
13 |
protected $config;
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function __construct()
|
16 |
{
|
17 |
$this->config = Mage::helper('algoliasearch/config');
|
@@ -46,41 +52,61 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
|
|
46 |
return $this->client->listIndexes();
|
47 |
}
|
48 |
|
49 |
-
public function query($
|
50 |
{
|
51 |
-
return $this->client->initIndex($
|
52 |
}
|
53 |
|
54 |
public function setSettings($indexName, $settings)
|
55 |
{
|
56 |
$index = $this->getIndex($indexName);
|
57 |
|
58 |
-
$index->setSettings($settings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
-
public function deleteIndex($
|
62 |
{
|
63 |
-
$this->client->deleteIndex($
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
-
public function deleteObjects($ids, $
|
67 |
{
|
68 |
-
$index = $this->getIndex($
|
|
|
|
|
69 |
|
70 |
-
$
|
|
|
71 |
}
|
72 |
|
73 |
-
public function moveIndex($
|
74 |
{
|
75 |
-
$this->client->moveIndex($
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
-
public function mergeSettings($
|
79 |
{
|
80 |
$onlineSettings = array();
|
81 |
|
82 |
try {
|
83 |
-
$onlineSettings = $this->getIndex($
|
84 |
} catch (\Exception $e) {
|
85 |
}
|
86 |
|
@@ -109,63 +135,25 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
|
|
109 |
return $onlineSettings;
|
110 |
}
|
111 |
|
112 |
-
public function
|
113 |
{
|
114 |
-
$
|
115 |
-
|
116 |
-
$good_size = true;
|
117 |
-
|
118 |
-
$ids = array();
|
119 |
-
|
120 |
-
foreach ($objects as $key => &$object) {
|
121 |
-
$size = mb_strlen(json_encode($object));
|
122 |
-
|
123 |
-
if ($size > 20000) {
|
124 |
-
$good_size = false;
|
125 |
-
|
126 |
-
foreach ($long_attributes as $attribute) {
|
127 |
-
if (isset($object[$attribute])) {
|
128 |
-
unset($object[$attribute]);
|
129 |
-
$ids[$index_name.' objectID('.$object['objectID'].')'] = true;
|
130 |
-
}
|
131 |
-
}
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
if ($size > 20000) {
|
136 |
-
unset($objects[$key]);
|
137 |
-
}
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
if (count($objects) <= 0) {
|
142 |
-
return;
|
143 |
-
}
|
144 |
-
|
145 |
-
if ($good_size === false) {
|
146 |
-
/** @var Mage_Adminhtml_Model_Session $session */
|
147 |
-
$session = Mage::getSingleton('adminhtml/session');
|
148 |
-
$session->addError('Algolia reindexing : You have some records ('.implode(',',
|
149 |
-
array_keys($ids)).') that are too big. They have either been truncated or skipped');
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
public function addObjects($objects, $index_name)
|
154 |
-
{
|
155 |
-
$this->handleTooBigRecords($objects, $index_name);
|
156 |
-
|
157 |
-
$index = $this->getIndex($index_name);
|
158 |
|
159 |
if ($this->config->isPartialUpdateEnabled()) {
|
160 |
-
$index->partialUpdateObjects($objects);
|
161 |
} else {
|
162 |
-
$index->addObjects($objects);
|
163 |
}
|
|
|
|
|
|
|
164 |
}
|
165 |
|
166 |
-
public function setSynonyms($
|
167 |
{
|
168 |
-
$index = $this->getIndex($
|
169 |
|
170 |
/*
|
171 |
* Placeholders and alternative corrections are handled directly in Algolia dashboard.
|
@@ -185,12 +173,13 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
|
|
185 |
} while (($page * $hitsPerPage) < $complexSynonyms['nbHits']);
|
186 |
|
187 |
if (empty($synonyms)) {
|
188 |
-
$index->clearSynonyms(true);
|
189 |
-
|
190 |
-
|
191 |
}
|
192 |
|
193 |
-
$
|
|
|
194 |
}
|
195 |
|
196 |
public function copySynonyms($fromIndexName, $toIndexName)
|
@@ -214,10 +203,73 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
|
|
214 |
} while (($page * $hitsPerPage) < $fetchedSynonyms['nbHits']);
|
215 |
|
216 |
if (empty($synonymsToSet)) {
|
217 |
-
$toIndex->clearSynonyms(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
return;
|
219 |
}
|
220 |
|
221 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
}
|
12 |
/** @var Algolia_Algoliasearch_Helper_Config */
|
13 |
protected $config;
|
14 |
|
15 |
+
/** @var string */
|
16 |
+
private $lastUsedIndexName;
|
17 |
+
|
18 |
+
/** @var int */
|
19 |
+
private $lastTaskId;
|
20 |
+
|
21 |
public function __construct()
|
22 |
{
|
23 |
$this->config = Mage::helper('algoliasearch/config');
|
52 |
return $this->client->listIndexes();
|
53 |
}
|
54 |
|
55 |
+
public function query($indexName, $q, $params)
|
56 |
{
|
57 |
+
return $this->client->initIndex($indexName)->search($q, $params);
|
58 |
}
|
59 |
|
60 |
public function setSettings($indexName, $settings)
|
61 |
{
|
62 |
$index = $this->getIndex($indexName);
|
63 |
|
64 |
+
$res = $index->setSettings($settings);
|
65 |
+
|
66 |
+
$this->lastUsedIndexName = $indexName;
|
67 |
+
$this->lastTaskId = $res['taskID'];
|
68 |
+
}
|
69 |
+
|
70 |
+
public function clearIndex($indexName)
|
71 |
+
{
|
72 |
+
$res =$this->getIndex($indexName)->clearIndex();
|
73 |
+
|
74 |
+
$this->lastUsedIndexName = $indexName;
|
75 |
+
$this->lastTaskId = $res['taskID'];
|
76 |
}
|
77 |
|
78 |
+
public function deleteIndex($indexName)
|
79 |
{
|
80 |
+
$res = $this->client->deleteIndex($indexName);
|
81 |
+
|
82 |
+
$this->lastUsedIndexName = $indexName;
|
83 |
+
$this->lastTaskId = $res['taskID'];
|
84 |
}
|
85 |
|
86 |
+
public function deleteObjects($ids, $indexName)
|
87 |
{
|
88 |
+
$index = $this->getIndex($indexName);
|
89 |
+
|
90 |
+
$res = $index->deleteObjects($ids);
|
91 |
|
92 |
+
$this->lastUsedIndexName = $indexName;
|
93 |
+
$this->lastTaskId = $res['taskID'];
|
94 |
}
|
95 |
|
96 |
+
public function moveIndex($tmpIndexName, $indexName)
|
97 |
{
|
98 |
+
$res = $this->client->moveIndex($tmpIndexName, $indexName);
|
99 |
+
|
100 |
+
$this->lastUsedIndexName = $indexName;
|
101 |
+
$this->lastTaskId = $res['taskID'];
|
102 |
}
|
103 |
|
104 |
+
public function mergeSettings($indexName, $settings)
|
105 |
{
|
106 |
$onlineSettings = array();
|
107 |
|
108 |
try {
|
109 |
+
$onlineSettings = $this->getIndex($indexName)->getSettings();
|
110 |
} catch (\Exception $e) {
|
111 |
}
|
112 |
|
135 |
return $onlineSettings;
|
136 |
}
|
137 |
|
138 |
+
public function addObjects($objects, $indexName)
|
139 |
{
|
140 |
+
$this->prepareRecords($objects, $indexName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
+
$index = $this->getIndex($indexName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
if ($this->config->isPartialUpdateEnabled()) {
|
145 |
+
$res = $index->partialUpdateObjects($objects);
|
146 |
} else {
|
147 |
+
$res = $index->addObjects($objects);
|
148 |
}
|
149 |
+
|
150 |
+
$this->lastUsedIndexName = $indexName;
|
151 |
+
$this->lastTaskId = $res['taskID'];
|
152 |
}
|
153 |
|
154 |
+
public function setSynonyms($indexName, $synonyms)
|
155 |
{
|
156 |
+
$index = $this->getIndex($indexName);
|
157 |
|
158 |
/*
|
159 |
* Placeholders and alternative corrections are handled directly in Algolia dashboard.
|
173 |
} while (($page * $hitsPerPage) < $complexSynonyms['nbHits']);
|
174 |
|
175 |
if (empty($synonyms)) {
|
176 |
+
$res = $index->clearSynonyms(true);
|
177 |
+
} else {
|
178 |
+
$res = $index->batchSynonyms($synonyms, true, true);
|
179 |
}
|
180 |
|
181 |
+
$this->lastUsedIndexName = $indexName;
|
182 |
+
$this->lastTaskId = $res['taskID'];
|
183 |
}
|
184 |
|
185 |
public function copySynonyms($fromIndexName, $toIndexName)
|
203 |
} while (($page * $hitsPerPage) < $fetchedSynonyms['nbHits']);
|
204 |
|
205 |
if (empty($synonymsToSet)) {
|
206 |
+
$res = $toIndex->clearSynonyms(true);
|
207 |
+
} else {
|
208 |
+
$res = $toIndex->batchSynonyms($synonymsToSet, true, true);
|
209 |
+
}
|
210 |
+
|
211 |
+
$this->lastUsedIndexName = $toIndex;
|
212 |
+
$this->lastTaskId = $res['taskID'];
|
213 |
+
}
|
214 |
+
|
215 |
+
public function waitLastTask()
|
216 |
+
{
|
217 |
+
if (!isset($this->lastUsedIndexName) || !isset($this->lastTaskId)) {
|
218 |
return;
|
219 |
}
|
220 |
|
221 |
+
$this->client->initIndex($this->lastUsedIndexName)->waitTask($this->lastTaskId);
|
222 |
+
}
|
223 |
+
|
224 |
+
private function prepareRecords(&$objects, $indexName)
|
225 |
+
{
|
226 |
+
$currentCET = new DateTime('now', new DateTimeZone('Europe/Paris'));
|
227 |
+
$currentCET = $currentCET->format('Y-m-d H:i:s');
|
228 |
+
|
229 |
+
$modifiedIds = array();
|
230 |
+
|
231 |
+
foreach ($objects as $key => &$object) {
|
232 |
+
$object['algoliaLastUpdateAtCET'] = $currentCET;
|
233 |
+
|
234 |
+
$previousObject = $object;
|
235 |
+
|
236 |
+
$this->handleTooBigRecord($object);
|
237 |
+
|
238 |
+
if ($previousObject !== $object) {
|
239 |
+
$modifiedIds[] = $indexName.' objectID('.$previousObject['objectID'].')';
|
240 |
+
}
|
241 |
+
|
242 |
+
if ($object === false) {
|
243 |
+
unset($objects[$key]);
|
244 |
+
continue;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
if (!empty($modifiedIds)) {
|
249 |
+
/** @var Mage_Adminhtml_Model_Session $session */
|
250 |
+
$session = Mage::getSingleton('adminhtml/session');
|
251 |
+
$session->addWarning('Algolia reindexing : You have some records ('.implode(',', $modifiedIds).') that are too big. They have either been truncated or skipped');
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
public function handleTooBigRecord(&$object)
|
256 |
+
{
|
257 |
+
$longAttributes = array('description', 'short_description', 'meta_description', 'content');
|
258 |
+
|
259 |
+
$size = mb_strlen(json_encode($object));
|
260 |
+
|
261 |
+
if ($size > 20000) {
|
262 |
+
foreach ($longAttributes as $attribute) {
|
263 |
+
if (isset($object[$attribute])) {
|
264 |
+
unset($object[$attribute]);
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
$size = mb_strlen(json_encode($object));
|
269 |
+
|
270 |
+
if ($size > 20000) {
|
271 |
+
$object = false;
|
272 |
+
}
|
273 |
+
}
|
274 |
}
|
275 |
}
|
app/code/community/Algolia/Algoliasearch/Helper/Config.php
CHANGED
@@ -36,6 +36,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
|
|
36 |
const PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes';
|
37 |
const RESULTS_LIMIT = 'algoliasearch/products/results_limit';
|
38 |
const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch/products/show_suggestions_on_no_result_page';
|
|
|
39 |
const INDEX_OUT_OF_STOCK_OPTIONS = 'algoliasearch/products/index_out_of_stock_options';
|
40 |
const INDEX_WHOLE_CATEGORY_TREE = 'algoliasearch/products/index_whole_category_tree';
|
41 |
|
@@ -71,6 +72,11 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
|
|
71 |
|
72 |
protected $_productTypeMap = array();
|
73 |
|
|
|
|
|
|
|
|
|
|
|
74 |
public function indexOutOfStockOptions($storeId = null)
|
75 |
{
|
76 |
return Mage::getStoreConfigFlag(self::INDEX_OUT_OF_STOCK_OPTIONS, $storeId);
|
36 |
const PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes';
|
37 |
const RESULTS_LIMIT = 'algoliasearch/products/results_limit';
|
38 |
const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch/products/show_suggestions_on_no_result_page';
|
39 |
+
const INDEX_VISIBILITY = 'algoliasearch/products/index_visibility';
|
40 |
const INDEX_OUT_OF_STOCK_OPTIONS = 'algoliasearch/products/index_out_of_stock_options';
|
41 |
const INDEX_WHOLE_CATEGORY_TREE = 'algoliasearch/products/index_whole_category_tree';
|
42 |
|
72 |
|
73 |
protected $_productTypeMap = array();
|
74 |
|
75 |
+
public function indexVisibility($storeId = null)
|
76 |
+
{
|
77 |
+
return Mage::getStoreConfig(self::INDEX_VISIBILITY, $storeId);
|
78 |
+
}
|
79 |
+
|
80 |
public function indexOutOfStockOptions($storeId = null)
|
81 |
{
|
82 |
return Mage::getStoreConfigFlag(self::INDEX_OUT_OF_STOCK_OPTIONS, $storeId);
|
app/code/community/Algolia/Algoliasearch/Helper/Data.php
CHANGED
@@ -358,10 +358,10 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
358 |
foreach ($collection as $suggestion) {
|
359 |
$suggestion->setStoreId($storeId);
|
360 |
|
361 |
-
$
|
362 |
|
363 |
-
if (strlen($
|
364 |
-
array_push($indexData, $
|
365 |
}
|
366 |
}
|
367 |
|
@@ -407,10 +407,10 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
407 |
|
408 |
$category->setStoreId($storeId);
|
409 |
|
410 |
-
$
|
411 |
|
412 |
-
if ($
|
413 |
-
array_push($indexData, $
|
414 |
}
|
415 |
}
|
416 |
|
@@ -462,15 +462,15 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
462 |
|
463 |
if ($product->isDeleted() === true
|
464 |
|| $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED
|
465 |
-
|| (
|
466 |
|| ($product->getStockItem()->is_in_stock == 0 && !$this->config->getShowOutOfStock($storeId))
|
467 |
) {
|
468 |
$productsToRemove[$productId] = $productId;
|
469 |
continue;
|
470 |
}
|
471 |
|
472 |
-
$
|
473 |
-
$productsToIndex[$productId] = $
|
474 |
}
|
475 |
|
476 |
$productsToRemove = array_merge($productsToRemove, $potentiallyDeletedProductsIds);
|
358 |
foreach ($collection as $suggestion) {
|
359 |
$suggestion->setStoreId($storeId);
|
360 |
|
361 |
+
$suggestionObject = $this->suggestion_helper->getObject($suggestion);
|
362 |
|
363 |
+
if (strlen($suggestionObject['query']) >= 3) {
|
364 |
+
array_push($indexData, $suggestionObject);
|
365 |
}
|
366 |
}
|
367 |
|
407 |
|
408 |
$category->setStoreId($storeId);
|
409 |
|
410 |
+
$categoryObject = $this->category_helper->getObject($category);
|
411 |
|
412 |
+
if ($categoryObject['product_count'] > 0) {
|
413 |
+
array_push($indexData, $categoryObject);
|
414 |
}
|
415 |
}
|
416 |
|
462 |
|
463 |
if ($product->isDeleted() === true
|
464 |
|| $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED
|
465 |
+
|| $this->product_helper->shouldIndexProductByItsVisibility($product, $storeId) === false
|
466 |
|| ($product->getStockItem()->is_in_stock == 0 && !$this->config->getShowOutOfStock($storeId))
|
467 |
) {
|
468 |
$productsToRemove[$productId] = $productId;
|
469 |
continue;
|
470 |
}
|
471 |
|
472 |
+
$productObject = $this->product_helper->getObject($product);
|
473 |
+
$productsToIndex[$productId] = $productObject;
|
474 |
}
|
475 |
|
476 |
$productsToRemove = array_merge($productsToRemove, $potentiallyDeletedProductsIds);
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Categoryhelper.php
CHANGED
@@ -199,7 +199,7 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
|
|
199 |
}
|
200 |
|
201 |
$transport = new Varien_Object($data);
|
202 |
-
Mage::dispatchEvent('algolia_after_create_category_object', array('category' => $transport));
|
203 |
$data = $transport->getData();
|
204 |
|
205 |
return $data;
|
199 |
}
|
200 |
|
201 |
$transport = new Varien_Object($data);
|
202 |
+
Mage::dispatchEvent('algolia_after_create_category_object', array('category' => $transport, 'categoryObject' => $category));
|
203 |
$data = $transport->getData();
|
204 |
|
205 |
return $data;
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Pagehelper.php
CHANGED
@@ -77,7 +77,7 @@ class Algolia_Algoliasearch_Helper_Entity_Pagehelper extends Algolia_Algoliasear
|
|
77 |
$pageObject['content'] = $this->strip($content);
|
78 |
|
79 |
$transport = new Varien_Object($pageObject);
|
80 |
-
Mage::dispatchEvent('algolia_after_create_page_object', array('page' => $transport));
|
81 |
$pageObject = $transport->getData();
|
82 |
|
83 |
$pages[] = $pageObject;
|
77 |
$pageObject['content'] = $this->strip($content);
|
78 |
|
79 |
$transport = new Varien_Object($pageObject);
|
80 |
+
Mage::dispatchEvent('algolia_after_create_page_object', array('page' => $transport, 'pageObject' => $page));
|
81 |
$pageObject = $transport->getData();
|
82 |
|
83 |
$pages[] = $pageObject;
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php
CHANGED
@@ -157,10 +157,9 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
157 |
}
|
158 |
|
159 |
if ($only_visible) {
|
160 |
-
|
161 |
-
$catalog_productVisibility = Mage::getSingleton('catalog/product_visibility');
|
162 |
|
163 |
-
$products = $products->addAttributeToFilter('visibility', array('in' => $
|
164 |
$products = $products->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
165 |
}
|
166 |
|
@@ -953,7 +952,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
953 |
|
954 |
// Only for backward compatibility
|
955 |
$transport = new Varien_Object($customData);
|
956 |
-
Mage::dispatchEvent('algolia_subproducts_index', array('custom_data' => $transport, 'sub_products' => $sub_products));
|
957 |
$customData = $transport->getData();
|
958 |
|
959 |
$customData = array_merge($customData, $defaultData);
|
@@ -965,7 +964,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
965 |
$customData = $this->clearNoValues($customData);
|
966 |
|
967 |
$transport = new Varien_Object($customData);
|
968 |
-
Mage::dispatchEvent('algolia_after_create_product_object', array('product_data' => $transport, 'sub_products' => $sub_products));
|
969 |
$customData = $transport->getData();
|
970 |
|
971 |
$this->logger->stop('CREATE RECORD '.$product->getId().' '.$this->logger->getStoreName($product->storeId));
|
@@ -983,6 +982,39 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
983 |
return $products->getAllIds();
|
984 |
}
|
985 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
private function explodeSynomyms($synonyms)
|
987 |
{
|
988 |
return array_map('trim', explode(',', $synonyms));
|
157 |
}
|
158 |
|
159 |
if ($only_visible) {
|
160 |
+
$visibilityAttributeValues = $this->getVisibilityAttributeValues($storeId);
|
|
|
161 |
|
162 |
+
$products = $products->addAttributeToFilter('visibility', array('in' => $visibilityAttributeValues));
|
163 |
$products = $products->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
164 |
}
|
165 |
|
952 |
|
953 |
// Only for backward compatibility
|
954 |
$transport = new Varien_Object($customData);
|
955 |
+
Mage::dispatchEvent('algolia_subproducts_index', array('custom_data' => $transport, 'sub_products' => $sub_products, 'productObject' => $product));
|
956 |
$customData = $transport->getData();
|
957 |
|
958 |
$customData = array_merge($customData, $defaultData);
|
964 |
$customData = $this->clearNoValues($customData);
|
965 |
|
966 |
$transport = new Varien_Object($customData);
|
967 |
+
Mage::dispatchEvent('algolia_after_create_product_object', array('product_data' => $transport, 'sub_products' => $sub_products, 'productObject' => $product));
|
968 |
$customData = $transport->getData();
|
969 |
|
970 |
$this->logger->stop('CREATE RECORD '.$product->getId().' '.$this->logger->getStoreName($product->storeId));
|
982 |
return $products->getAllIds();
|
983 |
}
|
984 |
|
985 |
+
public function shouldIndexProductByItsVisibility(Mage_Catalog_Model_Product $product, $storeId)
|
986 |
+
{
|
987 |
+
$productVisibility = (int) $product->getVisibility();
|
988 |
+
$indexVisibility = $this->config->indexVisibility($storeId);
|
989 |
+
|
990 |
+
$shouldIndex = ($productVisibility > Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
991 |
+
|
992 |
+
if ($indexVisibility === 'only_search') {
|
993 |
+
$shouldIndex = ($productVisibility === Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH || $productVisibility === Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
994 |
+
} elseif ($indexVisibility === 'only_catalog') {
|
995 |
+
$shouldIndex = ($productVisibility === Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG || $productVisibility === Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
996 |
+
}
|
997 |
+
|
998 |
+
return $shouldIndex;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
private function getVisibilityAttributeValues($storeId)
|
1002 |
+
{
|
1003 |
+
$indexVisibility = $this->config->indexVisibility($storeId);
|
1004 |
+
|
1005 |
+
/** @var Mage_Catalog_Model_Product_Visibility $catalog_productVisibility */
|
1006 |
+
$catalog_productVisibility = Mage::getSingleton('catalog/product_visibility');
|
1007 |
+
|
1008 |
+
$visibilityMethod = 'getVisibleInSiteIds';
|
1009 |
+
if ($indexVisibility === 'only_search') {
|
1010 |
+
$visibilityMethod = 'getVisibleInSearchIds';
|
1011 |
+
} elseif ($indexVisibility === 'only_catalog') {
|
1012 |
+
$visibilityMethod = 'getVisibleInCatalogIds';
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
return $catalog_productVisibility->{$visibilityMethod}();
|
1016 |
+
}
|
1017 |
+
|
1018 |
private function explodeSynomyms($synonyms)
|
1019 |
{
|
1020 |
return array_map('trim', explode(',', $synonyms));
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Suggestionhelper.php
CHANGED
@@ -38,7 +38,7 @@ class Algolia_Algoliasearch_Helper_Entity_Suggestionhelper extends Algolia_Algol
|
|
38 |
);
|
39 |
|
40 |
$transport = new Varien_Object($suggestionObject);
|
41 |
-
Mage::dispatchEvent('algolia_after_create_suggestion_object', array('suggestion' => $transport));
|
42 |
$suggestionObject = $transport->getData();
|
43 |
|
44 |
return $suggestionObject;
|
38 |
);
|
39 |
|
40 |
$transport = new Varien_Object($suggestionObject);
|
41 |
+
Mage::dispatchEvent('algolia_after_create_suggestion_object', array('suggestion' => $transport, 'suggestionObject' => $suggestion));
|
42 |
$suggestionObject = $transport->getData();
|
43 |
|
44 |
return $suggestionObject;
|
app/code/community/Algolia/Algoliasearch/Model/Observer.php
CHANGED
@@ -39,6 +39,11 @@ class Algolia_Algoliasearch_Model_Observer
|
|
39 |
|
40 |
public function saveSettings($isFullProductReindex = false)
|
41 |
{
|
|
|
|
|
|
|
|
|
|
|
42 |
foreach (Mage::app()->getStores() as $store) {/* @var $store Mage_Core_Model_Store */
|
43 |
if ($store->getIsActive()) {
|
44 |
$saveToTmpIndicesToo = ($isFullProductReindex && $this->config->isQueueActive($store->getId()));
|
39 |
|
40 |
public function saveSettings($isFullProductReindex = false)
|
41 |
{
|
42 |
+
if (is_object($isFullProductReindex) && get_class($isFullProductReindex) === 'Varien_Object') {
|
43 |
+
$eventData = $isFullProductReindex->getData();
|
44 |
+
$isFullProductReindex = $eventData['isFullProductReindex'];
|
45 |
+
}
|
46 |
+
|
47 |
foreach (Mage::app()->getStores() as $store) {/* @var $store Mage_Core_Model_Store */
|
48 |
if ($store->getIsActive()) {
|
49 |
$saveToTmpIndicesToo = ($isFullProductReindex && $this->config->isQueueActive($store->getId()));
|
app/code/community/Algolia/Algoliasearch/Model/Queue.php
CHANGED
@@ -6,6 +6,8 @@ class Algolia_Algoliasearch_Model_Queue
|
|
6 |
const ERROR_LOG = 'algoliasearch_queue_errors.log';
|
7 |
|
8 |
protected $table;
|
|
|
|
|
9 |
protected $db;
|
10 |
|
11 |
/** @var Algolia_Algoliasearch_Helper_Config */
|
@@ -67,7 +69,7 @@ class Algolia_Algoliasearch_Model_Queue
|
|
67 |
return false;
|
68 |
}
|
69 |
|
70 |
-
if ($j1['data']['store_id'] !== $j2['data']['store_id']) {
|
71 |
return false;
|
72 |
}
|
73 |
|
@@ -97,7 +99,7 @@ class Algolia_Algoliasearch_Model_Queue
|
|
97 |
return strcmp($a['class'], $b['class']);
|
98 |
}
|
99 |
|
100 |
-
if ($a['data']['store_id'] !== $b['data']['store_id']) {
|
101 |
return $a['data']['store_id'] > $b['data']['store_id'];
|
102 |
}
|
103 |
|
@@ -141,37 +143,43 @@ class Algolia_Algoliasearch_Model_Queue
|
|
141 |
return $jobs;
|
142 |
}
|
143 |
|
144 |
-
public function run($
|
145 |
{
|
146 |
-
$
|
147 |
-
$limit = $
|
148 |
|
149 |
-
$element_count = 0;
|
150 |
$jobs = array();
|
|
|
|
|
|
|
|
|
151 |
$offset = 0;
|
152 |
-
$max_size = $this->config->getNumberOfElementByPage() * $limit;
|
153 |
|
154 |
try {
|
155 |
$this->db->beginTransaction();
|
156 |
|
157 |
-
while ($
|
158 |
$data = $this->db->query($this->db->select()->from($this->table, '*')->where('pid IS NULL')
|
159 |
->order(array('job_id'))->limit($limit, $limit * $offset)
|
160 |
->forUpdate());
|
161 |
$data = $data->fetchAll();
|
|
|
162 |
|
163 |
$offset++;
|
164 |
|
165 |
-
if (
|
|
|
|
|
|
|
166 |
break;
|
167 |
}
|
168 |
|
169 |
foreach ($data as $job) {
|
170 |
-
$
|
171 |
|
172 |
-
if ($
|
173 |
$jobs[] = $job;
|
174 |
-
$
|
175 |
} else {
|
176 |
break 2;
|
177 |
}
|
@@ -180,21 +188,23 @@ class Algolia_Algoliasearch_Model_Queue
|
|
180 |
|
181 |
if (count($jobs) <= 0) {
|
182 |
$this->db->commit();
|
|
|
183 |
|
184 |
return;
|
185 |
}
|
186 |
|
187 |
-
$
|
188 |
-
$
|
189 |
|
190 |
$pid = getmypid();
|
191 |
|
192 |
// Reserve all new jobs since last run
|
193 |
-
$this->db->query("UPDATE {$this->db->quoteIdentifier($this->table, true)} SET pid = ".$pid.' WHERE job_id >= '.$
|
194 |
|
195 |
$this->db->commit();
|
196 |
} catch (\Exception $e) {
|
197 |
$this->db->rollBack();
|
|
|
198 |
|
199 |
throw $e;
|
200 |
}
|
@@ -222,8 +232,11 @@ class Algolia_Algoliasearch_Model_Queue
|
|
222 |
$where = $this->db->quoteInto('pid = ?', $pid);
|
223 |
$this->db->delete($this->table, $where);
|
224 |
|
225 |
-
if ($
|
226 |
$this->run(-1);
|
|
|
227 |
}
|
|
|
|
|
228 |
}
|
229 |
}
|
6 |
const ERROR_LOG = 'algoliasearch_queue_errors.log';
|
7 |
|
8 |
protected $table;
|
9 |
+
|
10 |
+
/** @var Magento_Db_Adapter_Pdo_Mysql */
|
11 |
protected $db;
|
12 |
|
13 |
/** @var Algolia_Algoliasearch_Helper_Config */
|
69 |
return false;
|
70 |
}
|
71 |
|
72 |
+
if (isset($j1['data']['store_id']) && isset($j2['data']['store_id']) && $j1['data']['store_id'] !== $j2['data']['store_id']) {
|
73 |
return false;
|
74 |
}
|
75 |
|
99 |
return strcmp($a['class'], $b['class']);
|
100 |
}
|
101 |
|
102 |
+
if (isset($a['data']['store_id']) && isset($b['data']['store_id']) && $a['data']['store_id'] !== $b['data']['store_id']) {
|
103 |
return $a['data']['store_id'] > $b['data']['store_id'];
|
104 |
}
|
105 |
|
143 |
return $jobs;
|
144 |
}
|
145 |
|
146 |
+
public function run($maxJobs)
|
147 |
{
|
148 |
+
$isFullReindex = ($maxJobs === -1);
|
149 |
+
$limit = $isFullReindex ? $this->config->getNumberOfJobToRun() : $maxJobs;
|
150 |
|
|
|
151 |
$jobs = array();
|
152 |
+
|
153 |
+
$actualBatchSize = 0;
|
154 |
+
$maxBatchSize = $this->config->getNumberOfElementByPage() * $limit;
|
155 |
+
|
156 |
$offset = 0;
|
|
|
157 |
|
158 |
try {
|
159 |
$this->db->beginTransaction();
|
160 |
|
161 |
+
while ($actualBatchSize < $maxBatchSize) {
|
162 |
$data = $this->db->query($this->db->select()->from($this->table, '*')->where('pid IS NULL')
|
163 |
->order(array('job_id'))->limit($limit, $limit * $offset)
|
164 |
->forUpdate());
|
165 |
$data = $data->fetchAll();
|
166 |
+
$rowsCount = count($data);
|
167 |
|
168 |
$offset++;
|
169 |
|
170 |
+
if ($rowsCount <= 0) {
|
171 |
+
break;
|
172 |
+
} elseif ($rowsCount == $maxJobs) {
|
173 |
+
$jobs = $data;
|
174 |
break;
|
175 |
}
|
176 |
|
177 |
foreach ($data as $job) {
|
178 |
+
$jobSize = (int) $job['data_size'];
|
179 |
|
180 |
+
if ($actualBatchSize + $jobSize <= $maxBatchSize) {
|
181 |
$jobs[] = $job;
|
182 |
+
$actualBatchSize += $jobSize;
|
183 |
} else {
|
184 |
break 2;
|
185 |
}
|
188 |
|
189 |
if (count($jobs) <= 0) {
|
190 |
$this->db->commit();
|
191 |
+
$this->db->closeConnection();
|
192 |
|
193 |
return;
|
194 |
}
|
195 |
|
196 |
+
$firstJobsId = $jobs[0]['job_id'];
|
197 |
+
$lastJobsId = $jobs[count($jobs) - 1]['job_id'];
|
198 |
|
199 |
$pid = getmypid();
|
200 |
|
201 |
// Reserve all new jobs since last run
|
202 |
+
$this->db->query("UPDATE {$this->db->quoteIdentifier($this->table, true)} SET pid = ".$pid.' WHERE job_id >= '.$firstJobsId." AND job_id <= $lastJobsId");
|
203 |
|
204 |
$this->db->commit();
|
205 |
} catch (\Exception $e) {
|
206 |
$this->db->rollBack();
|
207 |
+
$this->db->closeConnection();
|
208 |
|
209 |
throw $e;
|
210 |
}
|
232 |
$where = $this->db->quoteInto('pid = ?', $pid);
|
233 |
$this->db->delete($this->table, $where);
|
234 |
|
235 |
+
if ($isFullReindex) {
|
236 |
$this->run(-1);
|
237 |
+
return;
|
238 |
}
|
239 |
+
|
240 |
+
$this->db->closeConnection();
|
241 |
}
|
242 |
}
|
app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php
CHANGED
@@ -337,8 +337,6 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
|
|
337 |
|
338 |
public function saveSettings($isFullProductReindex = false)
|
339 |
{
|
340 |
-
|
341 |
-
$observer = Mage::getSingleton('algoliasearch/observer');
|
342 |
-
$observer->saveSettings($isFullProductReindex);
|
343 |
}
|
344 |
}
|
337 |
|
338 |
public function saveSettings($isFullProductReindex = false)
|
339 |
{
|
340 |
+
$this->addToQueue('algoliasearch/observer', 'saveSettings', array('isFullProductReindex' => $isFullProductReindex), 1);
|
|
|
|
|
341 |
}
|
342 |
}
|
app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext/Collection.php
CHANGED
@@ -46,7 +46,7 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext_Collection extends Mage_Cata
|
|
46 |
$storeId = Mage::app()->getStore()->getId();
|
47 |
|
48 |
if (!$config->getApplicationID() || !$config->getAPIKey() || $config->isEnabledFrontEnd($storeId) === false) {
|
49 |
-
return
|
50 |
}
|
51 |
|
52 |
$data = array();
|
46 |
$storeId = Mage::app()->getStore()->getId();
|
47 |
|
48 |
if (!$config->getApplicationID() || !$config->getAPIKey() || $config->isEnabledFrontEnd($storeId) === false) {
|
49 |
+
return false;
|
50 |
}
|
51 |
|
52 |
$data = array();
|
app/code/community/Algolia/Algoliasearch/Model/System/IndexVisibility.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Source model for algolia remove words if no result.
|
5 |
+
*/
|
6 |
+
|
7 |
+
class Algolia_Algoliasearch_Model_System_IndexVisibility
|
8 |
+
{
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array('value' => 'all', 'label' => Mage::helper('algoliasearch')->__('All visible products')),
|
13 |
+
array('value' => 'only_search', 'label' => Mage::helper('algoliasearch')->__('Only products visible in Search')),
|
14 |
+
array('value' => 'only_catalog', 'label' => Mage::helper('algoliasearch')->__('Only products visible in Catalog')),
|
15 |
+
);
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Algolia/Algoliasearch/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Algolia_Algoliasearch>
|
5 |
-
<version>1.8.
|
6 |
</Algolia_Algoliasearch>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -169,6 +169,7 @@
|
|
169 |
<custom_ranking_product_attributes>a:1:{s:18:"_1427960305274_274";a:2:{s:9:"attribute";s:11:"ordered_qty";s:5:"order";s:4:"desc";}}</custom_ranking_product_attributes>
|
170 |
<results_limit>1000</results_limit>
|
171 |
<show_suggestions_on_no_result_page>1</show_suggestions_on_no_result_page>
|
|
|
172 |
<index_out_of_stock_options>0</index_out_of_stock_options>
|
173 |
<index_whole_category_tree>1</index_whole_category_tree>
|
174 |
</products>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Algolia_Algoliasearch>
|
5 |
+
<version>1.8.1</version>
|
6 |
</Algolia_Algoliasearch>
|
7 |
</modules>
|
8 |
<frontend>
|
169 |
<custom_ranking_product_attributes>a:1:{s:18:"_1427960305274_274";a:2:{s:9:"attribute";s:11:"ordered_qty";s:5:"order";s:4:"desc";}}</custom_ranking_product_attributes>
|
170 |
<results_limit>1000</results_limit>
|
171 |
<show_suggestions_on_no_result_page>1</show_suggestions_on_no_result_page>
|
172 |
+
<index_visibility>all</index_visibility>
|
173 |
<index_out_of_stock_options>0</index_out_of_stock_options>
|
174 |
<index_whole_category_tree>1</index_whole_category_tree>
|
175 |
</products>
|
app/code/community/Algolia/Algoliasearch/etc/system.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<algoliasearch translate="label" module="algoliasearch">
|
5 |
<label>
|
6 |
<![CDATA[
|
7 |
-
Algolia Search 1.8.
|
8 |
<style>
|
9 |
.algoliasearch-admin-menu span {
|
10 |
padding-left: 38px !important;
|
@@ -475,6 +475,22 @@
|
|
475 |
]]>
|
476 |
</comment>
|
477 |
</show_suggestions_on_no_result_page>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
<index_out_of_stock_options translate="label comment">
|
479 |
<label>Index out of stock options for configurable products</label>
|
480 |
<frontend_type>select</frontend_type>
|
4 |
<algoliasearch translate="label" module="algoliasearch">
|
5 |
<label>
|
6 |
<![CDATA[
|
7 |
+
Algolia Search 1.8.1
|
8 |
<style>
|
9 |
.algoliasearch-admin-menu span {
|
10 |
padding-left: 38px !important;
|
475 |
]]>
|
476 |
</comment>
|
477 |
</show_suggestions_on_no_result_page>
|
478 |
+
<index_visibility translate="label comment">
|
479 |
+
<label>Index products with visibility:</label>
|
480 |
+
<frontend_type>select</frontend_type>
|
481 |
+
<source_model>algoliasearch/system_indexVisibility</source_model>
|
482 |
+
<sort_order>55</sort_order>
|
483 |
+
<show_in_default>1</show_in_default>
|
484 |
+
<show_in_website>1</show_in_website>
|
485 |
+
<show_in_store>1</show_in_store>
|
486 |
+
<comment>
|
487 |
+
<![CDATA[
|
488 |
+
Choose which products you want to index (search for) in Algolia.
|
489 |
+
<br />
|
490 |
+
<span class="algolia-config-warning">⚠</span> If you select "Only products visible in Search" and you have enabled "Replace categories pages", you might miss some products on category pages.
|
491 |
+
]]>
|
492 |
+
</comment>
|
493 |
+
</index_visibility>
|
494 |
<index_out_of_stock_options translate="label comment">
|
495 |
<label>Index out of stock options for configurable products</label>
|
496 |
<frontend_type>select</frontend_type>
|
app/etc/modules/Algolia_Algoliasearch.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<Algolia_Algoliasearch>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
-
<version>1.8.
|
8 |
</Algolia_Algoliasearch>
|
9 |
</modules>
|
10 |
</config>
|
4 |
<Algolia_Algoliasearch>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
+
<version>1.8.1</version>
|
8 |
</Algolia_Algoliasearch>
|
9 |
</modules>
|
10 |
</config>
|
js/algoliasearch/.DS_Store
CHANGED
Binary file
|
js/algoliasearch/instantsearch.js
CHANGED
@@ -223,9 +223,6 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
|
223 |
var name = facet.attribute;
|
224 |
|
225 |
if (name === 'categories') {
|
226 |
-
if (algoliaConfig.isCategoryPage) {
|
227 |
-
return;
|
228 |
-
}
|
229 |
name = 'categories.level0';
|
230 |
}
|
231 |
|
@@ -293,10 +290,6 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
|
293 |
'<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>' +
|
294 |
'</div>';
|
295 |
|
296 |
-
if (algoliaConfig.request.path.length > 0) {
|
297 |
-
hierarchicalMenuParams.rootPath = algoliaConfig.request.path;
|
298 |
-
}
|
299 |
-
|
300 |
return algoliaBundle.instantsearch.widgets.hierarchicalMenu(hierarchicalMenuParams);
|
301 |
}
|
302 |
};
|
@@ -414,6 +407,10 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
|
414 |
|
415 |
search.start();
|
416 |
|
|
|
|
|
|
|
|
|
417 |
handleInputCrossInstant($(instant_selector));
|
418 |
|
419 |
var instant_search_bar = $(instant_selector);
|
223 |
var name = facet.attribute;
|
224 |
|
225 |
if (name === 'categories') {
|
|
|
|
|
|
|
226 |
name = 'categories.level0';
|
227 |
}
|
228 |
|
290 |
'<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>' +
|
291 |
'</div>';
|
292 |
|
|
|
|
|
|
|
|
|
293 |
return algoliaBundle.instantsearch.widgets.hierarchicalMenu(hierarchicalMenuParams);
|
294 |
}
|
295 |
};
|
407 |
|
408 |
search.start();
|
409 |
|
410 |
+
if (algoliaConfig.request.path.length > 0) {
|
411 |
+
search.helper.toggleRefine('categories.level0', algoliaConfig.request.path).search();
|
412 |
+
}
|
413 |
+
|
414 |
handleInputCrossInstant($(instant_selector));
|
415 |
|
416 |
var instant_search_bar = $(instant_selector);
|
js/algoliasearch/internals/.DS_Store
CHANGED
Binary file
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>algoliasearch</name>
|
4 |
-
<version>1.8.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
|
7 |
<channel>community</channel>
|
@@ -15,9 +15,9 @@
|
|
15 |
</description>
|
16 |
<notes>Change Log: https://github.com/algolia/algoliasearch-magento/blob/master/CHANGELOG.md</notes>
|
17 |
<authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
|
18 |
-
<date>2017-
|
19 |
-
<time>
|
20 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="
|
21 |
<compatible/>
|
22 |
-
<dependencies><required><php><min>5.3.0</min><max>
|
23 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>algoliasearch</name>
|
4 |
+
<version>1.8.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
|
7 |
<channel>community</channel>
|
15 |
</description>
|
16 |
<notes>Change Log: https://github.com/algolia/algoliasearch-magento/blob/master/CHANGELOG.md</notes>
|
17 |
<authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
|
18 |
+
<date>2017-02-16</date>
|
19 |
+
<time>15:53:52</time>
|
20 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="a655bf1974ac5a92fd23337ca45edc6e"/></dir></target><target name="magecommunity"><dir name="Algolia"><dir name="Algoliasearch"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="AbstractField.php" hash="c5b2a65b11d5993e385234367689c10d"/><file name="AdditionalSections.php" hash="f8f8e2d9385b8aa3dcc79987a832d284"/><file name="CategoryAdditionalAttributes.php" hash="cec9f23859bfd3328305dafcbec9cf68"/><file name="CustomRankingCategoryAttributes.php" hash="90e976e6c636d3df2f13cd843e2184fa"/><file name="CustomRankingProductAttributes.php" hash="7540e89be193568c069b21d225964be7"/><file name="ExcludedPages.php" hash="0119009da0f9b5daef8fd66854ae0661"/><file name="Facets.php" hash="893e9599b639593ed6897a27edb8d7e3"/><file name="OnewaySynonyms.php" hash="f1ff6ae2e8bc4cc61238e399564d46b6"/><file name="ProductAdditionalAttributes.php" hash="5eed1b4abcb3d51f35702bdf0743ee61"/><file name="Select.php" hash="e9521a9c869b427bca0fe57ea92288a1"/><file name="Sorts.php" hash="c40feb1c0adfc303f96ce8ca47724a19"/><file name="Synonyms.php" hash="ee555973c7c2f385240b168cd58047e5"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="0f44e7c9a8e1eaaf97f61dfd1b10cc58"/><file name="Config.php" hash="a95d569f971673ff57d6aff3677fb54b"/><file name="Data.php" hash="bc5b1b2d089d50313e4d141511c86bb1"/><dir name="Entity"><file name="Additionalsectionshelper.php" hash="12017b4c8dce6eda8f8ceb984cfa5e53"/><file name="Categoryhelper.php" hash="e878300df61d2326b6f73044a9e1b974"/><file name="Helper.php" hash="18b2fd9d5acb7eb4fe4dca11903a9766"/><file name="Pagehelper.php" hash="dcade73b260dc10b6f57bd92cff952d2"/><file name="Producthelper.php" hash="045a9fc00376b454faf9c6b737d3e0d6"/><file name="Suggestionhelper.php" hash="cb40a85330cd8dc59b4d1c647b124899"/></dir><file name="Image.php" hash="5c8aba6fd77c0c0796a8ac67f9769c84"/><file name="Logger.php" hash="9f1d1ceb9059a98746aa9fd473549449"/><file name=".DS_Store" hash="45eb27e8591a0f709d87531296fcf1d7"/></dir><dir name="Model"><dir name="Indexer"><file name="Abstract.php" hash="17fc52ea42d0f5ea357ec7786882a473"/><file name="Algolia.php" hash="862887c085e701eabde47e8f9b540585"/><file name="Algoliaadditionalsections.php" hash="bb065ba1adc4fef1e820fc7baa88ce7f"/><file name="Algoliacategories.php" hash="49b00c33b47a349d34c19281ab9e0215"/><file name="Algoliapages.php" hash="c782fb36d45b478a41918abb98a869d4"/><file name="Algoliaqueuerunner.php" hash="e2cd5b4022e5003367e6c81f0912b783"/><file name="Algoliasuggestions.php" hash="069aeb9955aef734ebd3fa969d634865"/></dir><file name="Observer.php" hash="c70e434ffd46822036110ba40d563cec"/><file name="Queue.php" hash="d281b3a19b021e70a020d472e45e2d6f"/><dir name="Resource"><file name="Engine.php" hash="8f99727db5637664a86975b9fe83c8af"/><dir name="Fulltext"><file name="Collection.php" hash="e3c8a13d9a034fcd1aa40e2e336208a0"/></dir><file name="Fulltext.php" hash="b662e692f0a32428764f15f7db2b07d0"/></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Serialized"><file name="Array.php" hash="6492ba56f58b26cebc6d826ba3502779"/></dir><file name="SynonymsFile.php" hash="12b218765f015ea31f03da822f4c2ca5"/></dir></dir><file name="Imagetype.php" hash="1391d49853b94714080de07fc662a831"/><file name="IndexVisibility.php" hash="b4d685a15371f59796fbe12db0f2dce3"/><file name="Removewords.php" hash="9b7d40d7ccf11d6d5fa101c8b06c5b9e"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="07edd7bca541d4dbeba73c2b70ec53a2"/><file name="config.xml" hash="5bd9b0bbbd2dca10a5e903910aa17e06"/><file name="system.xml" hash="16f7ad2ec7e9bb8da5804f9ceed2bfa6"/></dir><dir name="sql"><dir name="algoliasearch_setup"><file name="mysql4-install-0.1.0.php" hash="561f4f9e9f7021061964330a6c1eccec"/><file name="mysql4-upgrade-0.1.0-1.4.8.php" hash="1fae6deaf608f812844c8639b178cbc7"/><file name="mysql4-upgrade-1.4.8-1.5.0.php" hash="a7eaf9d86daeb0686b1cf03f9ed9c817"/><file name="mysql4-upgrade-1.5.5-1.6.0.php" hash="3aeb056f347896a0ddf888cefd21bfeb"/><file name="mysql4-upgrade-1.6.0-1.7.1.php" hash="e7854e9d144ca79894b07252488535e8"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="algoliasearch.xml" hash="58543413c69185fd8016db48c9d4522a"/></dir><dir name="template"><dir name="algoliasearch"><dir name="autocomplete"><file name="attribute.phtml" hash="3824426911a04e6eb82231823864ca36"/><file name="category.phtml" hash="5d1d7184c77353b0a351be9be4ab7ce6"/><file name="menu.phtml" hash="61b58ab6e3be1ac57a58744b887bcf62"/><file name="page.phtml" hash="1ae9460533070a9171fbc2edde06785e"/><file name="product.phtml" hash="826ee0dfebf3163a8737dc16d71a1a79"/><file name="suggestion.phtml" hash="819b312e34e41d7fa267ed776f45b8b4"/></dir><file name="autocomplete.phtml" hash="f459643574e8cbcff4642168ed5303e7"/><dir name="instantsearch"><file name="currentRefinements.phtml" hash="be70be35514f4ec2b8c52e1174a035bb"/><file name="hit.phtml" hash="29bcbf21091654df8b78bb0c5d81bd34"/><file name="refinementsItem.phtml" hash="9e3e31dde749ae01b28fc288ff09ded0"/><file name="stats.phtml" hash="6460c77e5cad476058226ec1f8dba0f9"/><file name="wrapper.phtml" hash="079a5326141c4b103de4f342bdef01a2"/></dir><dir name="internals"><file name="beforecontent.phtml" hash="19f2ee9532f4e46c77ade0157976b780"/><file name="configuration.phtml" hash="12a623a780686a029b4c0b1f156ad63e"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="algoliasearch"><file name="adminjs.phtml" hash="1c287afa9e605e0a82270708997e2191"/></dir></dir><dir name="layout"><file name="algoliasearch.xml" hash="f49d4d2a5328f7f0a260eaaa0fcb1d19"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="algoliasearch"><file name="algolia-admin-menu.svg" hash="e38a9a012b0b127acd77c00c7abfa5ba"/><file name="algoliasearch.css" hash="23e182e86f2b5707c54dd5e9a28570cb"/><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="62568c006bb1066f40fd5f9cfe4489be"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="406541454ec466d93217826588335194"/><file name="ui-bg_flat_10_000000_40x100.png" hash="85243ed808c91ae60d33bda3a6bdee3c"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="f912ffca9b1919ab26c64cf1332c5322"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="a9b41e3f4db0fb9be1cd2c649deb253f"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="ff9e9b45e03f11808144324fd5350612"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="08ece8908c07b1c0d18b8db076ff50fc"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="72fe4b0e1bbb83dfd6787989d3583fbe"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="81262299ac7f591fd1763c1ccee0691f"/><file name="ui-icons_222222_256x240.png" hash="3a3c5468f484f07ac4a320d9e22acb8c"/><file name="ui-icons_228ef1_256x240.png" hash="92b29683b6a48eae7de7eb4b1cfa039c"/><file name="ui-icons_ef8c08_256x240.png" hash="f492970693640894fb54166c75dd2925"/><file name="ui-icons_ffd27a_256x240.png" hash="dda1b6f694b0d196aefc66a1d6d758f6"/><file name="ui-icons_ffffff_256x240.png" hash="41612b0f4a034424f8321c9f824a94da"/></dir><file name="search-by-algolia.svg" hash="5cc0f28bf007081ce109d6d09bb943ee"/><file name=".DS_Store" hash="54199b2c67f3a34fb072f6b0f0ea12d8"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="algoliasearch"><file name="autocomplete.js" hash="5d1fe6386fae502093dd35042c853952"/><file name="instantsearch.js" hash="cf3451d353dae4d2b1a2f1f1e0e43d32"/><dir name="internals"><dir name="adminhtml"><file name="admin_scripts.js" hash="ad31275773b26a575285d532e527ccaf"/><file name="algoliaAdminBundle.min.js" hash="053681c3d9484ab45d8406fd1d6099cd"/><file name="algoliaAdminBundle.min.js.map" hash="6121d4b16e6bab402e8b621e39092e40"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="frontend"><file name="Function.prototype.bind.js" hash="eb15975feb0cc976face88cb194294ae"/><file name="algoliaBundle.min.js" hash="8f85e0534f2d7e7212a9323f1a5482b8"/><file name="algoliaBundle.min.js.map" hash="8ab73f54ed9fa111e38a56ad8c7b6bb9"/><file name="common.js" hash="80aa3b3b410c22445a8504d1f1a6169e"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="456e969e4b9cb436d8b859e88979b7ad"/></dir><file name=".DS_Store" hash="2909cc6af306e1361c5a5c6ca2d137f2"/></dir></dir><dir name="lib"><dir name="AlgoliaSearch"><file name="AlgoliaException.php" hash="47e71cc8e04b8be4d1787580179004d2"/><file name="Client.php" hash="8f4fec4c98fad320bc7d9c3e3e8118bc"/><file name="ClientContext.php" hash="a12121ce2ebee7dcd3de0472fb89491b"/><file name="Index.php" hash="eb91d0105bb762a9ddc880705bdbdaf6"/><file name="IndexBrowser.php" hash="0264b1fb79575229a43627c1c12273ec"/><file name="Json.php" hash="b8790ee1406037369803fa606f258699"/><file name="PlacesIndex.php" hash="bd5f8c04de2573528d44e5277250212a"/><file name="SynonymType.php" hash="9d561527010de52acf1b88daa3100570"/><file name="Version.php" hash="531ba81a7e020c94c98c755c5a9080b5"/><file name="loader.php" hash="7263343ae5271480b7a5ee92b451ca09"/><dir name="resources"><file name="ca-bundle.crt" hash="47961e7ef15667c93cd99be01b51f00a"/></dir><file name=".DS_Store" hash="50c2aebe3913ec5a14b5298371d00c28"/></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Algolia_Algoliasearch.csv" hash="5eeeecf4a6ac60b207cecd8d44ba9302"/></dir></target></contents>
|
21 |
<compatible/>
|
22 |
+
<dependencies><required><php><min>5.3.0</min><max>7.2.0</max></php><extension><name>curl</name><min>7.16.2</min><max/></extension><extension><name>json</name><min/><max/></extension></required></dependencies>
|
23 |
</package>
|