algoliasearch - Version 1.4.7

Version Notes

- NEW: added an option to disable the seo request
- NEW: added ability to disable (search OR search + indexing) per store
- NEW: added logging
- UPDATED: improve handling of out of stock products
- UPDATED: improve performance overall indexing performance
- FIX: issue with category ids
- FIX: issue with configurable product additionnal attributes
- FIX: corner case for price with visibility and stock options

Download this release

Release Info

Developer Algolia Team
Extension algoliasearch
Version 1.4.7
Comparing to
See all releases


Code changes from version 1.4.6 to 1.4.7

app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Additionalsections.php CHANGED
@@ -22,6 +22,10 @@ class Algolia_Algoliasearch_Block_System_Config_Form_Field_Additionalsections ex
22
  $attributes = $config->getFacets();
23
 
24
  foreach ($attributes as $attribute) {
 
 
 
 
25
  $aOptions[$attribute['attribute']] = $attribute['label'] ? $attribute['label'] : $attribute['attribute'];
26
  }
27
 
22
  $attributes = $config->getFacets();
23
 
24
  foreach ($attributes as $attribute) {
25
+ if ($attribute['attribute'] == 'categories')
26
+ continue;
27
+ if ($attribute['attribute'] == 'price')
28
+ continue;
29
  $aOptions[$attribute['attribute']] = $attribute['label'] ? $attribute['label'] : $attribute['attribute'];
30
  }
31
 
app/code/community/Algolia/Algoliasearch/Helper/Config.php CHANGED
@@ -2,73 +2,104 @@
2
 
3
  class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
4
  {
5
- const XML_PATH_MINIMAL_QUERY_LENGTH = 'algoliasearch/ui/minimal_query_length';
6
- const XML_PATH_SEARCH_DELAY = 'algoliasearch/ui/search_delay';
7
-
8
- const XML_PATH_IS_POPUP_ENABLED = 'algoliasearch/credentials/is_popup_enabled';
9
- const XML_PATH_APPLICATION_ID = 'algoliasearch/credentials/application_id';
10
- const XML_PATH_API_KEY = 'algoliasearch/credentials/api_key';
11
- const XML_PATH_SEARCH_ONLY_API_KEY = 'algoliasearch/credentials/search_only_api_key';
12
- const XML_PATH_INDEX_PREFIX = 'algoliasearch/credentials/index_prefix';
13
- const XML_PATH_IS_INSTANT_ENABLED = 'algoliasearch/credentials/is_instant_enabled';
14
-
15
- const XML_PATH_REPLACE_CATEGORIES = 'algoliasearch/instant/replace_categories';
16
- const XML_PATH_INSTANT_SELECTOR = 'algoliasearch/instant/instant_selector';
17
- const XML_PATH_FACETS = 'algoliasearch/instant/facets';
18
- const XML_PATH_MAX_VALUES_PER_FACET = 'algoliasearch/instant/max_values_per_facet';
19
- const XML_PATH_SORTING_INDICES = 'algoliasearch/instant/sorts';
20
- const XML_ADD_TO_CART_ENABLE = 'algoliasearch/instant/add_to_cart_enable';
21
-
22
- const XML_PATH_AUTOCOMPLETE_ADD_SECTIONS = 'algoliasearch/autocomplete/additional_sections';
23
-
24
- const XML_PATH_NUMBER_OF_PRODUCT_SUGGESTIONS = 'algoliasearch/products/number_product_suggestions';
25
- const XML_PATH_NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results';
26
- const XML_PATH_PRODUCT_ATTRIBUTES = 'algoliasearch/products/product_additional_attributes';
27
- const XML_PATH_PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes';
28
- const XML_PATH_RESULTS_LIMIT = 'algoliasearch/products/results_limit';
29
-
30
- const XML_PATH_NUMBER_OF_CATEGORY_SUGGESTIONS = 'algoliasearch/categories/number_category_suggestions';
31
- const XML_PATH_CATEGORY_ATTRIBUTES = 'algoliasearch/categories/category_additional_attributes2';
32
- const XML_PATH_INDEX_PRODUCT_COUNT = 'algoliasearch/categories/index_product_count';
33
- const XML_PATH_CATEGORY_CUSTOM_RANKING = 'algoliasearch/categories/custom_ranking_category_attributes';
34
-
35
- const XML_PATH_NUMBER_OF_PAGE_SUGGESTIONS = 'algoliasearch/pages/number_page_suggestions';
36
- const XML_PATH_EXCLUDED_PAGES = 'algoliasearch/pages/excluded_pages';
37
-
38
- const XML_PATH_NUMBER_QUERY_SUGGESTIONS = 'algoliasearch/suggestions/number_query_suggestions';
39
- const XML_PATH_MIN_POPULARITY = 'algoliasearch/suggestions/min_popularity';
40
- const XML_PATH_MIN_NUMBER_OF_RESULTS = 'algoliasearch/suggestions/min_number_of_results';
41
-
42
- const XML_PATH_REMOVE_IF_NO_RESULT = 'algoliasearch/relevance/remove_words_if_no_result';
43
-
44
- const XML_PATH_MAX_RETRIES = 'algoliasearch/queue/retries';
45
- const XML_PATH_IS_ACTIVE = 'algoliasearch/queue/active';
46
- const XML_PATH_NUMBER_OF_ELEMENT_BY_PAGE = 'algoliasearch/queue/number_of_element_by_page';
47
- const XML_PATH_NUMBER_OF_JOB_TO_RUN = 'algoliasearch/queue/number_of_job_to_run';
48
- const XML_PATH_NO_PROCESS = 'algoliasearch/queue/noprocess';
49
-
50
- const XML_PATH_PARTIAL_UPDATES = 'algoliasearch/advanced/partial_update';
51
- const XML_PATH_CUSTOMER_GROUPS_ENABLE = 'algoliasearch/advanced/customer_groups_enable';
52
- const XML_PATH_REMOVE_BRANDING = 'algoliasearch/advanced/remove_branding';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  public function noProcess($storeId = null)
55
  {
56
- return Mage::getStoreConfigFlag(self::XML_PATH_NO_PROCESS, $storeId);
57
  }
58
 
59
  public function isCustomerGroupsEnabled($storeId = null)
60
  {
61
- return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMER_GROUPS_ENABLE, $storeId);
62
  }
63
 
64
  public function isPartialUpdateEnabled($storeId = null)
65
  {
66
- return Mage::getStoreConfigFlag(self::XML_PATH_PARTIAL_UPDATES, $storeId);
67
  }
68
 
69
  public function getAutocompleteAdditionnalSections($storeId = null)
70
  {
71
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_AUTOCOMPLETE_ADD_SECTIONS, $storeId));
72
 
73
  if (is_array($attrs))
74
  return array_values($attrs);
@@ -78,17 +109,17 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
78
 
79
  public function getNumberOfQuerySuggestions($storeId = null)
80
  {
81
- return Mage::getStoreConfig(self::XML_PATH_NUMBER_QUERY_SUGGESTIONS, $storeId);
82
  }
83
 
84
  public function getMinPopularity($storeId = null)
85
  {
86
- return Mage::getStoreConfig(self::XML_PATH_MIN_POPULARITY, $storeId);
87
  }
88
 
89
  public function getMinNumberOfResults($storeId = null)
90
  {
91
- return Mage::getStoreConfig(self::XML_PATH_MIN_NUMBER_OF_RESULTS, $storeId);
92
  }
93
 
94
  public function isAddToCartEnable($storeId = null)
@@ -98,92 +129,92 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
98
 
99
  public function isRemoveBranding($storeId = null)
100
  {
101
- return Mage::getStoreConfigFlag(self::XML_PATH_REMOVE_BRANDING, $storeId);
102
  }
103
 
104
  public function getMaxValuesPerFacet($storeId = null)
105
  {
106
- return Mage::getStoreConfig(self::XML_PATH_MAX_VALUES_PER_FACET, $storeId);
107
  }
108
 
109
  public function getQueueMaxRetries($storeId = null)
110
  {
111
- return Mage::getStoreConfig(self::XML_PATH_MAX_RETRIES, $storeId);
112
  }
113
 
114
  public function getNumberOfElementByPage($storeId = null)
115
  {
116
- return Mage::getStoreConfig(self::XML_PATH_NUMBER_OF_ELEMENT_BY_PAGE, $storeId);
117
  }
118
 
119
  public function getNumberOfJobToRun($storeId = null)
120
  {
121
- return Mage::getStoreConfig(self::XML_PATH_NUMBER_OF_JOB_TO_RUN, $storeId);
122
  }
123
 
124
  public function isQueueActive($storeId = null)
125
  {
126
- return Mage::getStoreConfigFlag(self::XML_PATH_IS_ACTIVE, $storeId);
127
  }
128
 
129
  public function getRemoveWordsIfNoResult($storeId = NULL)
130
  {
131
- return Mage::getStoreConfig(self::XML_PATH_REMOVE_IF_NO_RESULT, $storeId);
132
  }
133
 
134
  public function getNumberOfProductSuggestions($storeId = NULL)
135
  {
136
- return (int) Mage::getStoreConfig(self::XML_PATH_NUMBER_OF_PRODUCT_SUGGESTIONS, $storeId);
137
  }
138
 
139
  public function getNumberOfProductResults($storeId = NULL)
140
  {
141
- return (int) Mage::getStoreConfig(self::XML_PATH_NUMBER_OF_PRODUCT_RESULTS, $storeId);
142
  }
143
 
144
  public function getNumberOfCategorySuggestions($storeId = NULL)
145
  {
146
- return (int) Mage::getStoreConfig(self::XML_PATH_NUMBER_OF_CATEGORY_SUGGESTIONS, $storeId);
147
  }
148
 
149
  public function getNumberOfPageSuggestions($storeId = NULL)
150
  {
151
- return (int) Mage::getStoreConfig(self::XML_PATH_NUMBER_OF_PAGE_SUGGESTIONS, $storeId);
152
  }
153
 
154
  public function getResultsLimit($storeId = NULL)
155
  {
156
- return Mage::getStoreConfig(self::XML_PATH_RESULTS_LIMIT, $storeId);
157
  }
158
 
159
  public function isPopupEnabled($storeId = NULL)
160
  {
161
- return Mage::getStoreConfigFlag(self::XML_PATH_IS_POPUP_ENABLED, $storeId);
162
  }
163
 
164
  public function replaceCategories($storeId = NULL)
165
  {
166
- return Mage::getStoreConfigFlag(self::XML_PATH_REPLACE_CATEGORIES, $storeId);
167
  }
168
 
169
  public function isAutoCompleteEnabled($storeId = NULL)
170
  {
171
- return Mage::getStoreConfigFlag(self::XML_PATH_IS_POPUP_ENABLED, $storeId);
172
  }
173
 
174
  public function isInstantEnabled($storeId = NULL)
175
  {
176
- return Mage::getStoreConfigFlag(self::XML_PATH_IS_INSTANT_ENABLED, $storeId);
177
  }
178
 
179
  public function getInstantSelector($storeId = NULL)
180
  {
181
- return Mage::getStoreConfig(self::XML_PATH_INSTANT_SELECTOR, $storeId);
182
  }
183
 
184
  public function getExcludedPages($storeId = NULL)
185
  {
186
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_EXCLUDED_PAGES, $storeId));
187
 
188
  if (is_array($attrs))
189
  return $attrs;
@@ -195,7 +226,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
195
  {
196
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
197
 
198
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_SORTING_INDICES, $storeId));
199
 
200
  $group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
201
 
@@ -229,27 +260,27 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
229
 
230
  public function getApplicationID($storeId = NULL)
