Skip to main content

FIX - smaller search box not working properly on my custom opencart theme

search not working properly on my custom opencart theme


Probably you have moved your <?php echo $search; ?> outside the <header> tag.

so .... we are going to use the #search id

<div id="search" class="input-group">
  <input type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php echo $text_search; ?>" class="form-control input-lg" />
  <span class="input-group-btn">
    <button type="button" class="btn btn-default btn-lg"><i class="fa fa-search"></i></button>
  </span>
</div>


Solution

edit catalog/view/javascript/common.js

and after
var a=$("header input[name='search']").val();

add
if(!a){a=$("#search input[name='search']").val();}

or just replace
var a=$("header input[name='search']").val(); it s
with
var a=$("#search input[name='search']").val();

 I've just added the if statement so that I can ignore in the future WHY it doesn't work at all and I can move the "small search" in and out the header.

It's the fastest way and I don't want to invest extra time understanding why it works this way.

Comments

  1. Thanks for such a great post you have shared here.

    ReplyDelete
  2. I am also facing the same issue. After reading the different forum, I tried to edit the common.js file.

    1) replaced header with #search
    2) removed both search and header.

    Still value appear in the url.

    This is the website url. https://www.giftjaipur.com/test

    Can you please help

    ReplyDelete
  3. @namar garg
    There's no trace of the modified script.
    Do the necessary modifications and test.
    Try to learn from what you are doing.

    ReplyDelete

Post a Comment

Popular posts from this blog

Hashes Algorithms used in different web applications

Hashes Algorithms used in different web applications. I've done this list by hand. Not all the hashes algos are correct (I've generically added md5 or ??? where is unkwnown). If you are interested send corrections and I will update it. I will publish also a better version with tabs. You can reproduce it without problems. It's part of the project mdcrack gui on sourceforge. Use the | as data separator. ----------------------------------------------------------------------------------------------------------------------------------------------------- | Title | Hash Algorithm | TablePrefix | Table Name | Website | ----------------------------------------------------------------------------------------------------------------------------------------------------- | 1C Битрикс | md5($pass) | | |http://www.1c-bitrix.ru/ | 1024cms | md5($pass) | | |http://www.1024cms.org/ | 4images | md5($pass) | | |http://ww...

2022 - Remove (the too many) Ads from Memu launcher

Simple method Download from pureapk "MEmu Launcher2" ex: MEmu Launcher2_v6.0.9_apkpure.com Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar) Longer method Install "Export Apk" Export the memu launcher2  Install purify https://github.com/echo-devim/purify/raw/master/Purify.apk use purify with the exported memu launcher 2 Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar)      

[FIX] cyberpunk skip dialogue disappeared - pc Y button

  open C:\Games\Cyberpunk 2077\r6\config\inputUserMappings.xml with a text editor (ex. notepad++)   find   <mapping name="SceneFastForward_Button" type="Button" > ... </mapping> example (my non working settings)     <mapping name="SceneFastForward_Button" type="Button" >         <button id="IK_Pad_DigitLeft" />         <button id="IK_Y" overridableUI="fastForward" />     </mapping> and REPLACE it with the following:     <mapping name="SceneFastForward_Button" type="Button" >         <button id="IK_Pad_B_CIRCLE" />         <button id="IK_C" overridableUI="fastForward"/>     </mapping> thanks to the vanilla xml files on nexus mods as the original source.