![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/design/frontend/Cnc/default/Amasty_ShopbyBrand/templates/ |
<?php /** * @author Amasty Team * @copyright Copyright (c) 2020 Amasty (https://www.amasty.com) * @package Amasty_ShopbyBrand */ ?> <?php /** * @var \Amasty\ShopbyBrand\Block\Widget\BrandList $block */ ?> <div class="input-box field search"> <div class="ambrands-search-wrapper"> <input href='#' type="text" class="input-text ambrands-search-input" id="ambrands-search-input" placeholder="<?= $block->escapeHtmlAttr(__('Search Brand')) ?>" value=""/> <div id="livesearch"></div> </div> </div> <script> require([ 'jquery', 'domReady!' ], function ($) { var brands = <?= /* @noEscape */ $block->getBrands(); ?>, jqSearchInput = $('#ambrands-search-input'), jqLetterAllTrigger = $('.brands-filters .-letter-all'), jqBrandItems = $('.brand-images li[data-brand]'), jqBrandLettersContainers = $('.brand-images .brands-letter'), jqLiveSearch = $('#livesearch'); jqSearchInput.on('keyup', function () { var str = $(this).val().trim().toLowerCase(); if (str.length === 0) { var activeLetter = $('.letters .letter.-active'); if (activeLetter.length > 0) { $(activeLetter[0]).trigger('click'); jqBrandItems.show(); jqLiveSearch.hide(); } return; } var foundBrands = {}; for (var url in brands) { if (brands[url].toLowerCase().indexOf(str) !== -1) { foundBrands[url] = brands[url]; } } jqBrandLettersContainers.hide(); jqBrandItems.hide(); if (!Object.keys(foundBrands).length) { jqLiveSearch.hide(); jQuery('.brand-images .brands-letter.am-brands-fullwidth').removeClass('am-brands-fullwidth'); } else { jQuery(".brand-images li[data-brand*='" + str + "']").show().parents('.brands-letter').show(); var result = ''; for(var url in foundBrands) { result += '<a href="' + url +'">' + foundBrands[url] + '</a>'; } jqLiveSearch.html(result); jqLiveSearch.show(); } }); }); </script>