231
  {
232
- return Mage::getStoreConfig(self::XML_PATH_APPLICATION_ID, $storeId);
233
  }
234
 
235
  public function getAPIKey($storeId = NULL)
236
  {
237
- return Mage::getStoreConfig(self::XML_PATH_API_KEY, $storeId);
238
  }
239
 
240
  public function getSearchOnlyAPIKey($storeId = NULL)
241
  {
242
- return Mage::getStoreConfig(self::XML_PATH_SEARCH_ONLY_API_KEY, $storeId);
243
  }
244
 
245
  public function getIndexPrefix($storeId = NULL)
246
  {
247
- return Mage::getStoreConfig(self::XML_PATH_INDEX_PREFIX, $storeId);
248
  }
249
 
250
  public function getCategoryAdditionalAttributes($storeId = NULL)
251
  {
252
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_CATEGORY_ATTRIBUTES, $storeId));
253
 
254
  if (is_array($attrs))
255
  return $attrs;
@@ -259,7 +290,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
259
 
260
  public function getProductAdditionalAttributes($storeId = NULL)
261
  {
262
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_PRODUCT_ATTRIBUTES, $storeId));
263
 
264
  if (is_array($attrs))
265
  return $attrs;
@@ -269,7 +300,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
269
 
270
  public function getFacets($storeId = NULL)
271
  {
272
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_FACETS, $storeId));
273
 
274
  foreach ($attrs as &$attr)
275
  if ($attr['type'] == 'other')
@@ -283,7 +314,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
283
 
284
  public function getCategoryCustomRanking($storeId = NULL)
285
  {
286
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_CATEGORY_CUSTOM_RANKING, $storeId));
287
 
288
  if (is_array($attrs))
289
  return $attrs;
@@ -293,7 +324,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
293
 
294
  public function getProductCustomRanking($storeId = NULL)
295
  {
296
- $attrs = unserialize(Mage::getStoreConfig(self::XML_PATH_PRODUCT_CUSTOM_RANKING, $storeId));
297
 
298
  if (is_array($attrs))
299
  return $attrs;
2
 
3
  class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
4
  {
5
+ const MINIMAL_QUERY_LENGTH = 'algoliasearch/ui/minimal_query_length';
6
+ const SEARCH_DELAY = 'algoliasearch/ui/search_delay';
7
+
8
+ const ENABLE_FRONTEND = 'algoliasearch/credentials/enable_frontend';
9
+ const ENABLE_BACKEND = 'algoliasearch/credentials/enable_backend';
10
+ const IS_POPUP_ENABLED = 'algoliasearch/credentials/is_popup_enabled';
11
+ const APPLICATION_ID = 'algoliasearch/credentials/application_id';
12
+ const API_KEY = 'algoliasearch/credentials/api_key';
13
+ const SEARCH_ONLY_API_KEY = 'algoliasearch/credentials/search_only_api_key';
14
+ const INDEX_PREFIX = 'algoliasearch/credentials/index_prefix';
15
+ const IS_INSTANT_ENABLED = 'algoliasearch/credentials/is_instant_enabled';
16
+
17
+ const REPLACE_CATEGORIES = 'algoliasearch/instant/replace_categories';
18
+ const INSTANT_SELECTOR = 'algoliasearch/instant/instant_selector';
19
+ const FACETS = 'algoliasearch/instant/facets';
20
+ const MAX_VALUES_PER_FACET = 'algoliasearch/instant/max_values_per_facet';
21
+ const SORTING_INDICES = 'algoliasearch/instant/sorts';
22
+ const XML_ADD_TO_CART_ENABLE = 'algoliasearch/instant/add_to_cart_enable';
23
+
24
+ const AUTOCOMPLETE_ADD_SECTIONS = 'algoliasearch/autocomplete/additional_sections';
25
+
26
+ const NUMBER_OF_PRODUCT_SUGGESTIONS = 'algoliasearch/products/number_product_suggestions';
27
+ const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results';
28
+ const PRODUCT_ATTRIBUTES = 'algoliasearch/products/product_additional_attributes';
29
+ const PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes';
30
+ const RESULTS_LIMIT = 'algoliasearch/products/results_limit';
31
+
32
+ const NUMBER_OF_CATEGORY_SUGGESTIONS = 'algoliasearch/categories/number_category_suggestions';
33
+ const CATEGORY_ATTRIBUTES = 'algoliasearch/categories/category_additional_attributes2';
34
+ const INDEX_PRODUCT_COUNT = 'algoliasearch/categories/index_product_count';
35
+ const CATEGORY_CUSTOM_RANKING = 'algoliasearch/categories/custom_ranking_category_attributes';
36
+
37
+ const NUMBER_OF_PAGE_SUGGESTIONS = 'algoliasearch/pages/number_page_suggestions';
38
+ const EXCLUDED_PAGES = 'algoliasearch/pages/excluded_pages';
39
+
40
+ const NUMBER_QUERY_SUGGESTIONS = 'algoliasearch/suggestions/number_query_suggestions';
41
+ const MIN_POPULARITY = 'algoliasearch/suggestions/min_popularity';
42
+ const MIN_NUMBER_OF_RESULTS = 'algoliasearch/suggestions/min_number_of_results';
43
+
44
+ const REMOVE_IF_NO_RESULT = 'algoliasearch/relevance/remove_words_if_no_result';
45
+
46
+ const MAX_RETRIES = 'algoliasearch/queue/retries';
47
+ const IS_ACTIVE = 'algoliasearch/queue/active';
48
+ const NUMBER_OF_ELEMENT_BY_PAGE = 'algoliasearch/queue/number_of_element_by_page';
49
+ const NUMBER_OF_JOB_TO_RUN = 'algoliasearch/queue/number_of_job_to_run';
50
+ const NO_PROCESS = 'algoliasearch/queue/noprocess';
51
+
52
+ const PARTIAL_UPDATES = 'algoliasearch/advanced/partial_update';
53
+ const CUSTOMER_GROUPS_ENABLE = 'algoliasearch/advanced/customer_groups_enable';
54
+ const MAKE_SEO_REQUEST = 'algoliasearch/advanced/make_seo_request';
55
+ const REMOVE_BRANDING = 'algoliasearch/advanced/remove_branding';
56
+
57
+ const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
58
+ const LOGGING_ENABLED = 'dev/log/active';
59
+
60
+ public function isEnabledFrontEnd($storeId = null)
61
+ {
62
+ return Mage::getStoreConfigFlag(self::ENABLE_BACKEND, $storeId) && Mage::getStoreConfigFlag(self::ENABLE_FRONTEND, $storeId);
63
+ }
64
+
65
+ public function isEnabledBackend($storeId = null)
66
+ {
67
+ return Mage::getStoreConfigFlag(self::ENABLE_BACKEND, $storeId);
68
+ }
69
+
70
+ public function makeSeoRequest($storeId = null)
71
+ {
72
+ return Mage::getStoreConfigFlag(self::MAKE_SEO_REQUEST, $storeId);
73
+ }
74
+
75
+ public function isLoggingEnabled($storeId = null)
76
+ {
77
+ return Mage::getStoreConfigFlag(self::LOGGING_ENABLED, $storeId);
78
+ }
79
+
80
+ public function getShowOutOfStock($storeId = null)
81
+ {
82
+ return Mage::getStoreConfigFlag(self::SHOW_OUT_OF_STOCK, $storeId);
83
+ }
84
 
85
  public function noProcess($storeId = null)
86
  {
87
+ return Mage::getStoreConfigFlag(self::NO_PROCESS, $storeId);
88
  }
89
 
90
  public function isCustomerGroupsEnabled($storeId = null)
91
  {
92
+ return Mage::getStoreConfigFlag(self::CUSTOMER_GROUPS_ENABLE, $storeId);
93
  }
94
 
95
  public function isPartialUpdateEnabled($storeId = null)
96
  {
97
+ return Mage::getStoreConfigFlag(self::PARTIAL_UPDATES, $storeId);
98
  }
99
 
100
  public function getAutocompleteAdditionnalSections($storeId = null)
101
  {
102
+ $attrs = unserialize(Mage::getStoreConfig(self::AUTOCOMPLETE_ADD_SECTIONS, $storeId));
103
 
104
  if (is_array($attrs))
105
  return array_values($attrs);
109
 
110
  public function getNumberOfQuerySuggestions($storeId = null)
111
  {
112
+ return Mage::getStoreConfig(self::NUMBER_QUERY_SUGGESTIONS, $storeId);
113
  }
114
 
115
  public function getMinPopularity($storeId = null)
116
  {
117
+ return Mage::getStoreConfig(self::MIN_POPULARITY, $storeId);
118
  }
119
 
120
  public function getMinNumberOfResults($storeId = null)
121
  {
122
+ return Mage::getStoreConfig(self::MIN_NUMBER_OF_RESULTS, $storeId);
123
  }
124
 
125
  public function isAddToCartEnable($storeId = null)
129
 
130
  public function isRemoveBranding($storeId = null)
131
  {
132
+ return Mage::getStoreConfigFlag(self::REMOVE_BRANDING, $storeId);
133
  }
134
 
135
  public function getMaxValuesPerFacet($storeId = null)
136
  {
137
+ return Mage::getStoreConfig(self::MAX_VALUES_PER_FACET, $storeId);
138
  }
139
 
140
  public function getQueueMaxRetries($storeId = null)
141
  {
142
+ return Mage::getStoreConfig(self::MAX_RETRIES, $storeId);
143
  }
144
 
145
  public function getNumberOfElementByPage($storeId = null)
146
  {
147
+ return Mage::getStoreConfig(self::NUMBER_OF_ELEMENT_BY_PAGE, $storeId);
148
  }
149
 
150
  public function getNumberOfJobToRun($storeId = null)
151
  {
152
+ return Mage::getStoreConfig(self::NUMBER_OF_JOB_TO_RUN, $storeId);
153
  }
154
 
155
  public function isQueueActive($storeId = null)
156
  {
157
+ return Mage::getStoreConfigFlag(self::IS_ACTIVE, $storeId);
158
  }
159
 
160
  public function getRemoveWordsIfNoResult($storeId = NULL)
161
  {
162
+ return Mage::getStoreConfig(self::REMOVE_IF_NO_RESULT, $storeId);
163
  }
164
 
165
  public function getNumberOfProductSuggestions($storeId = NULL)
166
  {
167
+ return (int) Mage::getStoreConfig(self::NUMBER_OF_PRODUCT_SUGGESTIONS, $storeId);
168
  }
169
 
170
  public function getNumberOfProductResults($storeId = NULL)
171
  {
172
+ return (int) Mage::getStoreConfig(self::NUMBER_OF_PRODUCT_RESULTS, $storeId);
173
  }
174
 
175
  public function getNumberOfCategorySuggestions($storeId = NULL)
176
  {
177
+ return (int) Mage::getStoreConfig(self::NUMBER_OF_CATEGORY_SUGGESTIONS, $storeId);
178
  }
179
 
180
  public function getNumberOfPageSuggestions($storeId = NULL)
181
  {
182
+ return (int) Mage::getStoreConfig(self::NUMBER_OF_PAGE_SUGGESTIONS, $storeId);
183
  }
184
 
185
  public function getResultsLimit($storeId = NULL)
186
  {
187
+ return Mage::getStoreConfig(self::RESULTS_LIMIT, $storeId);
188
  }
189
 
190
  public function isPopupEnabled($storeId = NULL)
191
  {
192
+ return Mage::getStoreConfigFlag(self::IS_POPUP_ENABLED, $storeId);
193
  }
194
 
195
  public function replaceCategories($storeId = NULL)
196
  {
197
+ return Mage::getStoreConfigFlag(self::REPLACE_CATEGORIES, $storeId);
198
  }
199
 
200
  public function isAutoCompleteEnabled($storeId = NULL)
201
  {
202
+ return Mage::getStoreConfigFlag(self::IS_POPUP_ENABLED, $storeId);
203
  }
204
 
205
  public function isInstantEnabled($storeId = NULL)
206
  {
207
+ return Mage::getStoreConfigFlag(self::IS_INSTANT_ENABLED, $storeId);
208
  }
209
 
210
  public function getInstantSelector($storeId = NULL)
211
  {
212
+ return Mage::getStoreConfig(self::INSTANT_SELECTOR, $storeId);
213
  }
214
 
215
  public function getExcludedPages($storeId = NULL)
216
  {
217
+ $attrs = unserialize(Mage::getStoreConfig(self::EXCLUDED_PAGES, $storeId));
218
 
219
  if (is_array($attrs))
220
  return $attrs;
226
  {
227
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
228
 
229
+ $attrs = unserialize(Mage::getStoreConfig(self::SORTING_INDICES, $storeId));
230
 
231
  $group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
232
 
260
 
261
  public function getApplicationID($storeId = NULL)
262
  {
263
+ return Mage::getStoreConfig(self::APPLICATION_ID, $storeId);
264
  }
265
 
266
  public function getAPIKey($storeId = NULL)
267
  {
268
+ return Mage::getStoreConfig(self::API_KEY, $storeId);
269
  }
270
 
271
  public function getSearchOnlyAPIKey($storeId = NULL)
272
  {
273
+ return Mage::getStoreConfig(self::SEARCH_ONLY_API_KEY, $storeId);
274
  }
275
 
276
  public function getIndexPrefix($storeId = NULL)
277
  {
278
+ return Mage::getStoreConfig(self::INDEX_PREFIX, $storeId);
279
  }
280
 
281
  public function getCategoryAdditionalAttributes($storeId = NULL)
282
  {
283
+ $attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_ATTRIBUTES, $storeId));
284
 
285
  if (is_array($attrs))
286
  return $attrs;
290
 
291
  public function getProductAdditionalAttributes($storeId = NULL)
292
  {
293
+ $attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_ATTRIBUTES, $storeId));
294
 
295
  if (is_array($attrs))
296
  return $attrs;
300
 
301
  public function getFacets($storeId = NULL)
302
  {
303
+ $attrs = unserialize(Mage::getStoreConfig(self::FACETS, $storeId));
304
 
305
  foreach ($attrs as &$attr)
306
  if ($attr['type'] == 'other')
314
 
315
  public function getCategoryCustomRanking($storeId = NULL)
316
  {
317
+ $attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_CUSTOM_RANKING, $storeId));
318
 
319
  if (is_array($attrs))
320
  return $attrs;
324
 
325
  public function getProductCustomRanking($storeId = NULL)
326
  {
327
+ $attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_CUSTOM_RANKING, $storeId));
328
 
329
  if (is_array($attrs))
330
  return $attrs;
app/code/community/Algolia/Algoliasearch/Helper/Data.php CHANGED
@@ -19,11 +19,13 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
19
  protected $category_helper;
20
  protected $product_helper;
21
 
 
 
22
  protected $config;
23
 
24
  public function __construct()
25
  {
26
- \AlgoliaSearch\Version::$custom_value = " Magento (1.4.6)";
27
 
28
  $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
29
 
@@ -34,25 +36,51 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
34
  $this->additionalsections_helper = Mage::helper('algoliasearch/entity_additionalsectionshelper');
35
 
36
  $this->config = Mage::helper('algoliasearch/config');
 
 
37
  }
38
 
39
  public function deleteProductsStoreIndices($storeId = null)
40
  {
 
 
 
 
 
 
 
 
 
41
  $this->algolia_helper->deleteIndex($this->product_helper->getIndexName($storeId));
42
  }
43
 
44
  public function deleteCategoriesStoreIndices($storeId = null)
45
  {
 
 
 
 
 
 
 
 
 
46
  $this->algolia_helper->deleteIndex($this->category_helper->getIndexName($storeId));
47
  }
48
 
49
- public function saveConfigurationToAlgolia($storeId = null)
50
  {
51
  $this->algolia_helper->resetCredentialsFromConfig();
52
 
53
  if (! ($this->config->getApplicationID() && $this->config->getAPIKey()))
54
  return;
55
 
 
 
 
 
 
 
56
  $this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId), $this->category_helper->getIndexSettings($storeId));
57
  $this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId), $this->page_helper->getIndexSettings($storeId));
