Collector 0.4.0 showing all

Si vous n'arrivez pas à configurer le composant pour votre collection...
Being
Messages : 10
Enregistré le : mer. 24 mars 2010 16:24

Collector 0.4.0 showing all

Message par Being »

Hello,
In the front-end when I go to Collector all items are listed. If I search for nothing, all items are listed. How can I stop both please?

Tim

Avatar du membre
steevo
Administrateur du site
Messages : 330
Enregistré le : jeu. 17 déc. 2009 22:59
Contact :

Re: Collector 0.4.0 showing all

Message par steevo »

Hi,

By default, collector display all items.
In the component parameters (or menu item parameters), you can disable the parameter "Show entire listing".

Being
Messages : 10
Enregistré le : mer. 24 mars 2010 16:24

Re: Collector 0.4.0 showing all

Message par Being »

Thanks Steevo,

That fixed it.

Tim

Being
Messages : 10
Enregistré le : mer. 24 mars 2010 16:24

Re: Collector 0.4.0 showing all

Message par Being »

One further question please.

How can I prevent people from searching for any word in an item's fields?

I want them only to be able to search for a specific item id, not date, description etc..

Thanks,

Tim

Avatar du membre
steevo
Administrateur du site
Messages : 330
Enregistré le : jeu. 17 déc. 2009 22:59
Contact :

Re: Collector 0.4.0 showing all

Message par steevo »

The only way for this is to hack code...
If you're using only one collection and just want to search for a specific field, that could be easy.
In the file components/com_collector/models/collection.php
at line 347
replace

Code : Tout sélectionner

foreach ($fields as $field)
		{
			if ( $field->type == 3 )
			{
				$nameFilterCollection = 'filterfield_'.$field->id;
				$valueFilterCollection = $this->_collection->parameters->get( $nameFilterCollection, 0 );
				
				$filter_field = $reset ? $valueFilterCollection : $mainframe->getUserStateFromRequest( $option.'.collection.filter_field_'.$field->id, 'filter_field_'.$field->id, '', 'int' );
				
				if ( $filter_field != '' )
				{
					$this->_search = 1;
					$where .= ' AND v'.$field->id.'.value = "'.$filter_field.'"';
				}
			}
			if ( $search_all_value != '' )
			{
				$this->_search = 1;
				if ( $field->type == 3 )
				{
					$where2[] = 'd'.$field->id.'.content LIKE "%'.$search_all_value.'%"';
				}
				else
				{
					$where2[] = 'v'.$field->id.'.value LIKE "%'.$search_all_value.'%"';
				}
			}
		}
by

Code : Tout sélectionner

foreach ($fields as $field)
		{
			if ( $field->type == 3 )
			{
				$nameFilterCollection = 'filterfield_'.$field->id;
				$valueFilterCollection = $this->_collection->parameters->get( $nameFilterCollection, 0 );
				
				$filter_field = $reset ? $valueFilterCollection : $mainframe->getUserStateFromRequest( $option.'.collection.filter_field_'.$field->id, 'filter_field_'.$field->id, '', 'int' );
				
				if ( $filter_field != '' )
				{
					$this->_search = 1;
					$where .= ' AND v'.$field->id.'.value = "'.$filter_field.'"';
				}
			}
		}
		if ( $search_all_value != '' )
		{
			$this->_search = 1;
			$where2[] = 'vID_OF_YOUR_FIELD.value LIKE "%'.$search_all_value.'%"';
		}
replace ID_OF_YOUR_FIELD (the last line) by the id of the field that you want to search on. You can find it in the list of fields in admin interface.

Being
Messages : 10
Enregistré le : mer. 24 mars 2010 16:24

Re: Collector 0.4.0 showing all

Message par Being »

Thanks ... that's brilliant. Excellent support!

Avatar du membre
steevo
Administrateur du site
Messages : 330
Enregistré le : jeu. 17 déc. 2009 22:59
Contact :

Re: Collector 0.4.0 showing all

Message par steevo »

You're welcome.

Répondre