@@ -28,16 +28,19 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
2828 const EXCLUDED_PAGES = 'algoliasearch/autocomplete/excluded_pages ' ;
2929 const MIN_POPULARITY = 'algoliasearch/autocomplete/min_popularity ' ;
3030 const MIN_NUMBER_OF_RESULTS = 'algoliasearch/autocomplete/min_number_of_results ' ;
31+ const RENDER_TEMPLATE_DIRECTIVES = 'algoliasearch/autocomplete/render_template_directives ' ;
3132
3233 const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results ' ;
3334 const PRODUCT_ATTRIBUTES = 'algoliasearch/products/product_additional_attributes ' ;
3435 const PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes ' ;
3536 const RESULTS_LIMIT = 'algoliasearch/products/results_limit ' ;
3637 const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch/products/show_suggestions_on_no_result_page ' ;
38+ const INDEX_OUT_OF_STOCK_OPTIONS = 'algoliasearch/products/index_out_of_stock_options ' ;
3739
3840 const CATEGORY_ATTRIBUTES = 'algoliasearch/categories/category_additional_attributes2 ' ;
3941 const INDEX_PRODUCT_COUNT = 'algoliasearch/categories/index_product_count ' ;
4042 const CATEGORY_CUSTOM_RANKING = 'algoliasearch/categories/custom_ranking_category_attributes ' ;
43+ const SHOW_CATS_NOT_INCLUDED_IN_NAVIGATION = 'algoliasearch/categories/show_cats_not_included_in_navigation ' ;
4144
4245
4346 const IS_ACTIVE = 'algoliasearch/queue/active ' ;
@@ -60,6 +63,16 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
6063
6164 protected $ _productTypeMap = array ();
6265
66+ public function indexOutOfStockOptions ($ storeId = null )
67+ {
68+ return Mage::getStoreConfigFlag (self ::INDEX_OUT_OF_STOCK_OPTIONS , $ storeId );
69+ }
70+
71+ public function showCatsNotIncludedInNavigation ($ storeId = null )
72+ {
73+ return Mage::getStoreConfigFlag (self ::SHOW_CATS_NOT_INCLUDED_IN_NAVIGATION , $ storeId );
74+ }
75+
6376 public function isDefaultSelector ($ storeId = null )
6477 {
6578 return '.algolia-search-input ' === $ this ->getAutocompleteSelector ($ storeId );
@@ -259,6 +272,11 @@ public function getExcludedPages($storeId = NULL)
259272 return array ();
260273 }
261274
275+ public function getRenderTemplateDirectives ($ storeId = NULL )
276+ {
277+ return Mage::getStoreConfigFlag (self ::RENDER_TEMPLATE_DIRECTIVES , $ storeId );
278+ }
279+
262280 public function getSortingIndices ($ storeId = NULL )
263281 {
264282 $ product_helper = Mage::helper ('algoliasearch/entity_producthelper ' );
@@ -297,22 +315,52 @@ public function getSortingIndices($storeId = NULL)
297315
298316 public function getApplicationID ($ storeId = NULL )
299317 {
300- return Mage::getStoreConfig (self ::APPLICATION_ID , $ storeId );
318+ return trim ( Mage::getStoreConfig (self ::APPLICATION_ID , $ storeId) );
301319 }
302320
303321 public function getAPIKey ($ storeId = NULL )
304322 {
305- return Mage::getStoreConfig (self ::API_KEY , $ storeId );
323+ return trim ( Mage::getStoreConfig (self ::API_KEY , $ storeId) );
306324 }
307325
308326 public function getSearchOnlyAPIKey ($ storeId = NULL )
309327 {
310- return Mage::getStoreConfig (self ::SEARCH_ONLY_API_KEY , $ storeId );
328+ return trim ( Mage::getStoreConfig (self ::SEARCH_ONLY_API_KEY , $ storeId) );
311329 }
312330
313331 public function getIndexPrefix ($ storeId = NULL )
314332 {
315- return Mage::getStoreConfig (self ::INDEX_PREFIX , $ storeId );
333+ return trim (Mage::getStoreConfig (self ::INDEX_PREFIX , $ storeId ));
334+ }
335+
336+ public function getAttributesToRetrieve ($ group_id )
337+ {
338+ if (false === $ this ->isCustomerGroupsEnabled ()) {
339+ return [];
340+ }
341+
342+ $ attributes = array ();
343+ foreach ($ this ->getProductAdditionalAttributes () as $ attribute ) {
344+ if ($ attribute ['attribute ' ] !== 'price ' ) {
345+ $ attributes [] = $ attribute ['attribute ' ];
346+ }
347+ }
348+
349+ $ attributes = array_merge ($ attributes , ['objectID ' , 'name ' , 'url ' , 'visibility_search ' , 'visibility_catalog ' , 'categories ' , 'categories_without_path ' , 'thumbnail_url ' , 'image_url ' , 'in_stock ' , 'type_id ' ]);
350+
351+ $ currencies = Mage::getModel ('directory/currency ' )->getConfigAllowCurrencies ();
352+
353+ foreach ($ currencies as $ currency ) {
354+ $ attributes [] = 'price. ' .$ currency .'.default ' ;
355+ $ attributes [] = 'price. ' .$ currency .'.default_formated ' ;
356+ $ attributes [] = 'price. ' .$ currency .'.group_ ' .$ group_id ;
357+ $ attributes [] = 'price. ' .$ currency .'.group_ ' .$ group_id .'_formated ' ;
358+ $ attributes [] = 'price. ' .$ currency .'.special_from_date ' ;
359+ $ attributes [] = 'price. ' .$ currency .'.special_to_date ' ;
360+ }
361+
362+
363+ return ['attributesToRetrieve ' => $ attributes ];
316364 }
317365
318366 public function getCategoryAdditionalAttributes ($ storeId = NULL )
0 commit comments