Jump to content

Get pages by multilanguage <option> value/title


xxxlogiatxxx
 Share

Recommended Posts

Is there any ideas how to find pages by it's translated value of Select Options field title?

For example i want to get pages in current language by some option title:

Default:

1=Precious
2=Semi-precious

Italian:

1=Preziosa
2=Semipreziosa

No idea why italian version returned me empty results.

$type = $sanitizer->text($input->get->type);
$input->whitelist('type', $type);

if($type) {
	$results = $pages->find("template=encyclopedia-item, encyclopedia_item_type.title={$type}, limit=5, sort=title");
}
else {
	$results = $pages->find("template=encyclopedia-item, limit=5, sort=title");
}

foreach($results as $result) {
	echo $result->title;
}

$data contain value Precious/Preziosa

Link to comment
Share on other sites

Not 100% sure, as I do not work with options fields, but if you want to search for title values other the default language, you need to add the ID of that language to the fieldname. As example, if your italian language would have the ID 1020, you would have to query for:

encyclopedia_item_type.title1020={$type}

see: 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...