FC version 2.2.0 and filters [SOLVED]

More
9 years 7 months ago #53417 by tevez15
Hello

I have a issue, I update my joomla from 1.5 to 3, and update flexicontent too. I follow the steps, no problem to there.

The issue comes last week, when I create a new article, use relation field, associate to others, and when I filter, this new items dont show on results.

I send to you, a piece of code to use on relations field, to be filtrable.

The old items are ok, the new one, do not filter.

Any ideas?

PS: I found the possible problem (Attachment). The relation add item:cat, so he cant find on category

PS2: I dont want add this :cat on the value. How I can change this? (This solution is only for this project) :D


PS3: the possible solution for this problem,without change much code, is in mysql, add :catid, and in relation.php, add some line of code, to create a same value as have in BD
Code:
function onDisplayFilter(&$filter, $value='', $formName='adminForm', $isSearchView=0) { if ( !in_array($filter->field_type, self::$field_types) ) return; // some parameter shortcuts $db = JFactory::getDBO(); $field_elements= 'SELECT DISTINCT id as value, title as text' .' FROM #__content as i' .' LEFT JOIN #__flexicontent_fields_item_relations as fir ON i.id=fir.value' .' WHERE fir.field_id='.$filter->id.' Order by text ASC' ; $query = preg_match('#^select#i', $field_elements) ? $field_elements : ''; $db->setQuery($query); $results = $db->loadObjectList(); $catId = 'SELECT catid' .' FROM #__flexicontent_cats_item_relations' .' WHERE itemid='.$results[0]->value; $db->setQuery($catId); $theCategory = $db->loadObjectList(); /*echo "<pre>"; print_r($theCategory[0]->catid); echo "</pre>";*/ if (!$results) { $filter->html = ''; } else { $options = array(); $options[] = JHTML::_('select.option', '', '-'.JText::_('FLEXI_SEARCH_ANY').'-'); foreach($results as $result) { $options[] = JHTML::_('select.option', $result->value.':'.$theCategory[0]->catid, $result->text); } //$filter->html = JHTML::_('select.genericlist', $options, 'filter_'.$filter->id, 'onchange="document.getElementById(\'adminForm\').submit();"', 'value', 'text', $value); $filter->html = JHTML::_('select.genericlist', $options, 'filter_'.$filter->id, 'onchange="document.getElementById(\'adminForm\').submit();"', 'value', 'text', $value); } }

For every field:
Code:
SELECT * FROM `j25_flexicontent_fields_item_relations` WHERE field_id=28 UPDATE `j25_flexicontent_fields_item_relations` SET `value`= CONCAT(value,':35') WHERE field_id=28 UPDATE `j25_flexicontent_fields_item_relations` SET value = SUBSTRING_INDEX(value, ':35', 2) WHERE field_id=28
Attachments:

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #53440 by ggppdk
Hello

please install v3 BETA5a and retry (note fancybox loading is broken, use multibox instead)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #53458 by tevez15
I dont know why, but in beta, he dont show me the correct values.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.461 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline