LISE searchtemplate

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
janvl
Power Poster
Power Poster
Posts: 983
Joined: Wed Aug 13, 2008 10:57 am

LISE searchtemplate

Post by janvl »

Hi,

i took over an old companydirectory install that i rebuild to Lise. Each record has about 15 fields.

I have everything working except for the searchtemplate.

I read the helptexts which are good, most things i could figure out myself.

What i need is a searchtemplate that searches for a searchstring plus the content of the field "postleitzahl" plus selected categories (german bundesländer are categories).
What i have so far is a form that shows the fields but it does not search and gives back results.

Could someone give me an example where the searchform uses a searchtext as free text, limit the search to the "checked categories" and specifically searches in the zipcode (postleitzahl).

As a matter of fact i do not understand the logic of searching like that and am open for any better idea.

Regards,
Jan
User avatar
webform
Power Poster
Power Poster
Posts: 511
Joined: Sat Nov 25, 2006 3:39 pm

Re: LISE searchtemplate

Post by webform »

Here is a abbreviated version of one of my LISE search templates.

Something to note when using search fields:
The regular search input field: name="{$actionid}search"
If your searching a category field: name="{$actionid}category"
If your searching a custom field: name="{$actionid}search_fieldalias".
So all custom fields you want to search starts with {$actionid}search_ and then you custom field alias.

And I replace POST with GET in {$formstart} to better handle the browser's back button when users click on a search result.

I also use {$smarty.get} to retrieve the selected search values ​​in the URL and display them to the users in the search fields.

Code: Select all

{$form_actionid = $actionid}

{assign var="types" value=[
	'Heavy Lift Vessel' => 'hlv',
	'Heavy Transport Vessel' => 'htv',
	'Barge' => 'barge'
]}
{assign var="submersibles" value=[
	'Yes' => 'Yes',
	'No' => 'No'
]}

{* Helper assign to get GET values from actionid-prefixed field *}
{assign var='get' value=$smarty.get}
{assign var='vesselname' value=$get["`$form_actionid`search"]|default:''}
{assign var='vesseltype' value=$get["`$form_actionid`category"]|default:''}
{assign var='submersible' value=$get["`$form_actionid`search_submersible"]|default:''}

{$formstart|replace:'method="post"':'method="get"'|replace:'cms_form':'cms_form mb-0'}
<div class="row gx-6">

	<div class="col-md-4">
		<div class="row">

			<div class="col-12 form-group">
				<label for="{$modulealias}searchinput">Vessel Name:</label>
				<input type="text" class="form-control" id="{$modulealias}searchinput" name="{$actionid}search" value="{$vesselname}">
			</div>
			<div class="col-12 form-group">
				<label for="{$modulealias}type">Vessel Type:</label>
				<select class="form-select" id="category" name="{$form_actionid}category">
					<option value="">- Any -</option>
					{foreach from=$types key=typelabel item=type}
						<option value="{$type}"{if $vesseltype == $type} selected="selected"{/if}>{$typelabel}</option>
					{/foreach}
				</select>
			</div>
			<div class="col-12 form-group">
				<label for="{$modulealias}submersible">Submersible:</label>
				<select class="form-select" id="{$modulealias}submersible" name="{$form_actionid}search_submersible">
					<option value="">- Any -</option>
					{foreach from=$submersibles key=submersiblelabel item=psubmersible}
						<option value="{$psubmersible}"{if $submersible == $psubmersible} selected="selected"{/if}>{$submersiblelabel}</option>
					{/foreach}
				</select>
			</div>

		</div>
	</div>
	
	Other Search Fields...

	<div class="w-100 mb-3"></div>

	<div class="col-lg-5 offset-lg-7 text-md-end">
		<a href="{cms_selflink href='vessel-finder'}" class="button button-border border-default h-bg-danger rounded-1 fw-medium text-transform-none ls-0 ms-0">Reset Filter</a>
		<button type="submit" name="submit" class="button button-blumine rounded ms-0">Filter Vessels</button>
	</div>

</div>
{$formend}
janvl
Power Poster
Power Poster
Posts: 983
Joined: Wed Aug 13, 2008 10:57 am

Re: LISE searchtemplate

Post by janvl »

Thank you webform,

i searched through internet, the cmsms documention etc. etc.
even asked AI but found no solution.

May i ask where these things are documented or where one could find this?

Regards,
Jan
User avatar
webform
Power Poster
Power Poster
Posts: 511
Joined: Sat Nov 25, 2006 3:39 pm

Re: LISE searchtemplate

Post by webform »

Mostly trial and error looking at the default LISE search and filter templates. But also asking on this forum.

For example from the default filter template:

Code: Select all

name="{$actionid}search_{$fielddef->alias}"
Which I then translated to the following when I try to call custom fields directly in the search template:

Code: Select all

<input type="text" id="search_mycustomfieldalias" name="{$actionid}search_mycustomfieldalias" value="" />
janvl
Power Poster
Power Poster
Posts: 983
Joined: Wed Aug 13, 2008 10:57 am

Re: LISE searchtemplate

Post by janvl »

Thanks again,

i used listit years ago but after the cg-modules are no longer advisable i have changed directorycompany to LISE.
Never used the seachfunction however because with little records there is no need.

regards,
Jan
Post Reply

Return to “Modules/Add-Ons”