OpenCart Elasticsearch: Now easily integrate Elasticsearch engine within your OpenCart web store using the OpenCart Elasticsearch extension. Store your entire product catalog on the server where you have installed the Elasticsearch and provide search and autocomplete suggestions for the customers of your web store.
Elasticsearch is a highly scalable open-source full-text search engine. It allows you to store, search, and analyze big volumes of data very quickly. It is the fastest search engine that returns the results of the entered query in real time.
**Note: Before installing this module, Elastic Search Engine must be installed on the system and must be running.
In order to know whether Elastic Search server working fine or not, you need to enter the mentioned url https://your_server_ip:9200 on the browser where 9200 is the default port number for Elastic Search server.
- Admin can replace MySQL search engine with the Elastic search engine.
- Admin can upload/update products, categories, manufacturer and information pages data to the elastic server.
- Admin can allow Elasticsearch login authentication.
- Store data on the elastic server according to the index types.
- The customer can search data by name, description and short description of the Product.
- Has the “Did You Mean” Feature according to which the search engine automatically corrects the keywords if they are typed incorrectly.
- A customer can search for the products based on products, categories, manufacturer, and information.
- Also, a customer can search on the basis of keywords & tags.
- Admin will set up Cron Job for refreshing the ElasticSearch Indexes on the server.
Extract the contents of the received zip folder on your system according to your Opencart version. The extracted folder has admin, catalog, ocmod, system composer.json & cronindex.php folders. Now, upload the admin, catalog, system, system composer.json & cronindex.php directories into the Opencart root directory as shown below in the snapshot.
After uploading the files, run the following commands in the terminal for installing the composer.json file.
curl -s http://getcomposer.org/installer | php
php composer.phar install
Note: – You have to increase post_max_size to 200M.
Once you have uploaded the folders, login to admin and then from the catalog section go to Extensions> Extension Installer and upload the XML file. The XML file is in the ocmod folder under module directory. In the ocmod folder, select the Opencart version that you are using and under it, you will find wk_elastic_search.ocmod.xml file.
After that in Admin panel go to System -> Users -> User Groups and edit ‘Administrator’ and choose to select all for both Access and Modify Permission for the permission that you want to provide and save it.
Module Configuration – OpenCart Elasticsearch
Setting Cron Jobs
After the module installation, store owner or the admin will set up the Cron Job. Just login into the cPannel Account and click on Cron Job.
To find PHP directory path go the terminal and login with your ssh account using command ‘ ssh user@ip/host‘. After that find the PHP path by running this command ‘whereis php‘.
Now copy the usr/bin/php and write
it in the command section followed by Webkul ElasticSearch file path like this.
First, select the store for which you want to implement the Elastic search. This option is for a multi-store configuration.
Now, the admin will configure the options under General Settings tab –
- Select the Status of the Elastic search engine as Enabled/Disabled as required
- Enter the Elasticsearch Host address(IP address of the server with Elasticsearch installed)
- Enter the Elasticsearch Port number(server with Elasticsearch installed)
- Enter the Index Prefix which is used to create your data index unique on elastic server.
- Select the Elasticsearch Scheme to use HTTP or HTTPS
- Choose to have a Login Authentication for the Elastic Server by selecting Enabled(need to enter Username & Password) or select as Disabled
After this, the admin has to configure the settings under the Search tab. Here, you have 2 more tabs –
Here, configure the General settings for the Search –
- Enter the Minimum Number Of Characters To Search
- Select to Redirect If Single Result by selecting Enabled or Disabled
- For Search In check the sections where you want to search on front-end
- Check the sections under the option Search In Product For where you want to search for the product
- For the option Search In Category For check the sections where you want the search
- For the Option Search In Information check the sections that should be searched on the information pages.
And under the Design tab –
Here for the 2 options –
- Details To Be Shown On Search Result – check the product detail sections that you want to display at the front-end
- Search Text Box Placeholder – enter the placeholder for the front-end search box
Finally, you can click the Save button at the top right-hand side to save the configuration settings.
How to Connect to the Elasticsearch Server?
Under the General section in the configuration settings, after you have entered the correct details click Check Status button at the top right-hand corner.
This checks the connection and if connection is established you will see a message with details.
Elastic Search Index Management
Here, to add an index enter –
- The Index Name(every character must be lower case) & also predefined Index prefix i.e elastic_ is added before the Index name to make every field unique from other.
- The Index Type(select the index type for this mapping)
- The No of Shards (The ability to subdivide your index into multiple pieces)
- The Number of Replicas(if the node holding a primary shard dies, a replica is promoted to the role of primary)
- Select the Status of this Index as Enabled or Disabled
- lastly, click the Save button to save the Data Index
Elasticsearch at Work
On the front-end, the customers can now make use of the Elasticsearch for making the fastest search within your OpenCart web store.
Did You Mean: This feature allows the customers to search for the desired products even if they had mistakenly entered wrong product name. This feature will suggest them all the products which have nearby same product name.
For further detailed information regarding this feature, you can follow this link.
Search Suggestions: When customer searches for a character string suggestions are provided for the entered string. The customer can now click any of the suggestions to redirect to the selected suggestion.
Full Keyword Search: When a keyword is searched; along with the suggestions you see the products being displayed with the keyword.
Description Search: Customer can also search the products using the product description.
Category Based Search: Customer can easily search for their desired products by using the categories name.
Manufacturer based Search: Here the customers can easily search for the products by using the manufacturer names.
Information based search: The customer can easily search for the products by providing information title in the search bar and can find the related products.
Tag-based search: The customer can search for their desired products by just using the tags associated with products.
Current Product Version - 22.214.171.124
Supported Framework Version - 2.0.x.x, 2.1.x.x, 2.2.x.x, 2.3.x.x, 3.x.x.x