Skip to content

Commit

Permalink
Merge pull request #627 from algolia/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Jan Petr authored Oct 21, 2016
2 parents cff6d98 + ff009f2 commit 4a033e1
Show file tree
Hide file tree
Showing 30 changed files with 592 additions and 513 deletions.
7 changes: 6 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
preset: PSR2

linting: true

enabled:
- long_array_syntax

finder:
path:
- "code"
- "app/code"
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
## Change Log

### 1.7.1

#### FEATURES
- Option to stop the extension from overriding synonyms (#580)
- New attribute `main_categories` which contains product's category structure without path (#581)
- Option to index only categories where product actually is without it's parent categories (#584)
- **Breaks hierarchical widget, use wisely**
- Option to display popular queries (suggestions) without categories (#586)
- Option to reindex all category's products on category save (#598)
- Option to use non-selectable attribute as custom ranking by writing it's name in configuration (#603)
- Added categories' level attributes to Products' Attributes select boxes so it's possible to use specific levels for relevancy purposes (#621)

#### UPDATES
- Improved relevancy for suggestions by setting [removeWordsIfNoResults](https://www.algolia.com/doc/api-client/php/parameters#removewordsifnoresults) to `lastWords` (#575)
- All CSS selectors were prefixed with Algolia containers and unused styles were removed (#578)
- **BC break** - please check the look & feel of your results
- The note about new version is less agressive and does not feel as error anymore (#579)
- Bundled products now does not take news dates and special price dates from it's sub-products (#580)
- New versions of [instantsearch.js](https://github.com/algolia/instantsearch.js) and [autocomplete.js](https://github.com/algolia/autocomplete.js) libraries (#588)
- Column `data` in `algoliasearch_queue` table changed to LONGTEXT (#596, #597)
- Optimized number of products processed by removing duplicate products from processing (#599)
- Enable to select `in_stock` attribute as attribute for faceting (#602)
- Updated PHP client (#611)
- Updated "Disable extension" label (#619)
- Searchable attributes are set as Unordered by default (#624)

#### FIXES
- Info panel with sorting selectbox is now hidden on no results (#576)
- Issue with decimal numbers displayed in current price refinements (#588)
- PHP 5.3 compatibility (#605, #608)
- Displaying all products by clearing all filters by clearAll instantsearch.js widget on instant search category page (#604, #609)
- Fixed bug when `categories_without_path` was always set as searchable attribute (#621)

### 1.7.0

#### FEATURES
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This extension replaces the default search of Magento with a typo-tolerant, fast

See features and benefits of [Algolia Search Extension for Magento](https://community.algolia.com/magento).

![Latest version](https://img.shields.io/badge/latest-1.7.0-green.svg)
![Latest version](https://img.shields.io/badge/latest-1.7.1-green.svg)
![Magento 1.6.2](https://img.shields.io/badge/magento-1.6.2-blue.svg)
![Magento 1.7.1](https://img.shields.io/badge/magento-1.7.1-blue.svg)
![Magento 1.8.1](https://img.shields.io/badge/magento-1.8.1-blue.svg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function __construct()
'order' => array(
'label' => 'Ordered',
'options' => array(
'ordered' => 'Ordered',
'unordered' => 'Unordered',
'ordered' => 'Ordered',
),
'rowMethod' => 'getOrder',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ public function __construct()
$options[$attribute['attribute']] = $attribute['attribute'];
}

$options['custom_attribute'] = '[use custom attribute]';

return $options;
},
'rowMethod' => 'getAttribute',
'width' => 150,
),
'custom_attribute' => array(
'label' => 'Custom attribute',
'style' => 'width: 120px;',
),
'order' => array(
'label' => 'Asc / Desc',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ public function __construct()
$options[$attribute['attribute']] = $attribute['attribute'];
}

$options['custom_attribute'] = '[use custom attribute]';

return $options;
},
'rowMethod' => 'getAttribute',
'width' => 150,
),
'custom_attribute' => array(
'label' => 'Custom attribute',
'style' => 'width: 120px;',
),
'order' => array(
'label' => 'Asc / Desc',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ public function __construct()
'order' => array(
'label' => 'Ordered',
'options' => array(
'ordered' => 'Ordered',
'unordered' => 'Unordered',
'ordered' => 'Ordered',
),
'rowMethod' => 'getOrder',
),
'index_no_value' => [
'index_no_value' => array(
'label' => 'Index empty value',
'options' => [
'options' => array(
'1' => 'Yes',
'0' => 'No',
],
),
'rowMethod' => 'getIndexNoValue',
],
),
),
'buttonLabel' => 'Add Attribute',
'addAfter' => false,
Expand Down
59 changes: 44 additions & 15 deletions app/code/community/Algolia/Algoliasearch/Helper/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
const EXCLUDED_PAGES = 'algoliasearch/autocomplete/excluded_pages';
const MIN_POPULARITY = 'algoliasearch/autocomplete/min_popularity';
const MIN_NUMBER_OF_RESULTS = 'algoliasearch/autocomplete/min_number_of_results';
const DISPLAY_SUGGESTIONS_CATEGORIES = 'algoliasearch/autocomplete/display_categories_with_suggestions';
const RENDER_TEMPLATE_DIRECTIVES = 'algoliasearch/autocomplete/render_template_directives';

const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results';
Expand All @@ -36,6 +37,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
const RESULTS_LIMIT = 'algoliasearch/products/results_limit';
const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch/products/show_suggestions_on_no_result_page';
const INDEX_OUT_OF_STOCK_OPTIONS = 'algoliasearch/products/index_out_of_stock_options';
const INDEX_WHOLE_CATEGORY_TREE = 'algoliasearch/products/index_whole_category_tree';

const CATEGORY_ATTRIBUTES = 'algoliasearch/categories/category_additional_attributes2';
const INDEX_PRODUCT_COUNT = 'algoliasearch/categories/index_product_count';
Expand All @@ -50,6 +52,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
const XML_PATH_IMAGE_HEIGHT = 'algoliasearch/image/height';
const XML_PATH_IMAGE_TYPE = 'algoliasearch/image/type';

const ENABLE_SYNONYMS = 'algoliasearch/synonyms/enable_synonyms';
const SYNONYMS = 'algoliasearch/synonyms/synonyms';
const ONEWAY_SYNONYMS = 'algoliasearch/synonyms/oneway_synonyms';
const SYNONYMS_FILE = 'algoliasearch/synonyms/synonyms_file';
Expand All @@ -61,6 +64,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
const REMOVE_BRANDING = 'algoliasearch/advanced/remove_branding';
const AUTOCOMPLETE_SELECTOR = 'algoliasearch/advanced/autocomplete_selector';
const INDEX_PRODUCT_ON_CATEGORY_PRODUCTS_UPDATE = 'algoliasearch/advanced/index_product_on_category_products_update';
const INDEX_ALL_CATEGORY_PRODUCTS_ON_CATEGORY_UPDATE = 'algoliasearch/advanced/index_all_category_product_on_category_update';

const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
const LOGGING_ENABLED = 'algoliasearch/credentials/debug';
Expand All @@ -72,6 +76,11 @@ public function indexOutOfStockOptions($storeId = null)
return Mage::getStoreConfigFlag(self::INDEX_OUT_OF_STOCK_OPTIONS, $storeId);
}

public function indexWholeCategoryTree($storeId = null)
{
return Mage::getStoreConfigFlag(self::INDEX_WHOLE_CATEGORY_TREE, $storeId);
}

public function showCatsNotIncludedInNavigation($storeId = null)
{
return Mage::getStoreConfigFlag(self::SHOW_CATS_NOT_INCLUDED_IN_NAVIGATION, $storeId);
Expand All @@ -92,6 +101,11 @@ public function indexProductOnCategoryProductsUpdate($storeId = null)
return Mage::getStoreConfigFlag(self::INDEX_PRODUCT_ON_CATEGORY_PRODUCTS_UPDATE, $storeId);
}

public function indexAllCategoryProductsOnCategoryUpdate($storeId = null)
{
return Mage::getStoreConfigFlag(self::INDEX_ALL_CATEGORY_PRODUCTS_ON_CATEGORY_UPDATE, $storeId);
}

public function getNumberOfQueriesSuggestions($storeId = null)
{
return Mage::getStoreConfig(self::NB_OF_QUERIES_SUGGESTIONS, $storeId);
Expand All @@ -112,6 +126,11 @@ public function showSuggestionsOnNoResultsPage($storeId = null)
return Mage::getStoreConfigFlag(self::SHOW_SUGGESTIONS_NO_RESULTS, $storeId);
}

public function displaySuggestionsCategories($storeId = null)
{
return Mage::getStoreConfigFlag(self::DISPLAY_SUGGESTIONS_CATEGORIES, $storeId);
}

public function isEnabledFrontEnd($storeId = null)
{
// Frontend = Backend + Frontent
Expand Down Expand Up @@ -387,7 +406,7 @@ public function getAttributesToRetrieve($group_id)
$attributes[] = 'price.'.$currency.'.special_to_date';
}

return array('attributesToRetrieve' => $attributes);
return $attributes;
}

public function getCategoryAdditionalAttributes($storeId = null)
Expand Down Expand Up @@ -446,24 +465,12 @@ public function getFacets($storeId = null)

public function getCategoryCustomRanking($storeId = null)
{
$attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_CUSTOM_RANKING, $storeId));

if (is_array($attrs)) {
return $attrs;
}

return array();
return $this->getCustomRanking(self::CATEGORY_CUSTOM_RANKING, $storeId);
}

public function getProductCustomRanking($storeId = null)
{
$attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_CUSTOM_RANKING, $storeId));

if (is_array($attrs)) {
return $attrs;
}

return array();
return $this->getCustomRanking(self::PRODUCT_CUSTOM_RANKING, $storeId);
}

public function getCurrency($storeId = null)
Expand Down Expand Up @@ -514,6 +521,11 @@ public function getExtensionVersion()
return (string) Mage::getConfig()->getNode()->modules->Algolia_Algoliasearch->version;
}

public function isEnabledSynonyms($storeId = null)
{
return Mage::getStoreConfigFlag(self::ENABLE_SYNONYMS, $storeId);
}

public function getSynonyms($storeId = null)
{
$synonyms = unserialize(Mage::getStoreConfig(self::SYNONYMS, $storeId));
Expand Down Expand Up @@ -545,4 +557,21 @@ public function getSynonymsFile($storeId = null)

return Mage::getBaseDir('media').'/algoliasearch-admin-config-uploads/'.$filename;
}

private function getCustomRanking($configName, $storeId = null)
{
$attrs = unserialize(Mage::getStoreConfig($configName, $storeId));

if (is_array($attrs)) {
foreach ($attrs as $index => $attr) {
if ($attr['attribute'] == 'custom_attribute') {
$attrs[$index]['attribute'] = $attr['custom_attribute'];
}
}

return $attrs;
}

return array();
}
}
Loading

0 comments on commit 4a033e1

Please sign in to comment.