#1 2013-10-08 09:43:59

leonaze
Member
Registered: 2013-10-08
Posts: 17

[SOLVED] Extend fields in search module

Hi,

Is it possible to use extend fields in <ion:search:results /> ?

I try :

<ion:search:results>
	<ion:result>
		<ion:extend:client>
			<!-- Label of the Extend Field -->
			<ion:label/>
			<!-- Value of the Extend Field -->
			<ion:value />
		</ion:extend:client>
	</ion:result>
</ion:search:results>

But I get : Tag missing: client, scope: search:else:search:results:result:extend

Thanks for the help.

Last edited by leonaze (2014-06-19 11:08:06)

Offline

#2 2013-11-06 16:32:58

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [SOLVED] Extend fields in search module

Sorry, not implemented.
You must adapt the module with your request.


Webmaster / OUF!WEB

Offline

#3 2014-06-07 23:10:10

vinyl
Member
Registered: 2014-03-29
Posts: 45

Re: [SOLVED] Extend fields in search module

You will have to edit "modules/Search/models/search_models.php".

First look for this part under "Search_model" function:

public $article_table =				'article';
public $article_lang_table =		        'article_lang';
public $page_table =				'page';
public $page_lang_table =			'page_lang';
public $parent_table =				'page_article';
public $url_table =					'url';
public $menu_table = 				'menu';

And add the "extend_fields" table (I inserted it under "public $article_table":

public $article_table =				'article';
public $extend_fields =				'extend_fields'
public $article_lang_table =		        'article_lang';
public $page_table =				'page';
public $page_lang_table =			'page_lang';
public $parent_table =				'page_article';
public $url_table =					'url';
public $menu_table = 				'menu';

Then drop down on the page and look for

// Page_Article table
$this->{$this->db_group}->select($this->parent_table.'.*', FALSE);
$this->{$this->db_group}->join(
	$this->parent_table,
	$this->parent_table.'.id_article = ' .$this->table.'.id_article',
	'left'
);

Add the following under that:

// Extend fields table
$this->{$this->db_group}->select('extend_fields.content');
$this->{$this->db_group}->join(
	$this->extend_fields,
	$this->extend_fields.'.id_parent = ' .$this->article_table.'.id_article',
	'left'
);

Now scroll down again until you see:

// Search where
$this->{$this->db_group}->where
(
	'('.
	' article_lang.title LIKE ' . $realm .
	' OR article_lang.subtitle LIKE '. $realm .
	' OR article_lang.content LIKE ' . $realm .
	')'
);

And add the extend_fields.content field in there so the "realm" (your search term) gets matched against that to:

// Search where
$this->{$this->db_group}->where
(
	'('.
	' article_lang.title LIKE ' . $realm .
	' OR article_lang.subtitle LIKE '. $realm .
	' OR article_lang.content LIKE ' . $realm .
	' OR extend_fields.content LIKE ' . $realm .
	')'
);

Done! Now the extend_fields content is also in the search results.

Offline

#4 2014-06-18 09:54:50

leonaze
Member
Registered: 2013-10-08
Posts: 17

Re: [SOLVED] Extend fields in search module

Thanks vinyl,

I will try.

Offline

#5 2015-02-10 07:32:25

ngoc_ionize
Member
Registered: 2015-02-01
Posts: 7

Offline

#6 2015-03-13 04:27:23

ngoc_ionize
Member
Registered: 2015-02-01
Posts: 7

Re: [SOLVED] Extend fields in search module

Help me display element ??

Offline

#7 2016-02-10 05:03:33

fredericomarinho.com
Member
From: Juiz de Fora / Brazil
Registered: 2015-06-08
Posts: 40
Website

Re: [SOLVED] Extend fields in search module

Hello Vinyl!

Thanks for the code!

I did a small change in your code:

// Extend fields table
		$this->{$this->db_group}->select('extend_fields.content as extend_content');
		$this->{$this->db_group}->join(
			$this->extend_fields,
			$this->extend_fields.'.id_parent = ' .$this->article_table.'.id_article',
			'left'
		);

Just rename the field "content" to "extend_content".
Anyway, I am receiving a error:

Tag missing: extend_content, scope:
search:results:count:result.

Can you help me?


Frederico Marinho - Social Media and Web Developer
contato@fredericomarinho.com
fredericomarinho.com

Offline

#8 2016-04-27 05:54:48

ionsitesoft
Member
Registered: 2016-04-27
Posts: 1

Re: [SOLVED] Extend fields in search module

help me show attribute element in search results

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations