CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Customize Search Results
Pages: [1]

Author Topic: Customize Search Results  (Read 2879 times)

jimi089

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
Customize Search Results
March 26, 2008, 07:03:20 pm
Greetings,

I've got all my contacts imported and I'm starting to roll.

I want to customize the look of the search results.

Specifically, I would like to start by removing some columns I don't need, such as Status, Address, Country, and Phone. I only want those to show up in the details page.

How can I go about doing this? I don't see anything in the settings to customize which fields appear.

Thanks!

geilhufe

  • I post frequently
  • ***
  • Posts: 293
  • Karma: 33
    • Social Source Software
Re: Customize Search Results
March 26, 2008, 08:08:48 pm
Create a new CiviCRM profile with the columns you want.

Mark it as "search results".

When you do an advanced search, select your search results profile.
Drupal and CiviCRM consulting, strategy and configuration
http://www.social-source.com/

jimi089

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
Re: Customize Search Results
March 26, 2008, 08:21:18 pm
Excellent! That's great, thanks for your help.

How could I set that to be the default search view for say a Group? I want to link to a search that brings up a Groups members, which I can do by clicking on the Members link in the Manage Groups. How can I affect that display?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customize Search Results
March 26, 2008, 10:44:27 pm

There is no easy way to do this. You'll have to customize the template for Manage Groups and send in the additional parameter to specify what "profile id" to use for display. You can just add id=XXX to the url, where XXX = civicrm profile id which you want to use for display

another alternative if you want to make this change for ALL of search is to customize the search template.

http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

You can test for various parameters and make it conditional if you are php/smarty savvy

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jimi089

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
Re: Customize Search Results
March 27, 2008, 08:45:22 am
Thanks for your help Donald.

Are there any example templates out there people have created? I'm new to Smarty and could use a little guidance.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customize Search Results
March 27, 2008, 09:58:36 am

there are tons of smarty templates under our templates/ directory

The smarty documentation is available here: http://smarty.php.net/manual/en/

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jimi089

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
Re: Customize Search Results
March 27, 2008, 11:39:41 am
Yes, I know that there are templates in the directory of the install, but I was speaking more about customized templates so I could see some examples. For example, how to remove a column header - I was able to remove a column on the search but the header still appeared. None of this is clearly documented as an example as far as I can tell.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Customize Search Results
March 27, 2008, 11:56:18 am

No, there are no examples specifically for what you are looking for. This post might help you:

http://forum.civicrm.org/index.php/topic,2805.0.html

All the above is basically smarty syntax, so reading the smarty manual might help

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

thebenedict

  • Guest
Re: Customize Search Results
March 28, 2008, 09:33:33 am
jimi, I'm new to this and have been working on custom profile formatting. You may have seen:

http://forum.civicrm.org/index.php/topic,2573.0.html

which got me started. I'll post some code from view.tpl that I'm using to display contact info, with the caveat that it's *very* amateurish. It makes a beautiful profile display though  ;) I removed some identifying labels because the site's not public yet. There are conditional statements to show e-mail addresses only if the user wants them public.

Code: [Select]
{if ! empty( $row )}
{* wrap in crm-container div so crm styles are used *}
<div id="crm-container" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
<fieldset>
{*<table class="form-layout-compressed">
{foreach from=$row item=value key=name}
 <tr><td class="label">{$name}</td><td class="view-value">{$value}</td></tr>
{/foreach}
</table>*}
<table class="form-layout-compressed">
{assign var=orgname value='Organization Name'}
<tr><td colspan="4"><center><u><h1>{$row.$orgname}</h1></u></center></td></tr>
{assign var=mission value='Mission Statement'}
<tr><td colspan="4"><strong>{$mission}</strong></td></tr>
<tr><td colspan="4">{$row.$mission}</td></tr>
{assign var=orgtype value='Organization Type'}
<tr><td width="15%"><strong>{"Organization Type"}</strong></td>
<td>{$row.$orgtype}</td></tr>
</table>
<p style="background-color:#99CCFF; margin: 0.2em 0em; padding: 0.2em"><strong>Contact Information</strong></p>
<table class="form-layout-compressed">
{assign var=pcontact value='Primary Contact Person'}
{assign var=address value='Street Address'}
{assign var=city value='City'}
{assign var=state value='State'}
{assign var=code value='Postal Code'}
{assign var=country value='Country'}
{assign var=primaryemail value='Primary Email'}
{assign var=displayemail value='Display this Address'}
{assign var=scontact value='Secondary Contact Person'}
{assign var=displaysecemail value='Display Secondary Email'}
{assign var=secondaryemail value='Secondary Email'}
{assign var=phone value='Phone'}
{assign var=fax value='Fax'}
{assign var=website value='Website'}
{assign var=instructions value='Calling/Fax Instructions'}
<tr><td width="20%"><strong>{"Primary Contact"}</strong><br></td>
<td>
{if $row.$pcontact ne ''}
{$row.$pcontact}<br>{/if}
{if $row.$displayemail eq 'Yes'}
{$row.$primaryemail}
{/if}</td>
<td width="20%"><strong>{"Secondary Contact"}</strong><br></td>
<td>
{if $row.$scontact ne ''}
{$row.$scontact}<br>{/if}
{if $row.$displaysecemail eq 'Yes'}
{$row.$secondaryemail}
{/if}</td>
<tr>
<td width="20%" rowspan="4"><strong>{"Address"}</strong></td>
<td rowspan="4">{$row.$address}<br>
{$row.$city}{if $row.$state ne ''}, {$row.$state}{/if} {$row.$code}<br>
{$row.$country}
</td>
<td><strong>{"Website"}</strong></td>
<td>{$row.$website}</td></tr>
<tr>
<td><strong>{"Phone"}</strong></td>
<td>{$row.$phone}</td></tr>
<tr>
<td><strong>{"Fax"}</strong></td>
<td>{$row.$fax}</td></tr>
<tr>
<td><strong>{"Calling/Fax Instructions"}</strong></td>
<td>{$row.$instructions}</td></tr>
</table>

</fieldset>
</div>
{/if}
{* fields array is not empty *}

{literal}
<script type="text/javascript">
function popUp (path)
{
window.open(path,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,screenX=150,screenY=150,top=150,left=150')
}
</script>
{/literal}

jimi089

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
Re: Customize Search Results
March 29, 2008, 08:56:05 pm
Thanks for your help folks.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Customize Search Results

This forum was archived on 2017-11-26.