Skip to content

Commit

Permalink
[FEATURE] [issue-3283] Added Filter Support for Yes/No (boolean) attr…
Browse files Browse the repository at this point in the history
…ibutes
  • Loading branch information
lewisvoncken committed Aug 27, 2018
1 parent d40a9ec commit 952b333
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ protected function _isOriginalIndexable()
$backendType = $this->getOrigData('backend_type');
$frontendInput = $this->getOrigData('frontend_input');

if ($backendType == 'int' && $frontendInput == 'select') {
if ($backendType == 'int' && ($frontendInput == 'select' || $frontendInput == 'boolean')) {
return true;
} elseif ($backendType == 'varchar' && $frontendInput == 'multiselect') {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function _getIndexableAttributes($multiSelect)
if ($multiSelect == true) {
$select->where('ea.backend_type = ?', 'varchar')->where('ea.frontend_input = ?', 'multiselect');
} else {
$select->where('ea.backend_type = ?', 'int')->where('ea.frontend_input = ?', 'select');
$select->where('ea.backend_type = ?', 'int')->where('ea.frontend_input IN( ? )', ['select', 'boolean']);
}

return $this->getConnection()->fetchCol($select);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function bindAttributeInputType()
{
checkOptionsPanelVisibility();
switchDefaultValueField();
if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){
if($('frontend_input') && ($('frontend_input').value=='boolean' || $('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){
if($('is_filterable') && !$('is_filterable').getAttribute('readonly')){
$('is_filterable').disabled = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
[
'name' => 'is_filterable',
'label' => __("Use in Layered Navigation"),
'title' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
'note' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price.'),
'title' => __('Can be used only with catalog input type Yes/No (Boolean), Dropdown, Multiple Select and Price'),
'note' => __('Can be used only with catalog input type Yes/No (Boolean), Dropdown, Multiple Select and Price.'),
'values' => [
['value' => '0', 'label' => __('No')],
['value' => '1', 'label' => __('Filterable (with results)')],
Expand All @@ -70,8 +70,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
[
'name' => 'is_filterable_in_search',
'label' => __("Use in Search Results Layered Navigation"),
'title' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price'),
'note' => __('Can be used only with catalog input type Dropdown, Multiple Select and Price.'),
'title' => __('Can be used only with catalog input type Yes/No (Boolean), Dropdown, Multiple Select and Price'),
'note' => __('Can be used only with catalog input type Yes/No (Boolean), Dropdown, Multiple Select and Price.'),
'values' => $this->optionList->toOptionArray(),
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="valuesForEnable" xsi:type="array">
<item name="boolean" xsi:type="string">boolean</item>
<item name="select" xsi:type="string">select</item>
<item name="multiselect" xsi:type="string">multiselect</item>
<item name="price" xsi:type="string">price</item>
Expand All @@ -19,7 +20,7 @@
</item>
</argument>
<settings>
<notice translate="true">Can be used only with catalog input type Dropdown, Multiple Select and Price.</notice>
<notice translate="true">Can be used only with catalog input type Yes/No (Boolean), Dropdown, Multiple Select and Price.</notice>
<dataType>string</dataType>
<label translate="true">Use in Layered Navigation</label>
<dataScope>is_filterable</dataScope>
Expand All @@ -36,6 +37,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="valuesForEnable" xsi:type="array">
<item name="boolean" xsi:type="string">boolean</item>
<item name="select" xsi:type="string">select</item>
<item name="multiselect" xsi:type="string">multiselect</item>
<item name="price" xsi:type="string">price</item>
Expand All @@ -45,7 +47,7 @@
</item>
</argument>
<settings>
<notice translate="true">Can be used only with catalog input type Dropdown, Multiple Select and Price.</notice>
<notice translate="true">Can be used only with catalog input type Yes/No (Boolean), Dropdown, Multiple Select and Price.</notice>
<label translate="true">Use in Search Results Layered Navigation</label>
<dataScope>is_filterable_in_search</dataScope>
<imports>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ define([
get tabsFront() {
return this.attrTabsFront.length ? this.attrTabsFront.closest('li') : $('#front_fieldset-wrapper');
},
selectFields: ['select', 'multiselect', 'price', 'swatch_text', 'swatch_visual'],
selectFields: ['boolean', 'select', 'multiselect', 'price', 'swatch_text', 'swatch_visual'],

/**
* @this {swatchProductAttributes}
Expand Down

0 comments on commit 952b333

Please sign in to comment.