We have added couple of products on our Magento 2 site. In the home page of the site, we have a search form and there we have put input boxes as product name, from, to and location. We want to display the results as per the selected criteria in the form but its not working as expected.
Code:
<dd id="construction" class="item content active" data-role="content" >
<form method="GET" action="<?php echo $block->getUrl('catalogsearch/result/');?>">
<fieldset class="search-forms-fieldset" id="date-range-1">
<legend class="legend"><span><?= /* @escapeNotVerified */ __('Search Settings') ?></span></legend>
<div class="field region">
<label for="select" class="label"><span>Select</span></label>
<div class="control" id="conselect">
<input type="text" name="q" placeholder="<?= /* @escapeNotVerified */ __('What are you looking for?') ?>" />
<?php /*?><select name="looking" id="looking">
<option value="">Please select</option>
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
</select><?php */?>
</div>
</div>
<div class="field">
<label for="location" class="label"><span><?= /* @escapeNotVerified */ __('Location') ?></span></label>
<div class="control" id="conlocation">
<input type="text" name="location" placeholder="<?= /* @escapeNotVerified */ __('Location') ?>" />
</div>
</div>
<div class="field">
<label for="available_from" class="label"><span><?= /* @escapeNotVerified */ __('Available From') ?></span></label>
<div class="control" id="confrom">
<input type="text" name="available_from" placeholder="<?= /* @escapeNotVerified */ __('Available From') ?>" id="date-from-1" />
</div>
</div>
<div class="field">
<label for="available_to" class="label"><span><?= /* @escapeNotVerified */ __('Location') ?></span></label>
<div class="control" id="conto">
<input type="text" name="available_to" placeholder="<?= /* @escapeNotVerified */ __('Available To') ?>" id="date-to-1"/>
</div>
</div>
</fieldset>
<div class="actions-toolbar">
<div class="primary">
<button type="submit"
class="action search primary"
title="<?= $block->escapeHtml(__('Search')) ?>">
<span><?= /* @escapeNotVerified */ __('Search') ?></span>
</button>
</div>
</div>
</form>
</dd>
Please see the below screenshot for your reference:
searchable
oruse in search
column is set toyes