'How to create a Ajax search box for custom brands block in magento2.4.2
I'm having a custom created block for available brands in the site . I need a search box in ajax . can anyone help me?
Here is the normal dropdown code which I need to change into ajax search.
<select data-role="sorter" class="sorter-options" id="branddropdown" style="background-color:white">
<?php foreach($allbrands as $brand) {
$brand_name = str_replace(' ', '-', $brand['brand_name']);
$brandurl=$block->getUrl('modelseries',['brand'=>$brand_name]);
$brandurl=str_replace("modelseries/index/index","ms",$brandurl);
?>
<option value="<?php echo $brandurl; ?>" <?php if( $brand['brand_name'] == $currentbrand['brand_name']){ ?>selected="selected" <?php } ?>><?php /* @escapeNotVerified */ echo __($brand['brand_name']); ?></option>
<?php } ?>
</select>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
