Articles Field

issue with JA Mega Filter

3 months 4 hours ago #90883

Sergio Di Mare's Avatar Sergio Di Mare

I try your module with JA Mega Filter
www.joomlart.com/joomla/extensions/ja-megafilter-for-joomla

The id of the article appears in the form and not the title of the article.
Can this thing be fixed?
Thank you

3 months 4 hours ago #90885

Peter van Westen's Avatar Peter van Westen Admin

This seems to be more of a JA Mega Filter issue. You should ask them about this, as they are overriding the way Articles Field outputs the field.

2 months 4 weeks ago #90898

Andrea Malalana's Avatar Andrea Malalana Moderator

Currently they don't support Articles Field, they just output the value stored in the database. It would be cool if they added support for Articles Field. But lucky you, for now we have an override code for this...

In plugins/jamegafilter/content/helper.php

Find:

default :
$fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($field->value));
$fdata['ct'.$field->id]['frontend_value'][] = $field->value;
break;

Before that, add this:
// Case for Regular Labs Articles Field
case 'articles':

	$article_id = $field->value;

	$query = $this->_db->getQuery(true)
		->select(['a.title','a.alias'])
		->from($this->_db->quoteName('#__content', 'a'))
		->where('a.id = ' . (int) $article_id);
	$this->_db->setQuery($query);

	$item = $this->_db->loadObject();

	// Use Alias as Value (for URLs)
	$fdata['ct' . $field->id]['value'][] = str_replace('+', '%20', urlencode($item->alias));

	// Use Title as Frontend Value
	$fdata['ct' . $field->id]['frontend_value'][] = html_entity_decode($item->title);

	break;

After doing this, you will have to Re-Index your Megafilter.

Let us know if it works 🙂

Also, this code change will be lost when you update to a new version of JA Megafilter, so you will have to re-do it after updating.

2 months 4 weeks ago #90915

Sergio Di Mare's Avatar Sergio Di Mare

Yes, it works. 👍
It would be nice if it were integrated into Megamenu so you can make updates without worries ...
Thanks

2 months 4 weeks ago #90916

Andrea Malalana's Avatar Andrea Malalana Moderator

You can ask them to integrate it and see what they say 🙂

We already have the code ready too!