Post by DoctorDredd » Sun Jun 12, 2022 5:54 am

Hello all.
Not working search only on mobile version of site. On desktop is working.
Looks like search id for desktop and mobile versions of site the same because of that the problem.

How to improve code for solving this problem?

Thanks in advance!

catalog>view>javascript>bossthemes

bossthemes.js

var isMobile = /iPhone|iPod|iPad|Phone|Mobile|Android|hpwos/i.test(navigator.userAgent);
var isPhone = /iPhone|iPod|Phone|Android/i.test(navigator.userAgent);

jQuery(document).ready(function($) {
$('#search input[name=\'search\'], #mobile-header-search input[name=\'search\']').on('keydown', function(e) {
if (e.keyCode == 13) {
$('header input[name=\'search\']').parent().find('.button-search').trigger('click');
}
});

/* Tooltip */
catalog>view>javascript

common.js


/* Search */
$('.button-search').bind('click', function () {
url = $('base').attr('href') + 'index.php?route=product/search';

var search = $('input[name=\'search\']').attr('value');

if (search) {
url += '&search=' + encodeURIComponent(search);
}

location = url;
});

$('#header input[name=\'search\']').bind('keydown', function (e) {
if (e.keyCode == 13) {
url = $('base').attr('href') + 'index.php?route=product/search';

var search = $('input[name=\'search\']').attr('value');

if (search) {
url += '&search=' + encodeURIComponent(search);
}

location = url;
}
});

/* Ajax Cart */ /* Search */
$('.button-search').bind('click', function () {
url = $('base').attr('href') + 'index.php?route=product/search';

var search = $('input[name=\'search\']').attr('value');

if (search) {
url += '&search=' + encodeURIComponent(search);
}

location = url;
});

$('#header input[name=\'search\']').bind('keydown', function (e) {
if (e.keyCode == 13) {
url = $('base').attr('href') + 'index.php?route=product/search';

var search = $('input[name=\'search\']').attr('value');

if (search) {
url += '&search=' + encodeURIComponent(search);
}
location = url;
}
});

/* Ajax Cart */

headr.tpl
<?php } ?>
</div>
<div id="search-block" class="col-lg-10 col-md-10 col-sm-10 col-xs-10">
<div class="boss_search">
<div id="search">
<div class="button-search"></div>
<input type="text" name="search" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" autocomplete="off" />
</div>
<?php

Newbie

Posts

Joined
Wed Jul 29, 2020 7:38 pm

Post by JNeuhoff » Sun Jun 12, 2022 4:58 pm

You are using a 3rd party web theme, please contact its author for support.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 34 guests