Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Bjbris

Newbie
  
  • Posts

    4
  • Joined

  • Last visited

Bjbris's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. var search = $(' input[name=\'search-code\']') Да здесь ошибка, но он все равно пытается взять значение уже из существующего поиска.
  2. Добрый день гуру OPENCART! Начинающий пользователь хочет разобраться в поиске по сайту (сделать дополнительный на основе существующего) Хочу вынести его в HEADER, но это уже не столь важно. Просто разобраться в функционале. На данный момент есть: <div id="search-code"> <div class="button-search-code"></div> <input class="a" type="text" onfocus="if (this.value == 'по коду'){this.value = '';}" onblur="if (this.value == ''){this.value = 'по коду';}" name="search-code" value="по коду" /> </div> в common.js /* Search code */ $('.button-search-code').bind('click', function() { url = $('base').attr('href') + 'index.php?route=product/search'; var search = $('button-search-content [name=\'search-code\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } location = url; }); $('#search-code input[name=\'search-code\']').bind('keydown', function(e) { if (e.keyCode == 13) { url = $('base').attr('href') + 'index.php?route=product/search'; var search = $('input[name=\'search-code\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } location = url; } }); пытаюсь на его основе создать HTML: <div id="search-content"> <div class="button-search-content"></div> <input class="s" type="text" onfocus="if (this.value == 'по коду'){this.value = '';}" onblur="if (this.value == ''){this.value = 'по коду';}" name="search-code" value="по коду" /> </div> JS: /* Search-content */ $('.button-search-content').bind('click', function() { url = $('base').attr('href') + 'index.php?route=product/search'; var search = $('button-search-content input[name=\'search-code\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } location = url; }); $('#search-content input[name=\'search-code\']').bind('keydown', function(e) { if (e.keyCode == 13) { url = $('base').attr('href') + 'index.php?route=product/search'; var search = $('button-search-content input [name=\'search-code\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } location = url; } }); Не работает, может еще где-то в каком-то файле поискать? Заранее благодарен.
  3. Спасибо. Да ошибка ушла. Я еще добавил в common.js $('.button-search-content').bind('click', function() { url = $('base').attr('href') + 'index.php?route=product/search'; var search = $('input[name=\'search-code\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } location = url; }); $('#search-content input[name=\'search-code\']').bind('keydown', function(e) { if (e.keyCode == 13) { url = $('base').attr('href') + 'index.php?route=product/search'; var search = $('input[name=\'search-code\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } location = url; } }); Но поиск ничего не ищет.
  4. Добрый день. Подскажите, как добавить поиск, например стандартный <div id="search"> <div class="button-search"></div> <input type="text" name="search" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" /> </div> В header-top. При добавлении в инпут выводит <b>Notice</b>: Undefined variable: search in <b>/home/u142930515/public_html/catalog/view/theme/default/template/common/content_top.tpl</b> on line <b>1</b>
Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.