PHP events plugin for this?

jh

Member
Hi

For search and presentation reasons I want to combine the content of a few field elements into one field element. I believe this needs to be done via PHP as calc will not work correctly for this.

I have managed to do this successfully via a php list plugin. However as I believe that this requires the code to be run only when the button is selected manually, I have looked for a way to do this automatically. I have tried to use the PHP events plugin (running onpreload) with a similar code however I am not able to get the same results so I think I am doing something wrong. I have checked the wiki and tried various methods but I still can not get it to work.

I have tried the code along the lines of:

$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);

$myQuery->update('object_table')
->set('new_php_test = XX,AA,ZZ');
$myDb->setQuery($myQuery);
$myDb->execute();

where 'XX,AA,ZZ' would be the values of the fields I am trying to get (I have tried various placeholders etc). I would want the label (not raw) values in each case.

Sorry if I have missed something.

Kind Regards
 
In what way does a calc not do it? A classic use of a calc is to concatenate other fields, like ...

Code:
return "{mytable___last_name}, {mytable___first_name}";

... for a 'full_name' element.

-- hugh
 
Hi

For presentation I tried to use a calc but it was not working correctly when I moved the element order in the list. However I have now moved all the elements in a different order and it seems to work fine. Apologies that I had not worked this out.

However for search reasons (joomla search box, not fabrik search box), I wanted to amalgamate some fields as it seems that the search only returns the exact contents of a field - eg. if one search element is 'red' and another 'shirt' it will not return anything if 'red shirt' is entered. I have tried to find a different search setting but was not able to, so I have tried to amalgamate some information into one 'search field'. Hope that makes sense, and if there is another way/easier way of doing this I would be very greatful for your help.

Kind Regards
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top