Jump to content
xxxlogiatxxx

Get pages by multilanguage <option> value/title

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

Share this post


Link to post
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: 

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...