58
  $this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId), $this->suggestion_helper->getIndexSettings($storeId));
@@ -102,6 +130,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
102
 
103
  foreach ($store_ids as $store_id)
104
  {
 
 
 
 
 
 
105
  $index_name = $this->product_helper->getIndexName($store_id);
106
 
107
  $this->algolia_helper->deleteObjects($ids, $index_name);
@@ -129,6 +163,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
129
 
130
  foreach ($store_ids as $store_id)
131
  {
 
 
 
 
 
 
132
  $index_name = $this->category_helper->getIndexName($store_id);
133
 
134
  $this->algolia_helper->deleteObjects($ids, $index_name);
@@ -137,6 +177,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
137
 
138
  public function rebuildStoreAdditionalSectionsIndex($storeId)
139
  {
 
 
 
 
 
 
140
  $additionnal_sections = $this->config->getAutocompleteAdditionnalSections();
141
 
142
  foreach ($additionnal_sections as $section)
@@ -156,6 +202,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
156
 
157
  public function rebuildStorePageIndex($storeId)
158
  {
 
 
 
 
 
 
159
  $emulationInfo = $this->startEmulation($storeId);
160
 
161
  $index_name = $this->page_helper->getIndexName($storeId);
@@ -174,6 +226,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
174
 
175
  public function rebuildStoreCategoryIndex($storeId, $categoryIds = null)
176
  {
 
 
 
 
 
 
177
  $emulationInfo = $this->startEmulation($storeId);
178
 
179
  try
@@ -209,6 +267,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
209
 
210
  public function rebuildStoreSuggestionIndex($storeId)
211
  {
 
 
 
 
 
 
212
  $collection = $this->suggestion_helper->getSuggestionCollectionQuery($storeId);
213
 
214
  $size = $collection->getSize();
@@ -232,11 +296,23 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
232
 
233
  public function moveStoreSuggestionIndex($storeId)
234
  {
 
 
 
 
 
 
235
  $this->algolia_helper->moveIndex($this->suggestion_helper->getIndexName($storeId) . '_tmp', $this->suggestion_helper->getIndexName($storeId));
236
  }
237
 
238
  public function rebuildStoreProductIndex($storeId, $productIds)
239
  {
 
 
 
 
 
 
240
  $emulationInfo = $this->startEmulation($storeId);
241
 
242
  try
@@ -245,6 +321,8 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
245
 
246
  $size = $collection->getSize();
247
 
 
 
248
  if ($size > 0)
249
  {
250
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
@@ -270,6 +348,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
270
 
271
  public function rebuildStoreSuggestionIndexPage($storeId, $collectionDefault, $page, $pageSize)
272
  {
 
 
 
 
 
 
273
  $collection = clone $collectionDefault;
274
  $collection->setCurPage($page)->setPageSize($pageSize);
275
  $collection->load();
@@ -302,6 +386,12 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
302
 
303
  public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
304
  {
 
 
 
 
 
 
305
  $emulationInfoPage = null;
306
 
307
  if ($emulationInfo === null)
@@ -347,6 +437,8 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
347
  {
348
  $indexData = array();
349
 
 
 
350
  /** @var $product Mage_Catalog_Model_Product */
351
  foreach ($collection as $product)
352
  {
@@ -356,35 +448,58 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
356
 
357
  array_push($indexData, $json);
358
  }
 
359
 
360
  return $indexData;
361
  }
362
 
363
  public function rebuildStoreProductIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
364
  {
 
 
 
 
 
 
 
365
  $emulationInfoPage = null;
366
 
367
  if ($emulationInfo === null)
368
  $emulationInfoPage = $this->startEmulation($storeId);
369
 
 
 
 
 
370
  $collection = clone $collectionDefault;
371
  $collection->setCurPage($page)->setPageSize($pageSize);
372
  $collection->addCategoryIds();
373
  $collection->addUrlRewrite();
374
- $collection->joinField('stock_qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
375
- $collection->getSelect()->columns('sku, (SELECT SUM(qty_ordered) FROM sales_flat_order_item WHERE sales_flat_order_item.sku = e.sku) as ordered_qty');
376
- $collection->getSelect()->columns('(SELECT rating_summary FROM review_entity_summary WHERE review_entity_summary.entity_pk_value = e.entity_id AND review_entity_summary.store_id='.$storeId.') as rating_summary');
 
 
 
 
 
 
 
 
 
377
  $collection->load();
378
 
 
 
 
379
  $index_name = $this->product_helper->getIndexName($storeId);
380
 
381
- /**
382
- * Normal Indexing
383
- */
384
  $indexData = $this->getProductsRecords($storeId, $collection);
385
 
 
386
  if (count($indexData) > 0)
387
  $this->algolia_helper->addObjects($indexData, $index_name);
 
388
 
389
  unset($indexData);
390
 
@@ -395,10 +510,13 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
395
 
396
  if ($emulationInfo === null)
397
  $this->stopEmulation($emulationInfoPage);
 
 
398
  }
399
 
400
  public function startEmulation($storeId)
401
  {
 
402
  $appEmulation = Mage::getSingleton('core/app_emulation');
403
 
404
  $info = $appEmulation->startEnvironmentEmulation($storeId);
@@ -411,11 +529,13 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
411
  Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, FALSE);
412
  Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, FALSE);
413
 
 
414
  return $info;
415
  }
416
 
417
  public function stopEmulation($info)
418
  {
 
419
  $appEmulation = Mage::getSingleton('core/app_emulation');
420
 
421
  Mage::app()->setCurrentStore($info->getInitialStoreId());
@@ -423,5 +543,6 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
423
  Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, $info->getUseCategoryFlat());
424
 
425
  $appEmulation->stopEnvironmentEmulation($info);
 
426
  }
427
  }
19
  protected $category_helper;
20
  protected $product_helper;
21
 
22
+ /** @var Algolia_Algoliasearch_Helper_Logger */
23
+ protected $logger;
24
  protected $config;
25
 
26
  public function __construct()
27
  {
28
+ \AlgoliaSearch\Version::$custom_value = " Magento (1.4.7)";
29
 
30
  $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
31
 
36
  $this->additionalsections_helper = Mage::helper('algoliasearch/entity_additionalsectionshelper');
37
 
38
  $this->config = Mage::helper('algoliasearch/config');
39
+
40
+ $this->logger = Mage::helper('algoliasearch/logger');
41
  }
42
 
43
  public function deleteProductsStoreIndices($storeId = null)
44
  {
45
+ if ($storeId !== null)
46
+ {
47
+ if ($this->config->isEnabledBackEnd($storeId) === false)
48
+ {
49
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
50
+ return;
51
+ }
52
+ }
53
+
54
  $this->algolia_helper->deleteIndex($this->product_helper->getIndexName($storeId));
55
  }
56
 
57
  public function deleteCategoriesStoreIndices($storeId = null)
58
  {
59
+ if ($storeId !== null)
60
+ {
61
+ if ($this->config->isEnabledBackEnd($storeId) === false)
62
+ {
63
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
64
+ return;
65
+ }
66
+ }
67
+
68
  $this->algolia_helper->deleteIndex($this->category_helper->getIndexName($storeId));
69
  }
70
 
71
+ public function saveConfigurationToAlgolia($storeId)
72
  {
73
  $this->algolia_helper->resetCredentialsFromConfig();
74
 
75
  if (! ($this->config->getApplicationID() && $this->config->getAPIKey()))
76
  return;
77
 
78
+ if ($this->config->isEnabledBackEnd($storeId) === false)
79
+ {
80
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
81
+ return;
82
+ }
83
+
84
  $this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId), $this->category_helper->getIndexSettings($storeId));
85
  $this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId), $this->page_helper->getIndexSettings($storeId));
86
  $this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId), $this->suggestion_helper->getIndexSettings($storeId));
130
 
131
  foreach ($store_ids as $store_id)
132
  {
133
+ if ($this->config->isEnabledBackEnd($store_id) === false)
134
+ {
135
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store_id));
136
+ continue;
137
+ }
138
+
139
  $index_name = $this->product_helper->getIndexName($store_id);
140
 
141
  $this->algolia_helper->deleteObjects($ids, $index_name);
163
 
164
  foreach ($store_ids as $store_id)
165
  {
166
+ if ($this->config->isEnabledBackEnd($store_id) === false)
167
+ {
168
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store_id));
169
+ continue;
170
+ }
171
+
172
  $index_name = $this->category_helper->getIndexName($store_id);
