Web Analytics

Fill the form & Get Installation Support

Any Question or Concerns?
Let's discuss

    Ajax search product on compare page and add it to the comparison list like GSM Arena.

    Let’s say we want the compare page like GSM Arena Smartphone to compare tool in Magento 2.

    So we have fixed the compare column in Magento at 4 as per our requirement. And we have added the search block to compare the list page.

    We have achieved this type of functionality through Mirasvit Search Autocomplete.

    Please follow the below steps.

    Step 1: Add the search block in list.phtml of compare module by overriding the file in your theme or module and add the below code in the for each of compare item.

    Step 2: You have to make the changes for the injection template so you have to add the below code of layout file which is “catalog_product_compare_index.xml”.

    We have created a different injection template for compare list page so when you search the product and click on it it would not redirect so you can make an ajax call from it.

    Step 3: You have to copy-paste the injection_template.phtml to code into injection_templates_compare.phtml file and remove the href from <a> tag to stop the redirection from search results.

    step 4: Add the below script to list.phtml of compare module by overriding in your theme or module.

    Step 5: To remove the previous product and to add new searched product in the compare list create a front controller named “AddRemoveBoth.php” on this path “app/code/Magemonkeys/Compareajax/Controller/Index”

    You can change or modify the above steps as per your requirement.


    Fill the below form if you have any Magento programming need.

      Recent Articles

      Author Info

      Author Image

      Hire A. Patel

      Get a Free Quote

        Connect With Us