How to check elasticsearch is enabled programmatically Magento 2?

Magento 2.4 Out of the box supports Primary Search Engines is Elasticsearch.

If your site having some third party search engine installed or want to know about programmatically for the elastic search is enable or not in your code, you can know it using the given code snippet. Continue reading “How to check elasticsearch is enabled programmatically Magento 2?”

How to add custom button on sales order view admin page Magento 2?

Add Custom Button on Sales Order View Page on the admin panel toolbar Magento to add extra features to the order view page.

Using Button, You can add URL to redirect to another page with your custom requirement.

To add a custom button, you need to create before plugin for the PushButtons() method from the Magento\Backend\Block\Widget\Button\Toolbar class. Continue reading “How to add custom button on sales order view admin page Magento 2?”

How to apply custom conditions before get faceted data elastic search results Magento 2?

Apply custom conditions on faceted data elastic search collection before it returns field faceted data from the faceted search results in Magento 2.

From the Magento 2.4, Elasticsearch is the Primary search engine instead of Deprecated Mysql.

When you go to the Catalog search module, FullText collection class, you can check the getFacetedData() method to return the field with faceted search results. Using Before plugin, you can add custom conditions before final search results render on the page. Continue reading “How to apply custom conditions before get faceted data elastic search results Magento 2?”