173
 
174
  $this->algolia_helper->deleteObjects($ids, $index_name);
177
 
178
  public function rebuildStoreAdditionalSectionsIndex($storeId)
179
  {
180
+ if ($this->config->isEnabledBackEnd($storeId) === false)
181
+ {
182
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
183
+ return;
184
+ }
185
+
186
  $additionnal_sections = $this->config->getAutocompleteAdditionnalSections();
187
 
188
  foreach ($additionnal_sections as $section)
202
 
203
  public function rebuildStorePageIndex($storeId)
204
  {
205
+ if ($this->config->isEnabledBackEnd($storeId) === false)
206
+ {
207
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
208
+ return;
209
+ }
210
+
211
  $emulationInfo = $this->startEmulation($storeId);
212
 
213
  $index_name = $this->page_helper->getIndexName($storeId);
226
 
227
  public function rebuildStoreCategoryIndex($storeId, $categoryIds = null)
228
  {
229
+ if ($this->config->isEnabledBackEnd($storeId) === false)
230
+ {
231
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
232
+ return;
233
+ }
234
+
235
  $emulationInfo = $this->startEmulation($storeId);
236
 
237
  try
267
 
268
  public function rebuildStoreSuggestionIndex($storeId)
269
  {
270
+ if ($this->config->isEnabledBackEnd($storeId) === false)
271
+ {
272
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
273
+ return;
274
+ }
275
+
276
  $collection = $this->suggestion_helper->getSuggestionCollectionQuery($storeId);
277
 
278
  $size = $collection->getSize();
296
 
297
  public function moveStoreSuggestionIndex($storeId)
298
  {
299
+ if ($this->config->isEnabledBackEnd($storeId) === false)
300
+ {
301
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
302
+ return;
303
+ }
304
+
305
  $this->algolia_helper->moveIndex($this->suggestion_helper->getIndexName($storeId) . '_tmp', $this->suggestion_helper->getIndexName($storeId));
306
  }
307
 
308
  public function rebuildStoreProductIndex($storeId, $productIds)
309
  {
310
+ if ($this->config->isEnabledBackEnd($storeId) === false)
311
+ {
312
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
313
+ return;
314
+ }
315
+
316
  $emulationInfo = $this->startEmulation($storeId);
317
 
318
  try
321
 
322
  $size = $collection->getSize();
323
 
324
+ $this->logger->log('Store '.$this->logger->getStoreName($storeId). ' collection size : '.$size);
325
+
326
  if ($size > 0)
327
  {
328
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
348
 
349
  public function rebuildStoreSuggestionIndexPage($storeId, $collectionDefault, $page, $pageSize)
350
  {
351
+ if ($this->config->isEnabledBackEnd($storeId) === false)
352
+ {
353
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
354
+ return;
355
+ }
356
+
357
  $collection = clone $collectionDefault;
358
  $collection->setCurPage($page)->setPageSize($pageSize);
359
  $collection->load();
386
 
387
  public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
388
  {
389
+ if ($this->config->isEnabledBackEnd($storeId) === false)
390
+ {
391
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
392
+ return;
393
+ }
394
+
395
  $emulationInfoPage = null;
396
 
397
  if ($emulationInfo === null)
437
  {
438
  $indexData = array();
439
 
440
+ $this->logger->start('CREATE RECORDS '.$this->logger->getStoreName($storeId));
441
+ $this->logger->log(count($collection). ' product records to create');
442
  /** @var $product Mage_Catalog_Model_Product */
443
  foreach ($collection as $product)
444
  {
448
 
449
  array_push($indexData, $json);
450
  }
451
+ $this->logger->stop('CREATE RECORDS '.$this->logger->getStoreName($storeId));
452
 
453
  return $indexData;
454
  }
455
 
456
  public function rebuildStoreProductIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
457
  {
458
+ if ($this->config->isEnabledBackEnd($storeId) === false)
459
+ {
460
+ $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
461
+ return;
462
+ }
463
+
464
+ $this->logger->start('rebuildStoreProductIndexPage '.$this->logger->getStoreName($storeId).' page ' . $page . ' pageSize '. $pageSize);
465
  $emulationInfoPage = null;
466
 
467
  if ($emulationInfo === null)
468
  $emulationInfoPage = $this->startEmulation($storeId);
469
 
470
+ $index_prefix = Mage::getConfig()->getTablePrefix();
471
+
472
+ $additionalAttributes = $this->config->getProductAdditionalAttributes($storeId);
473
+
474
  $collection = clone $collectionDefault;
475
  $collection->setCurPage($page)->setPageSize($pageSize);
476
  $collection->addCategoryIds();
477
  $collection->addUrlRewrite();
478
+
479
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'stock_qty'))
480
+ $collection->joinField('stock_qty', $index_prefix.'cataloginventory_stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
481
+
482
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'ordered_qty'))
483
+ $collection->getSelect()->columns('(SELECT SUM(qty_ordered) FROM '.$index_prefix.'sales_flat_order_item WHERE sales_flat_order_item.product_id = e.entity_id) as ordered_qty');
484
+
485
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'rating_summary'))
486
+ $collection->joinField('rating_summary', $index_prefix.'review_entity_summary', 'rating_summary', 'entity_pk_value=entity_id', '{{table}}.store_id='.$storeId, 'left');
487
+
488
+ $this->logger->start('LOADING '.$this->logger->getStoreName($storeId). ' collection page '. $page . ', pageSize '.$pageSize);
489
+
490
  $collection->load();
491
 
492
+ $this->logger->log('Loaded '.count($collection).' products');
493
+ $this->logger->stop('LOADING '.$this->logger->getStoreName($storeId). ' collection page '. $page . ', pageSize '.$pageSize);
494
+
495
  $index_name = $this->product_helper->getIndexName($storeId);
496
 
 
 
 
497
  $indexData = $this->getProductsRecords($storeId, $collection);
498
 
499
+ $this->logger->start('SEND TO ALGOLIA');
500
  if (count($indexData) > 0)
501
  $this->algolia_helper->addObjects($indexData, $index_name);
502
+ $this->logger->stop('SEND TO ALGOLIA');
503
 
504
  unset($indexData);
505
 
510
 
511
  if ($emulationInfo === null)
512
  $this->stopEmulation($emulationInfoPage);
513
+
514
+ $this->logger->stop('rebuildStoreProductIndexPage '.$this->logger->getStoreName($storeId).' page ' . $page . ' pageSize '. $pageSize);
515
  }
516
 
517
  public function startEmulation($storeId)
518
  {
519
+ $this->logger->start('START EMULATION');
520
  $appEmulation = Mage::getSingleton('core/app_emulation');
521
 
522
  $info = $appEmulation->startEnvironmentEmulation($storeId);
529
  Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, FALSE);
530
  Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, FALSE);
531
 
532
+ $this->logger->stop('START EMULATION');
533
  return $info;
534
  }
535
 
536
  public function stopEmulation($info)
537
  {
538
+ $this->logger->start('STOP EMULATION');
539
  $appEmulation = Mage::getSingleton('core/app_emulation');
540
 
541
  Mage::app()->setCurrentStore($info->getInitialStoreId());
543
  Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, $info->getUseCategoryFlat());
544
 
545
  $appEmulation->stopEnvironmentEmulation($info);
546
+ $this->logger->stop('STOP EMULATION');
547
  }
548
  }
