Skip to content

Commit 7e88ddd

Browse files
author
Jan Petr
authored
Merge pull request #474 from algolia/develop
1.6.0
2 parents eff4cb0 + 7076bf3 commit 7e88ddd

File tree

122 files changed

+5819
-3632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+5819
-3632
lines changed

.php_cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder\DefaultFinder::create()
4+
->in(__DIR__.DIRECTORY_SEPARATOR.'code');
5+
6+
return Symfony\CS\Config\Config::create()
7+
->setUsingCache(true)
8+
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
9+
->fixers([
10+
'align_double_arrow',
11+
'short_array_syntax',
12+
'-multiline_array_trailing_comma',
13+
'-pre_increment'
14+
])->finder($finder);

.styleci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
preset: PSR2
2+
linting: true
3+
finder:
4+
path:
5+
- "code"

Algolia_Algoliasearch.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Algolia_Algoliasearch>
55
<active>true</active>
66
<codePool>community</codePool>
7-
<version>1.5.5</version>
7+
<version>1.6.0</version>
88
</Algolia_Algoliasearch>
99
</modules>
1010
</config>

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
## Change Log
22

3+
### 1.6.0
4+
5+
#### NEW FEATURES
6+
- Support of synonyms API
7+
- Facets can be chosen from all attributes now
8+
- Added option to remove products from Algolia index when performing full re-index. By default the feature is disabled.
9+
- Added warning if you use old version of the extension
10+
- *Index settings* are set to products' indices on full products re-index
11+
- Code now follows PSR2 standarts, annotations were added to most unresolveable variables
12+
- Added option to index products when they are added/removed to/from category via "Manage category". By default the feature is enabled.
13+
- **BC break** - it may cause difficulties on large stores. If it does so, please disable the feature in Configuration.
14+
- Added locale CSV file for easier translations
15+
16+
17+
#### UPDATES
18+
- Frontend templates completely refactored
19+
- topsearch.phtml file was divided into 2 separate files - autocomplete.phtml and instantsearch.phtml
20+
- internal JS code and template files were moved to separate `internals` folder
21+
- names were assigned to templates blocks
22+
- Parts of JS code are commented with links to it's documentation
23+
- **BC break** - if you use you own templates, they must be updated for new templates' structure
24+
- New version of [instantsearch.js](https://github.com/algolia/instantsearch.js) library updated
25+
- Refactored [products' re-indexing](https://community.algolia.com/magento/documentation/#full-products-reindex)
26+
- Added logging of updated/deleted products
27+
- `name` and `description` attributes are now not casted before indexing. It solves issue with non-highlighted numerical products' names.
28+
- All static strings can be localized via Magento localizator now
29+
- All absolute skin URLs were replaces by Magento's built in `getSkinUrl` method
30+
- Small usability improvements
31+
- Upgrade the underlying PHP API client to 1.10.0
32+
- Updated [documentation](https://community.algolia.com/magento/documentation/)
33+
34+
#### FIXES
35+
- All images are now indexed with its base folder path. It fixes the issue with placeholder images and CDNs.
36+
- **BC break** - it's mandatory to reindex your products to index correct images paths of products
37+
- Backbutton on instant-search page now respects the query and refinements
38+
- Fixed issue when the warning about skipped/truncated products was not displayed sometimes
39+
- Categories on the bottom of auto-complete menu are not displayed when instantsearch is disabled because of wrong links
40+
- SKU of simple products is indexed correctly now
41+
- Count of products in category is now indexed correctly
42+
- XSS in auto-complete menu
43+
- Pages from different stores are not displayed in auto-complete menu anymore
44+
- Undefined `algoliaConfig` variable in IE9
45+
- Main content is no longer hidden on disabled JavaScript
46+
- Fix not started instant search which caused bugs on products' details
47+
348
### 1.5.5
449

550
- NEW: Add an option to include data from out-of-stock sub products

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ This extension replaces the default search of Magento with a typo-tolerant, fast
77

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

10-
![Latest version](https://img.shields.io/badge/latest-1.5.5-green.svg)
10+
![Latest version](https://img.shields.io/badge/latest-1.6.0-green.svg)
1111
![Magento 1.6.2](https://img.shields.io/badge/magento-1.6.2-blue.svg)
1212
![Magento 1.7.1](https://img.shields.io/badge/magento-1.7.1-blue.svg)
1313
![Magento 1.8.1](https://img.shields.io/badge/magento-1.8.1-blue.svg)
1414
![Magento 1.9.2](https://img.shields.io/badge/magento-1.9.2-blue.svg)
15-
![PHP >= 5.3](https://img.shields.io/badge/php-%3E=5.3-green.svg)
15+
![PHP >= 5.4](https://img.shields.io/badge/php-%3E=5.4-green.svg)
1616

1717
Documentation
1818
--------------
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
3+
abstract class Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4+
{
5+
protected $settings;
6+
protected $selectFields = [];
7+
8+
public function __construct()
9+
{
10+
if (!isset($this->settings)) {
11+
throw new Exception('Please, specify columns settings.');
12+
}
13+
14+
foreach ($this->settings['columns'] as $columnName => $columnSettings) {
15+
$fieldSettings = [];
16+
17+
if (isset($columnSettings['label'])) {
18+
$fieldSettings['label'] = Mage::helper('adminhtml')->__($columnSettings['label']);
19+
}
20+
21+
if (isset($columnSettings['options'])) {
22+
$fieldSettings['renderer'] = $this->getRenderer($columnName, $columnSettings);
23+
}
24+
25+
if (isset($columnSettings['class'])) {
26+
$fieldSettings['class'] = $columnSettings['class'];
27+
}
28+
29+
if (isset($columnSettings['style'])) {
30+
$fieldSettings['style'] = $columnSettings['style'];
31+
}
32+
33+
$this->addColumn($columnName, $fieldSettings);
34+
}
35+
36+
$this->_addAfter = $this->settings['addAfter'];
37+
$this->_addButtonLabel = Mage::helper('adminhtml')->__($this->settings['buttonLabel']);
38+
39+
parent::__construct();
40+
}
41+
42+
protected function _prepareArrayRow(Varien_Object $row)
43+
{
44+
foreach ($this->settings['columns'] as $columnName => $columnSettings) {
45+
if (!isset($columnSettings['options']) || !isset($columnSettings['rowMethod'])) {
46+
continue;
47+
}
48+
49+
$row->setData('option_extra_attr_'.$this->getRenderer($columnName, $columnSettings)->calcOptionHash($row->{$columnSettings['rowMethod']}()), 'selected="selected"');
50+
}
51+
}
52+
53+
/**
54+
* Creates and populates a select block to represent each column in the configuration property.
55+
*
56+
* @param $columnId string The name of the column defined in addColumn
57+
* @param $columnSettings array Settings for select box
58+
*
59+
* @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
60+
*
61+
* @throws Exception
62+
*/
63+
protected function getRenderer($columnId, array $columnSettings)
64+
{
65+
if (array_key_exists($columnId, $this->selectFields) && $this->selectFields[$columnId]) {
66+
return $this->selectFields[$columnId];
67+
}
68+
69+
$options = $columnSettings['options'];
70+
if (!is_array($options) && is_callable($options)) {
71+
$options = $options();
72+
}
73+
74+
$width = 100;
75+
if (isset($columnSettings['width'])) {
76+
$width = $columnSettings['width'];
77+
}
78+
79+
/** @var Algolia_Algoliasearch_Block_System_Config_Form_Field_Select $selectField */
80+
$selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select');
81+
82+
$selectField->setIsRenderToJsTemplate(true);
83+
$selectField->setOptions($options);
84+
$selectField->setExtraParams('style="width:'.$width.'px;"');
85+
86+
$this->selectFields[$columnId] = $selectField;
87+
88+
return $this->selectFields[$columnId];
89+
}
90+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/**
4+
* Algolia custom sort order field.
5+
*/
6+
class Algolia_Algoliasearch_Block_System_Config_Form_Field_AdditionalSections extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7+
{
8+
public function __construct()
9+
{
10+
$this->settings = [
11+
'columns' => [
12+
'name' => [
13+
'label' => 'Section',
14+
'options' => function () {
15+
$options = [];
16+
17+
$sections = [
18+
['name' => 'pages', 'label' => 'Pages'],
19+
];
20+
21+
/** @var Algolia_Algoliasearch_Helper_Config $config */
22+
$config = Mage::helper('algoliasearch/config');
23+
24+
$attributes = $config->getFacets();
25+
foreach ($attributes as $attribute) {
26+
if ($attribute['attribute'] == 'price' || $attribute['attribute'] == 'category' || $attribute['attribute'] == 'categories') {
27+
continue;
28+
}
29+
30+
$sections[] = [
31+
'name' => $attribute['attribute'],
32+
'label' => $attribute['label'] ? $attribute['label'] : $attribute['attribute']
33+
];
34+
}
35+
36+
foreach ($sections as $section) {
37+
$options[$section['name']] = $section['label'];
38+
}
39+
40+
return $options;
41+
},
42+
'rowMethod' => 'getName',
43+
'width' => 130,
44+
],
45+
'label' => [
46+
'label' => 'Label',
47+
'style' => 'width: 100px;',
48+
],
49+
'hitsPerPage' => [
50+
'label' => 'Hits per page',
51+
'style' => 'width: 100px;',
52+
'class' => 'required-entry input-text validate-number',
53+
],
54+
],
55+
'buttonLabel' => 'Add Section',
56+
'addAfter' => false,
57+
];
58+
59+
parent::__construct();
60+
}
61+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/**
4+
* Algolia custom sort order field.
5+
*/
6+
class Algolia_Algoliasearch_Block_System_Config_Form_Field_CategoryAdditionalAttributes extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7+
{
8+
public function __construct()
9+
{
10+
$this->settings = [
11+
'columns' => [
12+
'attribute' => [
13+
'label' => 'Attribute',
14+
'options' => function () {
15+
$options = [];
16+
17+
/** @var Algolia_Algoliasearch_Helper_Entity_Categoryhelper $category_helper */
18+
$category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
19+
20+
$searchableAttributes = $category_helper->getAllAttributes();
21+
foreach ($searchableAttributes as $key => $label) {
22+
$options[$key] = $key ? $key : $label;
23+
}
24+
25+
return $options;
26+
},
27+
'rowMethod' => 'getAttribute',
28+
'width' => 160,
29+
],
30+
'searchable' => [
31+
'label' => 'Searchable',
32+
'options' => [
33+
'1' => 'Yes',
34+
'0' => 'No',
35+
],
36+
'rowMethod' => 'getSearchable',
37+
],
38+
'retrievable' => [
39+
'label' => 'Retrievable',
40+
'options' => [
41+
'1' => 'Yes',
42+
'0' => 'No',
43+
],
44+
'rowMethod' => 'getRetrievable',
45+
],
46+
'order' => [
47+
'label' => 'Ordered',
48+
'options' => [
49+
'ordered' => 'Ordered',
50+
'unordered' => 'Unordered',
51+
],
52+
'rowMethod' => 'getOrder',
53+
],
54+
],
55+
'buttonLabel' => 'Add Attribute',
56+
'addAfter' => false,
57+
];
58+
59+
parent::__construct();
60+
}
61+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
/**
4+
* Algolia custom sort order field.
5+
*/
6+
class Algolia_Algoliasearch_Block_System_Config_Form_Field_CustomRankingCategoryAttributes extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7+
{
8+
public function __construct()
9+
{
10+
$this->settings = [
11+
'columns' => [
12+
'attribute' => [
13+
'label' => 'Attribute',
14+
'options' => function () {
15+
$options = [];
16+
17+
/** @var Algolia_Algoliasearch_Helper_Config $config */
18+
$config = Mage::helper('algoliasearch/config');
19+
20+
$attributes = $config->getCategoryAdditionalAttributes();
21+
foreach ($attributes as $attribute) {
22+
$options[$attribute['attribute']] = $attribute['attribute'];
23+
}
24+
25+
return $options;
26+
},
27+
'rowMethod' => 'getAttribute',
28+
],
29+
'order' => [
30+
'label' => 'Asc / Desc',
31+
'options' => [
32+
'desc' => 'Descending',
33+
'asc' => 'Ascending',
34+
],
35+
'rowMethod' => 'getOrder',
36+
],
37+
],
38+
'buttonLabel' => 'Add Ranking Criterion',
39+
'addAfter' => false,
40+
];
41+
42+
parent::__construct();
43+
}
44+
}

0 commit comments

Comments
 (0)