Sidebar Search Opencart module for free version 2

We are publishing another free Opencart module “Sidebar Search module” and we made this for OpenCart version 2.0.3.1. No files are overridden, you can enable it and disable it whenever you like from the admin section.

Output after installing the module in the home page’s right column is shown as in the image below:

sidebar search opencart module free
sidebar search opencart module free

Although the search is available at the header section so it is useless to use at default theme but you can use it for the customized theme and I will make another search module soon which will include all search functionality as the main search page. For now, enjoy this normal search opencart free module. You can see how I copied the header search section and show it as a module in the side search box. You can show anywhere you like as this is a module so you can show in the left column, right column or top content or bottom content.

Download Sidebar shopping cart free module from the link below:

Download Sidebar search OpenCart free module

Installation:

  1. Unzip the downloaded folder.
  2. Upload the files in the root folder to your server, no file is overwritten.
  3. Then activate the Search module.

Activating the Sidebar Search module:

  1. After uploading files to servers, it’s time to install Sidebar search module
  2. We are showing the sidebar search at the right column but you can show it wherever you like as this acts as the normal module.
  3. Go to Admin section
  4. Then click on Extensions on the left menu
  5. After that Click Modules and go to “Search” in the modules list
  6. Then click the green button to install the module (see the image below)
installation_of_module
installation_of_module

Then click the blue edit button After that, you will see the form which has the status field, select “Enabled” and then click the Save button. Your module is active and is ready to use in the layout.

Setup layout for the sidebar search module at home page:

  1. From the admin section go to System >> Design >> Layouts.
  2. You will see a list of layouts, from which edit the “Home” layout.
  3. Then click Blue add the button to add rows at module section which is shown in the image below:
siderbar shopping cart installation
siderbar_shopping_cart_installation

Second, you choose the Search in module column and Column right in the Position column and insert the sort order as required. Then click save button

Your custom sidebar search module is showing in the right column of the homepage. Likewise, you can show in many other layouts and pages.

Codes in search modules controller:

<?php
class ControllerModuleSearch extends Controller {
    public function index() {
        $this->load->language('module/search');
        $data['heading_title'] = $this->language->get('heading_title');
        
        $data['search'] = $this->load->controller('common/search');

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/search.tpl')) {
            return $this->load->view($this->config->get('config_template') . '/template/module/search.tpl', $data);
        } else {
            return $this->load->view('default/template/module/search.tpl', $data);
        }
    }
}

The main role player code here is

$data['search'] = $this->load->controller('common/search');

Code of search modules in language section:

<?php
// Heading
$_['heading_title'] = 'Search';

Code of search modules in theme (presentation layer):

<h3><?php echo $heading_title; ?></h3>
<hr>
<div class="row">
    <div class="product-layout col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <header><?php echo $search; ?></header>
    </div>
</div>
<hr>

Let me know if you get any problem with performing tasks in the comment so that I can help if you have any.

Thanks
Rupak Nepali

Previous articleOpenCart 3 error Warning: You do not have permission to modify the default store theme!
Next articleOpencart 3 OCMOD coding tutorial

2 COMMENTS

  1. Hi Rupak,

    Thank you for taking the time to make this extension. I have tried to use the extension with Opencart 2.2 and initially it did not work but after some tinkering i managed to get it to display correctly. Unfortunately when you search for an item it returns no results. Could you tell me how to correct this for use with Opencart 2.2? I would very much like to replace the top search bar with a side search bar such as your own.

    Best regards

LEAVE A REPLY

Please enter your comment!
Please enter your name here