app/code/community/Algolia/Algoliasearch/Helper/Entity/Categoryhelper.php CHANGED
@@ -117,7 +117,9 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
117
  {
118
  /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
119
  $productCollection = $category->getProductCollection();
120
- $category->setProductCount($productCollection->addMinimalPrice()->count());
 
 
121
 
122
  $transport = new Varien_Object();
123
  Mage::dispatchEvent('algolia_category_index_before', array('category' => $category, 'custom_data' => $transport));
117
  {
118
  /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
119
  $productCollection = $category->getProductCollection();
120
+ $productCollection = $productCollection->addMinimalPrice();
121
+
122
+ $category->setProductCount($productCollection->getSize());
123
 
124
  $transport = new Varien_Object();
125
  Mage::dispatchEvent('algolia_category_index_before', array('category' => $category, 'custom_data' => $transport));
app/code/community/Algolia/Algoliasearch/Helper/Entity/Helper.php CHANGED
@@ -3,6 +3,8 @@
3
  abstract class Algolia_Algoliasearch_Helper_Entity_Helper
4
  {
5
  protected $config;
 
 
6
  protected $algolia_helper;
7
 
8
  protected static $_activeCategories;
@@ -14,6 +16,7 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
14
  {
15
  $this->config = Mage::helper('algoliasearch/config');
16
  $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
 
17
  }
18
 
19
  public function getBaseIndexName($storeId = null)
3
  abstract class Algolia_Algoliasearch_Helper_Entity_Helper
4
  {
5
  protected $config;
6
+ /** @var Algolia_Algoliasearch_Helper_Logger */
7
+ protected $logger;
8
  protected $algolia_helper;
9
 
10
  protected static $_activeCategories;
16
  {
17
  $this->config = Mage::helper('algoliasearch/config');
18
  $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
19
+ $this->logger = Mage::helper('algoliasearch/logger');
20
  }
21
 
22
  public function getBaseIndexName($storeId = null)
app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php CHANGED
@@ -50,7 +50,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
50
  return $attributes;
51
  }
52
 
53
- protected function isAttributeEnabled($additionalAttributes, $attr_name)
54
  {
55
  foreach ($additionalAttributes as $attr)
56
  if ($attr['attribute'] === $attr_name)
@@ -59,7 +59,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
59
  return false;
60
  }
61
 
62
- public function getProductCollectionQuery($storeId, $productIds = null, $only_visible = true, $additional_attributes = true)
63
  {
64
  /** @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
65
  $products = Mage::getResourceModel('catalog/product_collection');
@@ -70,6 +70,9 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
70
  if ($only_visible)
71
  $products = $products->addAttributeToFilter('visibility', array('in' => Mage::getSingleton('catalog/product_visibility')->getVisibleInSearchIds()));
72
 
 
 
 
73
  $products = $products->addFinalPrice()
74
  ->addAttributeToSelect('special_from_date')
75
  ->addAttributeToSelect('special_to_date')
@@ -77,13 +80,10 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
77
 
78
  $additionalAttr = $this->config->getProductAdditionalAttributes($storeId);
79
 
80
- if ($additional_attributes)
81
- {
82
- foreach ($additionalAttr as &$attr)
83
- $attr = $attr['attribute'];
84
 
85
- $products = $products->addAttributeToSelect(array_values(array_merge(static::$_predefinedProductAttributes, $additionalAttr)));
86
- }
87
 
88
  if ($productIds && count($productIds) > 0)
89
  $products = $products->addAttributeToFilter('entity_id', array('in' => $productIds));
@@ -223,7 +223,11 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
223
 
224
  $mergeSettings['ranking'] = array($values['sort'].'('.$sort_attribute.')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');
225
 
226
- $this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' .$values['attribute'].'_' . 'default' . '_'.$values['sort'], $mergeSettings);
 
 
 
 
227
  }
228
  }
229
  }
@@ -314,13 +318,18 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
314
 
315
  if ($product->getTypeId() == 'grouped' || $product->getTypeId() == 'configurable')
316
  {
317
- foreach ($sub_products as $sub_product)
318
  {
319
- $price = (double) Mage::helper('tax')->getPrice($sub_product, $sub_product->getFinalPrice(), null, null, null, null, $product->getStore(), null);
 
 
320
 
321
- $min = min($min, $price);
322
- $max = max($max, $price);
 
323
  }
 
 
324
  }
325
 
326
  if ($min != $max)
@@ -370,6 +379,8 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
370
 
371
  public function getObject(Mage_Catalog_Model_Product $product)
372
  {
 
 
373
  $defaultData = array();
374
 
375
  $transport = new Varien_Object($defaultData);
@@ -395,32 +406,35 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
395
  $categories = array();
396
  $categories_with_path = array();
397
 
398
- $categoryCollection = Mage::getResourceModel('catalog/category_collection')
399
- ->addAttributeToSelect('name')
400
- ->addAttributeToFilter('entity_id', $product->getCategoryIds())
401
- ->addIsActiveFilter();
402
 
403
- foreach ($categoryCollection as $category)
404
  {
405
- $categoryName = $category->getName();
406
-
407
- if ($categoryName)
408
- $categories[] = $categoryName;
409
 
410
- $category->getUrlInstance()->setStore($product->getStoreId());
411
- $path = array();
412
-
413
- foreach ($category->getPathIds() as $treeCategoryId)
414
  {
415
- $name = $this->getCategoryName($treeCategoryId, $product->getStoreId());
416
- if ($name)
417
- $path[] = $name;
418
- }
419
 
420
- $categories_with_path[] = $path;
421
- }
422
 
 
 
 
 
 
 
 
 
 
423
 
 
 
 
424
 
425
  foreach ($categories_with_path as $result)
426
  {
@@ -455,7 +469,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
455
  foreach ($categories_with_path as &$category)
456
  $category = implode(' /// ',$category);
457
 
458
- $customData['categories'] = $categories_hierarchical;//array_values($categories_with_path);
459
 
460
  $customData['categories_without_path'] = $categories;
461
 
@@ -511,8 +525,9 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
511
 
512
  if (count($ids))
513
  {
514
- $sub_products = $this->getProductCollectionQuery($product->getStoreId(), $ids, false, false)->load();
515
- } else
 
516
  {
517
  $sub_products = array();
518
  }
@@ -534,7 +549,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
534
 
535
  if (Mage::helper('core')->isModuleEnabled('Mage_Review'))
536
  if ($this->isAttributeEnabled($additionalAttributes, 'rating_summary'))
537
- $customData['rating_summary'] = $product->getRatingSummary();
538
 
539
  foreach ($additionalAttributes as $attribute)
540
  {
@@ -625,6 +640,8 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
625
 
626
  $this->castProductObject($customData);
627
 
 
 
628
  return $customData;
629
  }
630
  }
50
  return $attributes;
51
  }
52
 
53
+ public function isAttributeEnabled($additionalAttributes, $attr_name)
54
  {
55
  foreach ($additionalAttributes as $attr)
56
  if ($attr['attribute'] === $attr_name)
59
  return false;
60
  }
61
 
62
+ public function getProductCollectionQuery($storeId, $productIds = null, $only_visible = true)
63
  {
64
  /** @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
65
  $products = Mage::getResourceModel('catalog/product_collection');
70
  if ($only_visible)
71
  $products = $products->addAttributeToFilter('visibility', array('in' => Mage::getSingleton('catalog/product_visibility')->getVisibleInSearchIds()));
72
 
73
+ if (false === $this->config->getShowOutOfStock($storeId))
74
+ Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
75
+
76
  $products = $products->addFinalPrice()
77
  ->addAttributeToSelect('special_from_date')
78
  ->addAttributeToSelect('special_to_date')
80
 
81
  $additionalAttr = $this->config->getProductAdditionalAttributes($storeId);
82
 
83
+ foreach ($additionalAttr as &$attr)
84
+ $attr = $attr['attribute'];
 
 
85
 
86
+ $products = $products->addAttributeToSelect(array_values(array_merge(static::$_predefinedProductAttributes, $additionalAttr)));
 
87
 
88
  if ($productIds && count($productIds) > 0)
89
  $products = $products->addAttributeToFilter('entity_id', array('in' => $productIds));
223
 
224
  $mergeSettings['ranking'] = array($values['sort'].'('.$sort_attribute.')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');
225
 
226
+ if ($values['attribute'] === 'price')
227
+ $this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' .$values['attribute']. '_default_' . $values['sort'], $mergeSettings);
228
+ else
229
+ $this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' .$values['attribute']. '_' . $values['sort'], $mergeSettings);
230
+
231
  }
232
  }
233
  }
318
 
319
  if ($product->getTypeId() == 'grouped' || $product->getTypeId() == 'configurable')
320
  {
321
+ if (count($sub_products) > 0)
322
  {
323
+ foreach ($sub_products as $sub_product)
324
+ {
325
+ $price = (double) Mage::helper('tax')->getPrice($sub_product, $sub_product->getFinalPrice(), null, null, null, null, $product->getStore(), null);
326
 
327
+ $min = min($min, $price);
328
+ $max = max($max, $price);
329
+ }
330
  }
331
+ else
332
+ $min = $max; // avoid to have PHP_INT_MAX in case of no subproducts (Corner case of visibility and stock options)
333
  }
334
 
335
  if ($min != $max)
379
 
380
  public function getObject(Mage_Catalog_Model_Product $product)
381
  {
382
+ $this->logger->start('CREATE RECORD '.$product->getId(). ' '.$this->logger->getStoreName($product->storeId));
383
+ $this->logger->log('Product type ('.$product->getTypeId().')');
384
  $defaultData = array();
385
 
386
  $transport = new Varien_Object($defaultData);
406
  $categories = array();
407
  $categories_with_path = array();
408
 
409
+ $_categoryIds = $product->getCategoryIds();
 
 
 
410
 
411
+ if (is_array($_categoryIds) && count($_categoryIds) > 0)
412
  {
413
+ $categoryCollection = Mage::getResourceModel('catalog/category_collection')
414
+ ->addAttributeToSelect('name')
415
+ ->addAttributeToFilter('entity_id', $_categoryIds)
416
+ ->addIsActiveFilter();
417
 
418
+ foreach ($categoryCollection as $category)
 
 
 
419
  {
420
+ $categoryName = $category->getName();
 
 
 
421
 
422
+ if ($categoryName)
423
+ $categories[] = $categoryName;
424
 
425
+ $category->getUrlInstance()->setStore($product->getStoreId());
426
+ $path = array();
427
+
428
+ foreach ($category->getPathIds() as $treeCategoryId)
429
+ {
430
+ $name = $this->getCategoryName($treeCategoryId, $product->getStoreId());
431
+ if ($name)
432
+ $path[] = $name;
433
+ }
434
 
435
+ $categories_with_path[] = $path;
436
+ }
437
+ }
438
 
439
  foreach ($categories_with_path as $result)
440
  {
469
  foreach ($categories_with_path as &$category)
470
  $category = implode(' /// ',$category);
471
 
472
+ $customData['categories'] = $categories_hierarchical;
473
 
474
  $customData['categories_without_path'] = $categories;
475
 
525
 
526
  if (count($ids))
527
  {
528
+ $sub_products = $this->getProductCollectionQuery($product->getStoreId(), $ids, false)->load();
529
+ }
530
+ else
531
  {
532
  $sub_products = array();
533
  }
549
 
550
  if (Mage::helper('core')->isModuleEnabled('Mage_Review'))
551
  if ($this->isAttributeEnabled($additionalAttributes, 'rating_summary'))
552
+ $customData['rating_summary'] = (int) $product->getRatingSummary();
553
 
554
  foreach ($additionalAttributes as $attribute)
555
  {
640
 
641
  $this->castProductObject($customData);
642
 
643
+ $this->logger->stop('CREATE RECORD '.$product->getId(). ' '.$this->logger->getStoreName($product->storeId));
644
+
645
  return $customData;
646
  }
647
  }
app/code/community/Algolia/Algoliasearch/Helper/Logger.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
4
+ {
5
+ private $enabled;
6
+ private $config;
7
+ private $timers = array();
8
+ private $stores = array();
9
+
10
+ public function __construct()
11
+ {
12
+ $this->config = Mage::helper('algoliasearch/config');
13
+ $this->enabled = $this->config->isLoggingEnabled();
14
+
15
+ foreach (Mage::app()->getStores() as $store)
16
+ $this->stores[$store->getId()] = $store->getName();
17
+ }
18
+
19
+ public function isEnable()
20
+ {
21
+ return $this->enabled;
22
+ }
23
+
24
+ public function getStoreName($storeId)
25
+ {
26
+ if ($storeId === null)
27
+ return 'undefined store';
28
+
29
+ return $storeId . ' (' . $this->stores[$storeId] . ')';
30
+ }
31
+
32
+ public function start($action)
33
+ {
34
+ if ($this->enabled == false)
35
+ return;
36
+
37
+ $this->log('');
38
+ $this->log('');
39
+ $this->log('>>>>> BEGIN '.$action);
40
+ $this->timers[$action] = microtime(true);
41
+ }
42
+
43
+ public function stop($action)
44
+ {
45
+ if ($this->enabled == false)
46
+ return;
47
+
48
+ if (false === isset($this->timers[$action]))
49
+ throw new Exception("Algolia Logger => non existing action");
50
+
51
+ $this->log('<<<<< END ' .$action. ' (' . $this->formatTime($this->timers[$action], microtime(true)) . ')');
52
+ }
53
+
54
+ public function log($message)
55
+ {
56
+ Mage::log($message, null, 'algolia.log');
57
+ }
58
+
59
+ private function formatTime($begin, $end)
60
+ {
61
+ return ($end - $begin).'sec';
62
+ }
63
+ }
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algolia.php CHANGED
@@ -11,12 +11,16 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
11
  public static $product_categories = array();
12
  private static $credential_error = false;
13
 
 
 
 
14
  public function __construct()
15
  {
16
  parent::__construct();
17
 
18
  $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
19
  $this->config = Mage::helper('algoliasearch/config');
 
20
  }
21
 
22
  protected $_matchedEntities = array(
@@ -66,7 +70,9 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
66
 
67
  public function matchEvent(Mage_Index_Model_Event $event)
68
  {
69
- $result = true;
 
 
70
 
71
  $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
72
 
@@ -86,6 +92,35 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
86
  case Mage_Core_Model_Store_Group::ENTITY:
87
  $event->addNewData('algoliasearch_reindex_all', TRUE);
88
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
  }
91
 
@@ -115,6 +150,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
115
  {
116
  $event->addNewData('catalogsearch_update_product_id', $product->getId());
117
 
 
118
  if (isset(static::$product_categories[$product->getId()]))
119
  {
120
  $oldCategories = static::$product_categories[$product->getId()];
@@ -297,10 +333,13 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
297
  if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
298
  {
299
  Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
300
  return;
301
  }
302
 
 
303
  $this->engine->rebuildProducts();
 
304
 
305
  return $this;
306
  }
11
  public static $product_categories = array();
12
  private static $credential_error = false;
13
 
14
+ /** @var Algolia_Algoliasearch_Helper_Logger */
15
+ private $logger;
16
+
17
  public function __construct()
18
  {
19
  parent::__construct();
20
 
21
  $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
22
  $this->config = Mage::helper('algoliasearch/config');
23
+ $this->logger = Mage::helper('algoliasearch/logger');
24
  }
25
 
26
  protected $_matchedEntities = array(
70
 
71
  public function matchEvent(Mage_Index_Model_Event $event)
72
  {
73
+ $process = Mage::getModel('index/indexer')->getProcessByCode('algolia_search_indexer');
74
+
75
+ $result = $process->getMode() !== Mage_Index_Model_Process::MODE_MANUAL;
76
 
77
  $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
78
 
92
  case Mage_Core_Model_Store_Group::ENTITY:
93
  $event->addNewData('algoliasearch_reindex_all', TRUE);
94
  break;
95
+ case Mage_CatalogInventory_Model_Stock_Item::ENTITY:
96
+ if (false == $this->config->getShowOutOfStock())
97
+ $this->_registerCatalogInventoryStockItemEvent($event);
98
+ break;
99
+ }
100
+ }
101
+
102
+ protected function _registerCatalogInventoryStockItemEvent(Mage_Index_Model_Event $event)
103
+ {
104
+ if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE)
105
+ {
106
+ $object = $event->getDataObject();
107
+
108
+ $product = Mage::getModel('catalog/product')->load($object->getProductId());
109
+
110
+ if ($object->getData('is_in_stock') == false|| $product->getQty() <= 0)
111
+ {
112
+ try // In case of wrong credentials or overquota or block account. To avoid checkout process to fail
113
+ {
114
+ $event->addNewData('catalogsearch_delete_product_id', $product->getId());
115
+ $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
116
+ }
117
+ catch(\Exception $e)
118
+ {
119
+ $this->logger->log('Error while trying to update stock');
120
+ $this->logger->log($e->getMessage());
121
+ $this->logger->log($e->getTraceAsString());
122
+ }
123
+ }
124
  }
125
  }
126
 
150
  {
151
  $event->addNewData('catalogsearch_update_product_id', $product->getId());
152
 
153
+ /* product_categories is filled in Observer::saveProduct */
154
  if (isset(static::$product_categories[$product->getId()]))
155
  {
156
  $oldCategories = static::$product_categories[$product->getId()];
333
  if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
334
  {
335
  Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
336
+ $this->logger->log('ERROR Credentials not configured correctly');
337
  return;
338
  }
339
 
340
+ $this->logger->start('PRODUCTS FULL REINDEX');
341
  $this->engine->rebuildProducts();
342
+ $this->logger->stop('PRODUCTS FULL REINDEX');
343
 
344
  return $this;
345
  }
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliacategories.php CHANGED
@@ -8,7 +8,6 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
8
  private $engine;
9
  private $config;
10
 
11
- public static $product_categories = array();
12
  private static $credential_error = false;
13
 
14
  public function __construct()
@@ -177,9 +176,6 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
177
  $this->engine
178
  ->rebuildCategoryIndex(null, $updateCategoryIds);
179
  }
180
-
181
- $process_products = Mage::getSingleton('index/indexer')->getProcessByCode('algolia_search_indexer');
182
- $process_products->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
183
  }
184
 
185
  /**
8
  private $engine;
9
  private $config;
10
 
 
11
  private static $credential_error = false;
12
 
13
  public function __construct()
176
  $this->engine
177
  ->rebuildCategoryIndex(null, $updateCategoryIds);
178
  }
 
 
 
179
  }
180
 
181
  /**
app/code/community/Algolia/Algoliasearch/Model/Observer.php CHANGED
@@ -39,9 +39,14 @@ class Algolia_Algoliasearch_Model_Observer
39
  */
40
  public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
41
  {
42
- if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled()) {
43
- $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
 
 
 
 
44
  }
 
45
  return $this;
46
  }
47
 
@@ -53,48 +58,6 @@ class Algolia_Algoliasearch_Model_Observer
53
  Algolia_Algoliasearch_Model_Indexer_Algolia::$product_categories[$product->getId()] = $product->getCategoryIds();
54
  }
