diff --git a/Block/Adminhtml/System/Config/Form/InfoBlogExtra.php b/Block/Adminhtml/System/Config/Form/InfoBlogExtra.php
index 450920ed..77ce8e3f 100644
--- a/Block/Adminhtml/System/Config/Form/InfoBlogExtra.php
+++ b/Block/Adminhtml/System/Config/Form/InfoBlogExtra.php
@@ -34,7 +34,9 @@ protected function getSectionsJson(): string
'mfblog_post_view_comments_admin_send_to',
'mfblog_post_view_comments_admin_email_template',
'mfblog_blog_search',
- 'mfblog_sidebar_contents'
+ 'mfblog_sidebar_contents',
+ 'mfblog_sidebar_search_display_filters',
+ 'mfblog_sidebar_search_available_filters'
]);
return $sections;
}
diff --git a/Block/Search/PostList.php b/Block/Search/PostList.php
index fe1e5843..2f8c2072 100755
--- a/Block/Search/PostList.php
+++ b/Block/Search/PostList.php
@@ -15,6 +15,7 @@
*/
class PostList extends \Magefan\Blog\Block\Post\PostList
{
+
/**
* Retrieve query
* @return string
@@ -39,6 +40,7 @@ protected function _preparePostCollection()
self::POSTS_SORT_FIELD_BY_PUBLISH_TIME,
\Magento\Framework\Api\SortOrder::SORT_DESC
);
+ $this->_eventManager->dispatch('blog_search_prepare_post_collection_after', ['post_collection' => $this->_postCollection]);
}
/**
@@ -80,7 +82,6 @@ protected function _prepareLayout()
$this->escapeHtml($title)
);
}
-
return parent::_prepareLayout();
}
diff --git a/Model/Config/Source/AvailableFilters.php b/Model/Config/Source/AvailableFilters.php
new file mode 100644
index 00000000..20da6ea2
--- /dev/null
+++ b/Model/Config/Source/AvailableFilters.php
@@ -0,0 +1,43 @@
+ 'category', 'label' => __('Category')],
+ ['value' => 'author', 'label' => __('Author')],
+ ['value' => 'tag', 'label' => __('Tag')],
+ ['value' => 'publication_date', 'label' => __('Publication Date (From/To)')]
+ ];
+ }
+
+
+ /**
+ * Get options in "key-value" format
+ *
+ * @return array
+ */
+ public function toArray()
+ {
+ $array = [];
+ foreach ($this->toOptionArray() as $item) {
+ $array[$item['value']] = $item['label'];
+ }
+ return $array;
+ }
+}
\ No newline at end of file
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 64427e1d..ef3e3615 100755
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -520,6 +520,20 @@
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+
+
+ Magefan\Blog\Model\Config\Source\AvailableFilters
+
+ 1
+ 1
+
+
+
@@ -1040,6 +1054,21 @@
Magento\Config\Model\Config\Source\Yesno
+
+
+ Magento\Config\Model\Config\Source\Yesno
+
+ 1
+
+
+
+
+ Magefan\Blog\Model\Config\Source\AvailableFilters
+
+ 1
+ 1
+
+
diff --git a/etc/config.xml b/etc/config.xml
index 1c9e0637..066c0302 100755
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -127,12 +127,16 @@
0
+ 0
+ category,author,tag,publication_date
1
10
+ 0
+ category,author,tag,publication_date
1
diff --git a/view/frontend/layout/blog_default.xml b/view/frontend/layout/blog_default.xml
index 8c1c928c..434a2ad0 100755
--- a/view/frontend/layout/blog_default.xml
+++ b/view/frontend/layout/blog_default.xml
@@ -16,7 +16,9 @@