In search what "keywords" are being pulled?

I have an issue with the search bar feature. I have an item with “strap” in the product name and description. Whey I enter “strap” in the search bar, nothing is listed, only all of the categories. Looking to see how to setup the search to where when a word is entered, like strap, that only listings that include that work are listed.

Please try to disable Display categories instead of listings option in HivePress/Settings/Listings section. If this option is active then user should choose category where search process should be done. So please try to disable this option and search results will be shown at once

This doesn’t work for us. We have this enabled on the Master Categories only. If we uncheck this on the Master Categories, none of the subcategories are shown. It is important that people can click the master category, then the subcategory, to narrow down their search.

Is it possible to create a snippet for this, so when a term is search, it lists all of the items with that word, but not break the functionality we require?

www.6mmgear.com is the site if you want to see what I mean.

If possble send more details about this issue. There are 2 display modes for categories by default, it can either show listings or subcategories (you can switch this with a checkbox on the category edit page). For example this category has the checkbox checked Airsoft Guns – 6mmGear | Airsoft Classifieds but this one doesn’t Electric Pistols (AEP) – 6mmGear | Airsoft Classifieds so it shows listings.
If you want users to narrow down their search to the second-level category first, please check this checkbox for all the top-level categories.

Airsoft Guns (is the parent category) and Electric Pistol (AEG) is a subcategory/child under Airsoft Guns. Airsoft Guns is checked. Electric Pistol (AEG) is not checked. If we uncheck Airsoft Guns. the Electric Pistol (AEG) category goes away. In the end, I want the search option to scan the listings under each subcategory.

Does this help?

Yes, this is how it works in the current version, if you want users to select a subcategory before viewing listings, please check the “Display subcategories…” option for Airsoft Guns, then users will have to click on a subcategory first before viewing any listings. If you un-check this option, then listings from Airsoft Guns and any of its subcategories will be displayed. In this case users still can filter listings from Airsoft Guns using the filters form in the sidebar.

So there is no way to set the search bar to where it searches all of the listings, regardless of whether a category or subcategory is selected?

It searches any listings by default, but if you select a category (in the search filters) that has the “Display subcategories instead…” option checked, it will force users to select a subcategory before displaying the search results, it will not display listings on this category level (this option defines if listings or subcategories should be displayed, mostly used to prevent mixing different listing types or search filters within the same page or form).

Understood. Is there a way to make it where the search bar is not present until AFTER they select the subcategory? Example, I select the category, then the subcategory, and now I can use the search bar to filter the listings of the subcategory based on the keyword I entered.

Please try this PHP snippet

add_filter(
	'hivepress/v1/templates/listing_categories_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_search_form' => [
						'type' => 'content',
					],
				],
			]
		);
	},
	1000
);

This worked! Now the search is disabled until the category and subcategory is selected. Thank you!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.