55
 
56
- private function updateStock($product_id)
57
- {
58
- foreach (Mage::app()->getStores() as $storeId => $store)
59
- {
60
- if ( ! $store->getIsActive())
61
- continue;
62
-
63
- try
64
- {
65
- $this->helper->rebuildStoreProductIndex($storeId, array($product_id));
66
- }
67
- catch(\Exception $e)
68
- {
69
- Mage::log($e->getMessage());
70
- Mage::log($e->getTraceAsString());
71
- }
72
- }
73
- }
74
-
75
- public function catalogInventorySave(Varien_Event_Observer $observer)
76
- {
77
- $product = $observer->getItem();
78
-
79
- $this->updateStock($product->getProductId());
80
- }
81
-
82
- public function quoteInventory(Varien_Event_Observer $observer)
83
- {
84
- $quote = $observer->getEvent()->getQuote();
85
-
86
- foreach ($quote->getAllItems() as $product)
87
- $this->updateStock($product->getProductId());
88
- }
89
-
90
- public function refundOrderInventory(Varien_Event_Observer $observer)
91
- {
92
- $creditmemo = $observer->getEvent()->getCreditmemo();
93
-
94
- foreach ($creditmemo->getAllItems() as $product)
95
- $this->updateStock($product->getProductId());
96
- }
97
-
98
  public function deleteProductsStoreIndices(Varien_Object $event)
99
  {
100
  $storeId = $event->getStoreId();
39
  */
40
  public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
41
  {
42
+ if ($this->config->isEnabledFrontEnd())
43
+ {
44
+ if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled())
45
+ {
46
+ $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
47
+ }
48
  }
49
+
50
  return $this;
51
  }
52
 
58
  Algolia_Algoliasearch_Model_Indexer_Algolia::$product_categories[$product->getId()] = $product->getCategoryIds();
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  public function deleteProductsStoreIndices(Varien_Object $event)
62
  {
63
  $storeId = $event->getStoreId();
app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php CHANGED
@@ -5,7 +5,8 @@
5
  class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Model_Resource_Fulltext_Engine
6
  {
7
  const ONE_TIME_AMOUNT = 100;
8
- private $helper;
 
9
  private $queue;
10
  private $config;
11
  private $product_helper;
@@ -18,6 +19,7 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
18
 
19
  $this->queue = Mage::getSingleton('algoliasearch/queue');
20
  $this->config = Mage::helper('algoliasearch/config');
 
21
  $this->product_helper = Mage::helper('algoliasearch/entity_producthelper');
22
  $this->category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
23
  $this->suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
@@ -31,16 +33,6 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
31
  Mage::getSingleton($observer)->$method(new Varien_Object($data));
32
  }
33
 
34
- public function getAllowedVisibility()
35
- {
36
- return Mage::getSingleton('catalog/product_visibility')->getVisibleInSearchIds();
37
- }
38
-
39
- public function allowAdvancedIndex()
40
- {
41
- return FALSE;
42
- }
43
-
44
  public function removeProducts($storeId = null, $product_ids = null)
45
  {
46
  if (is_array($product_ids) == false)
@@ -94,17 +86,13 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
94
  public function rebuildPages()
95
  {
96
  foreach (Mage::app()->getStores() as $store)
97
- {
98
  $this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
99
- }
100
  }
101
 
102
  public function rebuildAdditionalSections()
103
  {
104
  foreach (Mage::app()->getStores() as $store)
105
- {
106
  $this->addToQueue('algoliasearch/observer', 'rebuildAdditionalSectionsIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
107
- }
108
  }
109
 
110
  public function rebuildSuggestions()
@@ -130,8 +118,6 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
130
 
131
  public function rebuildProducts()
132
  {
133
- Mage::getSingleton('algoliasearch/observer')->saveSettings();
134
-
135
  foreach (Mage::app()->getStores() as $store)
136
  {
137
  if ($store->getIsActive())
@@ -147,8 +133,6 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
147
 
148
  public function rebuildCategories()
149
  {
150
- Mage::getSingleton('algoliasearch/observer')->saveSettings();
151
-
152
  foreach (Mage::app()->getStores() as $store)
153
  {
154
  if ($store->getIsActive())
@@ -220,11 +204,15 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
220
  else
221
  $this->addToQueue('algoliasearch/observer', 'rebuildProductIndex', array('store_id' => $storeId, 'product_ids' => $productIds), $this->config->getQueueMaxRetries());
222
 
 
223
  return $this;
224
  }
225
 
226
  public function prepareEntityIndex($index, $separator = ' ')
227
  {
 
 
 
228
  foreach ($index as $key => $value) {
229
  if (is_array($value) && ! empty($value)) {
230
  $index[$key] = join($separator, array_unique(array_filter($value)));
@@ -239,9 +227,4 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
239
  {
240
  Mage::getSingleton('algoliasearch/observer')->saveSettings();
241
  }
242
-
243
- public function test()
244
- {
245
- return true;
246
- }
247
  }
5
  class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Model_Resource_Fulltext_Engine
6
  {
7
  const ONE_TIME_AMOUNT = 100;
8
+ /** @var Algolia_Algoliasearch_Helper_Logger */
9
+ private $logger;
10
  private $queue;
11
  private $config;
12
  private $product_helper;
19
 
20
  $this->queue = Mage::getSingleton('algoliasearch/queue');
21
  $this->config = Mage::helper('algoliasearch/config');
22
+ $this->logger = Mage::helper('algoliasearch/logger');
23
  $this->product_helper = Mage::helper('algoliasearch/entity_producthelper');
24
  $this->category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
25
  $this->suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
33
  Mage::getSingleton($observer)->$method(new Varien_Object($data));
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
36
  public function removeProducts($storeId = null, $product_ids = null)
37
  {
38
  if (is_array($product_ids) == false)
86
  public function rebuildPages()
87
  {
88
  foreach (Mage::app()->getStores() as $store)
 
89
  $this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
 
90
  }
91
 
92
  public function rebuildAdditionalSections()
93
  {
94
  foreach (Mage::app()->getStores() as $store)
 
95
  $this->addToQueue('algoliasearch/observer', 'rebuildAdditionalSectionsIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
 
96
  }
97
 
98
  public function rebuildSuggestions()
118
 
119
  public function rebuildProducts()
120
  {
 
 
121
  foreach (Mage::app()->getStores() as $store)
122
  {
123
  if ($store->getIsActive())
133
 
134
  public function rebuildCategories()
135
  {
 
 
136
  foreach (Mage::app()->getStores() as $store)
137
  {
138
  if ($store->getIsActive())
204
  else
205
  $this->addToQueue('algoliasearch/observer', 'rebuildProductIndex', array('store_id' => $storeId, 'product_ids' => $productIds), $this->config->getQueueMaxRetries());
206
 
207
+
208
  return $this;
209
  }
210
 
211
  public function prepareEntityIndex($index, $separator = ' ')
212
  {
213
+ if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false)
214
+ return parent::rebuildIndex($index, $separator);
215
+
216
  foreach ($index as $key => $value) {
217
  if (is_array($value) && ! empty($value)) {
218
  $index[$key] = join($separator, array_unique(array_filter($value)));
227
  {
228
  Mage::getSingleton('algoliasearch/observer')->saveSettings();
229
  }
 
 
 
 
 
230
  }
app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext.php CHANGED
@@ -8,30 +8,30 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
8
  private $engine;
9
  private $config;
10
 
 
 
 
11
  public function __construct()
12
  {
13
  parent::__construct();
14
  $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
15
  $this->config = Mage::helper('algoliasearch/config');
 
16
  }
17
 
18
  public function prepareResult($object, $queryText, $query)
19
  {
20
- return $this;
21
- }
22
 
23
- protected function _saveProductIndexes($storeId, $productIndexes)
24
- {
25
  return $this;
26
  }
27
 
28
- public function cleanEntityIndex($entity, $storeId = NULL, $entityId = NULL)
29
  {
30
- return $this;
31
- }
32
 
33
- public function rebuildCategoryIndex($storeId = NULL, $categoryIds = NULL)
34
- {
35
  return $this;
36
  }
37
 
@@ -40,6 +40,9 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
40
  */
41
  public function rebuildIndex($storeId = null, $productIds = null)
42
  {
 
 
 
43
  if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
44
  {
45
  Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
@@ -50,8 +53,6 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
50
  if (is_array($productIds) && $productIds > 0)
51
  return $this;
52
 
53
- $this->engine->saveSettings();
54
-
55
  if ($storeId == null)
56
  {
57
  foreach (Mage::app()->getStores() as $id => $store)
@@ -62,14 +63,4 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
62
 
63
  return $this;
64
  }
65
-
66
- public function rebuildProductIndex($storeId = NULL, $productIds = NULL)
67
- {
68
- return $this;
69
- }
70
-
71
- public function getAttributeValue($attributeCode, $value, $storeId, $entity = 'catalog_category')
72
- {
73
- return $value;
74
- }
75
  }
8
  private $engine;
9
  private $config;
10
 
11
+ /** @var Algolia_Algoliasearch_Helper_Logger */
12
+ private $logger;
13
+
14
  public function __construct()
15
  {
16
  parent::__construct();
17
  $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
18
  $this->config = Mage::helper('algoliasearch/config');
19
+ $this->logger = Mage::helper('algoliasearch/logger');
20
  }
21
 
22
  public function prepareResult($object, $queryText, $query)
23
  {
24
+ if ($this->config->isEnabledFrontEnd(Mage::app()->getStore()->getId()) === false)
25
+ return parent::prepareResult($object, $queryText, $query);
26
 
 
 
27
  return $this;
28
  }
29
 
30
+ protected function _saveProductIndexes($storeId, $productIndexes)
31
  {
32
+ if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false)
33
+ return parent::_saveProductIndexes($storeId, $productIndexes);
34
 
 
 
35
  return $this;
36
  }
37
 
40
  */
41
  public function rebuildIndex($storeId = null, $productIds = null)
42
  {
43
+ if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false)
44
+ return parent::rebuildIndex($storeId, $productIds);
45
+
46
  if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
47
  {
48
  Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
53
  if (is_array($productIds) && $productIds > 0)
54
  return $this;
55
 
 
 
56
  if ($storeId == null)
57
  {
58
  foreach (Mage::app()->getStores() as $id => $store)
63
 
64
  return $this;
65
  }
 
 
 
 
 
 
 
 
 
 
66
  }
app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext/Collection.php CHANGED
@@ -7,7 +7,20 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext_Collection extends Mage_Cata
7
  */
8
  public function addSearchFilter($query)
9
  {
10
- $data = Mage::helper('algoliasearch')->getSearchResult($query, Mage::app()->getStore()->getId());
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  $sortedIds = array_reverse(array_keys($data));
13
 
7
  */
8
  public function addSearchFilter($query)
9
  {
10
+ $storeId = Mage::app()->getStore()->getId();
11
+ $config = Mage::helper('algoliasearch/config');
12
+
13
+ if ($config->isEnabledFrontEnd($storeId) === false)
14
+ return parent::addSearchFilter($query);
15
+
16
+ $data = array();
17
+
18
+ if ($config->isInstantEnabled($storeId) === false || $config->makeSeoRequest($storeId))
19
+ {
20
+ $algolia_query = $query !== '__empty__' ? $query : '';
21
+ $data = Mage::helper('algoliasearch')->getSearchResult($algolia_query, $storeId);
22
+ }
23
+
24
 
25
  $sortedIds = array_reverse(array_keys($data));
26
 
app/code/community/Algolia/Algoliasearch/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Algolia_Algoliasearch>
5
- <version>0.1.0</version>
6
  </Algolia_Algoliasearch>
7
  </modules>
8
  <frontend>
@@ -81,47 +81,6 @@
81
  </algolia_stockupdate>
82
  </observers>
83
  </catalog_product_save_before>
84
-
85
- <cataloginventory_stock_item_save_commit_after>
86
- <observers>
87
- <algolia_stockupdate>
88
- <class>algoliasearch/observer</class>
89
- <method>catalogInventorySave</method>
90
- </algolia_stockupdate>
91
- </observers>
92
- </cataloginventory_stock_item_save_commit_after>
93
- <sales_model_service_quote_submit_before>
94
- <observers>
95
- <algolia_stockupdate>
96
- <class>algoliasearch/observer</class>
97
- <method>quoteInventory</method>
98
- </algolia_stockupdate>
99
- </observers>
100
- </sales_model_service_quote_submit_before>
101
- <sales_model_service_quote_submit_failure>
102
- <observers>
103
- <algolia_stockupdate>
104
- <class>algoliasearch/observer</class>
105
- <method>quoteInventory</method>
106
- </algolia_stockupdate>
107
- </observers>
108
- </sales_model_service_quote_submit_failure>
109
- <sales_order_item_cancel>
110
- <observers>
111
- <algolia_stockupdate>
112
- <class>algoliasearch/observer</class>
113
- <method>catalogInventorySave</method>
114
- </algolia_stockupdate>
115
- </observers>
116
- </sales_order_item_cancel>
117
- <sales_order_creditmemo_save_after>
118
- <observers>
119
- <algolia_stockupdate>
120
- <class>algoliasearch/observer</class>
121
- <method>refundOrderInventory</method>
122
- </algolia_stockupdate>
123
- </observers>
124
- </sales_order_creditmemo_save_after>
125
  </events>
126
  <resources>
127
  <algoliasearch_setup>
@@ -165,6 +124,8 @@
165
  <default>
166
  <algoliasearch>
167
  <credentials>
 
 
168
  <application_id></application_id>
169
  <search_only_api_key></search_only_api_key>
170
  <api_key></api_key>
@@ -216,6 +177,7 @@
216
  </queue>
217
  <advanced>
218
  <partial_update>0</partial_update>
 
219
  <remove_branding>0</remove_branding>
220
  </advanced>
221
  </algoliasearch>
2
  <config>
3
  <modules>
4
  <Algolia_Algoliasearch>
5
+ <version>1.4.7</version>
6
  </Algolia_Algoliasearch>
7
  </modules>
8
  <frontend>
81
  </algolia_stockupdate>
82
  </observers>
83
  </catalog_product_save_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  </events>
85
  <resources>
86
  <algoliasearch_setup>
124
  <default>
125
  <algoliasearch>
126
  <credentials>
127
+ <enable_frontend>1</enable_frontend>
128
+ <enable_backend>1</enable_backend>
129
  <application_id></application_id>
130
  <search_only_api_key></search_only_api_key>
131
  <api_key></api_key>
177
  </queue>
178
  <advanced>
179
  <partial_update>0</partial_update>
180
+ <make_seo_request>1</make_seo_request>
181
  <remove_branding>0</remove_branding>
182
  </advanced>
183
  </algoliasearch>
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.4.6
8
  <style>
9
  .algoliasearch-admin-menu span {
10
  padding-left: 38px !important;
@@ -42,6 +42,35 @@
42
  ]]>
43
  </comment>
44
  <fields>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  <application_id translate="label">
46
  <label>Application ID</label>
47
  <frontend_type>text</frontend_type>
@@ -580,11 +609,21 @@
580
  ]]>
581
  </comment>
582
  </customer_groups_enable>
 
 
 
 
 
 
 
 
 
 
583
  <remove_branding translate="label comment">
584
  <label>Remove branding logo</label>
585
  <frontend_type>select</frontend_type>
586
  <source_model>adminhtml/system_config_source_yesno</source_model>
587
- <sort_order>30</sort_order>
588
  <show_in_default>1</show_in_default>
589
  <show_in_website>1</show_in_website>
590
  <show_in_store>1</show_in_store>
4
  <algoliasearch translate="label" module="algoliasearch">
5
  <label>
6
  <![CDATA[
7
+ Algolia Search 1.4.7
8
  <style>
9
  .algoliasearch-admin-menu span {
10
  padding-left: 38px !important;
42
  ]]>
43
  </comment>
44
  <fields>
45
+ <enable_backend translate="label comment">
46
+ <label>Enable Indexing</label>
47
+ <frontend_type>select</frontend_type>
48
+ <source_model>adminhtml/system_config_source_yesno</source_model>
49
+ <sort_order>0</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ <comment>
54
+ <![CDATA[
55
+ If set to No, Algolia extension will be simply disabled.
56
+ ]]>
57
+ </comment>
58
+ </enable_backend>
59
+ <enable_frontend translate="label comment">
60
+ <label>Enable Search</label>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ <sort_order>0</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
+ <depends><enable_backend>1</enable_backend></depends>
68
+ <comment>
69
+ <![CDATA[
70
+ If set to No, search will be done by Magento but indexing will be done by Algolia
71
+ ]]>
72
+ </comment>
73
+ </enable_frontend>
74
  <application_id translate="label">
75
  <label>Application ID</label>
76
  <frontend_type>text</frontend_type>
609
  ]]>
610
  </comment>
611
  </customer_groups_enable>
612
+ <make_seo_request translate="label comment">
613
+ <label>Make SEO request</label>
614
+ <frontend_type>select</frontend_type>
615
+ <source_model>adminhtml/system_config_source_yesno</source_model>
616
+ <sort_order>30</sort_order>
617
+ <show_in_default>1</show_in_default>
618
+ <show_in_website>1</show_in_website>
619
+ <show_in_store>1</show_in_store>
620
+ <comment>Choose if an query to Algolia is done by the backend for seo when instant search is enable</comment>
621
+ </make_seo_request>
622
  <remove_branding translate="label comment">
623
  <label>Remove branding logo</label>
624
  <frontend_type>select</frontend_type>
625
  <source_model>adminhtml/system_config_source_yesno</source_model>
626
+ <sort_order>40</sort_order>
627
  <show_in_default>1</show_in_default>
628
  <show_in_website>1</show_in_website>
629
  <show_in_store>1</show_in_store>
app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-0.1.0-1.4.7.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this; /** @var $installer Mage_Core_Model_Resource_Setup */
4
+
5
+ $installer->startSetup();
6
+
7
+ $table = Mage::getConfig()->getTablePrefix().'sales_flat_order_item';
8
+ $installer->run("ALTER TABLE `{$table}` ADD INDEX `IDX_ALGOLIA_SALES_FLAT_ORDER_ITEM_PRODUCT_ID` (`product_id`);");
9
+
10
+ $table = Mage::getConfig()->getTablePrefix().'review_entity_summary';
11
+ $installer->run("ALTER TABLE `{$table}` ADD INDEX `IDX_ALGOLIA_REVIEW_ENTITY_SUMMARY_ENTITY_PK_VALUE_STORE_ID` (`store_id`, `entity_pk_value`);");
12
+
13
+ $installer->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>algoliasearch</name>
4
- <version>1.4.6</version>
5
  <stability>stable</stability>
6
  <license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
7
  <channel>community</channel>
@@ -11,14 +11,18 @@
11
  &#xD;
12
  This extension replaces Magento's FullText Search module and provide an as-you-type auto-completion menu in your searchbar.&#xD;
13
  </description>
14
- <notes>- UPDATED: Price handling, no template update required anymore + correct handling of special price + correct handling of tax&#xD;
15
- - UPDATED: indexing process has been optimized&#xD;
16
- - FIX: add emulation for pages to have correct urls&#xD;
17
- - UPDATED: Separate category and product indexer</notes>
 
 
 
 
18
  <authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
19
- <date>2015-09-25</date>
20
- <time>15:08:07</time>
21
- <contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="17a1452f533423291332642969b41a53"/></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="Additionalsections.php" hash="b2514910e3b56745e66239d5ee916331"/><file name="Custompages.php" hash="f87a9cf7b5559717cd9d6570374dcda7"/><file name="Customrankingcategory.php" hash="6d9575c12dbaecf9054de1cf12736025"/><file name="Customrankingproduct.php" hash="6d1b145e37c4f22d5b56f5783ac47511"/><file name="Customsortorder.php" hash="786c8f8fca2e4b41b8732f5fe270491b"/><file name="Customsortordercategory.php" hash="9908ea7f463138d3047c51b98591db9c"/><file name="Customsortorderproduct.php" hash="ee62901a3911bb7784467e1ca5cd8e84"/><file name="Facets.php" hash="097998767edeee986958f421979ea141"/><file name="Select.php" hash="6e3cb4c1798775048bebbdc878e90aa9"/><file name="Sorts.php" hash="fede73c4ecbe39bf0344fbf6de46ed95"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="ff48a4929fffd913da57868457ace02f"/><file name="Config.php" hash="fd857266017bf9cad31542b97946a44f"/><file name="Data.php" hash="5e40a0798f9b7daba8890b231e3148d7"/><dir name="Entity"><file name="Additionalsectionshelper.php" hash="5d20d805b31b7dec4feb943c5e6a96ef"/><file name="Categoryhelper.php" hash="0ec97836a0c1de3e3e22ce462fc756c7"/><file name="Helper.php" hash="e27363827198000e822e14c83e56145e"/><file name="Pagehelper.php" hash="7a0dcb237f6720d1637c48fc05a7d45e"/><file name="Producthelper.php" hash="e7164205971f5468abe8e6ac32b92c6f"/><file name="Suggestionhelper.php" hash="52f709b27a94c66aa9f7af8648dcb30a"/></dir></dir><dir name="Model"><dir name="Indexer"><file name="Algolia.php" hash="a3d5fae92e3fccdee6e50e9a45abe06b"/><file name="Algoliaadditionalsections.php" hash="3113413441afccba3b8e79aa9fd8cdb1"/><file name="Algoliacategories.php" hash="ec552d5cd1492a8d5850b41d2f478a9e"/><file name="Algoliapages.php" hash="26ea3afee58d07b721c5cd74b3d6c4e3"/><file name="Algoliasuggestions.php" hash="7020d40bae60469d0acc7138ee72a419"/></dir><file name="Observer.php" hash="c8cda0056667c096eb1bb1eb2ad38ca9"/><file name="Queue.php" hash="4e0c7559dd15b4cbd75cf41ab90f5bdf"/><dir name="Resource"><file name="Engine.php" hash="ce90cd668327514b77aaea876e18ca99"/><dir name="Fulltext"><file name="Collection.php" hash="66e8b9af58384bc3a99ee1464cbd3537"/></dir><file name="Fulltext.php" hash="64e54ab51992d455cce9f266db5b8802"/></dir><dir name="System"><file name="Removewords.php" hash="69c9727a324b657f7cfdf7f5d06e3cbc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ea4176ed43885e531f90d1f5369f29ee"/><file name="config.xml" hash="72f70288cf5ad61d42a5c9fa7592510e"/><file name="system.xml" hash="154c0c2147174b3180fbc2cc9f787deb"/></dir><dir name="sql"><dir name="algoliasearch_setup"><file name="mysql4-install-0.1.0.php" hash="fffd964f9c60be7909ec216260c37ba0"/></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="f0df0b6ed09d186da4429577aefd346d"/></dir><dir name="template"><dir name="algoliasearch"><file name="topsearch.phtml" hash="4036781635e58d71b8ac242214d067ff"/></dir></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.png" hash="9202a559c30a43d4d4bbc2f9ee774fd9"/><file name="algolia-logo.png" hash="190884b3e8652f3517754ae15bca31de"/><file name="algoliasearch.css" hash="1b85791da996184de93f54e54feca9c3"/><file name="bundle.css" hash="10df17cf0f50b56246a2ba017adcdae3"/><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></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="algoliasearch"><file name="bundle.min.js" hash="50dc171cb2cbd89fda2a18a4b64e6e4c"/></dir></dir><dir name="lib"><dir name="AlgoliaSearch"><file name="AlgoliaException.php" hash="4acaa7c9142e19d1084295a3b8ba18e2"/><file name="Client.php" hash="11ad687a9868a9f574ae6a069800dd2c"/><file name="ClientContext.php" hash="77d2449636d263162460a7ccaea4e6b6"/><file name="Index.php" hash="5c1eacc54cd503bff296e9bbbd402895"/><file name="Version.php" hash="0c37eb6324361991364e0efd2696e56d"/><dir name="resources"><file name="ca-bundle.crt" hash="47961e7ef15667c93cd99be01b51f00a"/></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>algoliasearch</name>
4
+ <version>1.4.7</version>
5
  <stability>stable</stability>
6
  <license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
7
  <channel>community</channel>
11
  &#xD;
12
  This extension replaces Magento's FullText Search module and provide an as-you-type auto-completion menu in your searchbar.&#xD;
13
  </description>
14
+ <notes>- NEW: added an option to disable the seo request&#xD;
15
+ - NEW: added ability to disable (search OR search + indexing) per store&#xD;
16
+ - NEW: added logging&#xD;
17
+ - UPDATED: improve handling of out of stock products&#xD;
18
+ - UPDATED: improve performance overall indexing performance&#xD;
19
+ - FIX: issue with category ids&#xD;
20
+ - FIX: issue with configurable product additionnal attributes&#xD;
21
+ - FIX: corner case for price with visibility and stock options</notes>
22
  <authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
23
+ <date>2015-10-07</date>
24
+ <time>14:12:40</time>
25
+ <contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="17a1452f533423291332642969b41a53"/></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="Additionalsections.php" hash="696703aeb119749f661201d292bbf922"/><file name="Custompages.php" hash="f87a9cf7b5559717cd9d6570374dcda7"/><file name="Customrankingcategory.php" hash="6d9575c12dbaecf9054de1cf12736025"/><file name="Customrankingproduct.php" hash="6d1b145e37c4f22d5b56f5783ac47511"/><file name="Customsortorder.php" hash="786c8f8fca2e4b41b8732f5fe270491b"/><file name="Customsortordercategory.php" hash="9908ea7f463138d3047c51b98591db9c"/><file name="Customsortorderproduct.php" hash="ee62901a3911bb7784467e1ca5cd8e84"/><file name="Facets.php" hash="097998767edeee986958f421979ea141"/><file name="Select.php" hash="6e3cb4c1798775048bebbdc878e90aa9"/><file name="Sorts.php" hash="fede73c4ecbe39bf0344fbf6de46ed95"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="ff48a4929fffd913da57868457ace02f"/><file name="Config.php" hash="4a59188677cb6a8fe77231a841c4f643"/><file name="Data.php" hash="50301b0681f4bdfae9e5b25450779284"/><dir name="Entity"><file name="Additionalsectionshelper.php" hash="5d20d805b31b7dec4feb943c5e6a96ef"/><file name="Categoryhelper.php" hash="8a3caaa6a8e988d1ffd8c11486944535"/><file name="Helper.php" hash="3dcb9e3edd8c82896074ff625e932567"/><file name="Pagehelper.php" hash="7a0dcb237f6720d1637c48fc05a7d45e"/><file name="Producthelper.php" hash="82db601c05bea3205751ed2351eab0cf"/><file name="Suggestionhelper.php" hash="52f709b27a94c66aa9f7af8648dcb30a"/></dir><file name="Logger.php" hash="fede0bd23b1beff2520d361293217834"/></dir><dir name="Model"><dir name="Indexer"><file name="Algolia.php" hash="e5ab21e69fb6dd8ea10a5e2ed2ae36c7"/><file name="Algoliaadditionalsections.php" hash="3113413441afccba3b8e79aa9fd8cdb1"/><file name="Algoliacategories.php" hash="fbeb6fde82dd44ecd1b098db7676152e"/><file name="Algoliapages.php" hash="26ea3afee58d07b721c5cd74b3d6c4e3"/><file name="Algoliasuggestions.php" hash="7020d40bae60469d0acc7138ee72a419"/></dir><file name="Observer.php" hash="7f6dc79b711e09d1e36465dc91d22191"/><file name="Queue.php" hash="4e0c7559dd15b4cbd75cf41ab90f5bdf"/><dir name="Resource"><file name="Engine.php" hash="f565e42316306a175283230ab40a182f"/><dir name="Fulltext"><file name="Collection.php" hash="849c1a8fd656150fb97d89346ac62c68"/></dir><file name="Fulltext.php" hash="e30d5d08ea1dce98248d3a8b5a4e8955"/></dir><dir name="System"><file name="Removewords.php" hash="69c9727a324b657f7cfdf7f5d06e3cbc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ea4176ed43885e531f90d1f5369f29ee"/><file name="config.xml" hash="b6cca662e37ce383826d072b869d5efc"/><file name="system.xml" hash="6364c2448cbb999eba4dda7a42ede886"/></dir><dir name="sql"><dir name="algoliasearch_setup"><file name="mysql4-install-0.1.0.php" hash="fffd964f9c60be7909ec216260c37ba0"/><file name="mysql4-upgrade-0.1.0-1.4.7.php" hash="5224f8f1031a0659c64d393392a7f199"/></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="f0df0b6ed09d186da4429577aefd346d"/></dir><dir name="template"><dir name="algoliasearch"><file name="topsearch.phtml" hash="4036781635e58d71b8ac242214d067ff"/></dir></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.png" hash="9202a559c30a43d4d4bbc2f9ee774fd9"/><file name="algolia-logo.png" hash="190884b3e8652f3517754ae15bca31de"/><file name="algoliasearch.css" hash="1b85791da996184de93f54e54feca9c3"/><file name="bundle.css" hash="10df17cf0f50b56246a2ba017adcdae3"/><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></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="algoliasearch"><file name="bundle.min.js" hash="50dc171cb2cbd89fda2a18a4b64e6e4c"/></dir></dir><dir name="lib"><dir name="AlgoliaSearch"><file name="AlgoliaException.php" hash="4acaa7c9142e19d1084295a3b8ba18e2"/><file name="Client.php" hash="11ad687a9868a9f574ae6a069800dd2c"/><file name="ClientContext.php" hash="77d2449636d263162460a7ccaea4e6b6"/><file name="Index.php" hash="5c1eacc54cd503bff296e9bbbd402895"/><file name="Version.php" hash="0c37eb6324361991364e0efd2696e56d"/><dir name="resources"><file name="ca-bundle.crt" hash="47961e7ef15667c93cd99be01b51f00a"/></dir></dir></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
28
  </package>