filter/ linkk

isiway

Member
Hello,

in a list with a filter of about 5 elements I would like to have link with params to a contact-form at the end of EACH row "Contact" showing
the current id of the row (that I can manage) andthe elements and the values of the filter (so that we know what the customer was searching for).

How can I access the currently chosen filters and send them via the url? Can I also send them via GET?

There is a post about this loading the model but it is not working, the filter is "hanging".

Thank you!

Carola
 
Accessing them in the custom url with a prefilter might not be possible.
However, the filters are stored in the session, so you should be able to get them from the session via php and put them in a hidden field with this eval = ye, and a default of:

Code:
$listid = 8; // Replace this with your first list's id
$app = JFactory::getApplication();
 
// Get the lists filters
$key = 'com_fabrik.list8_com_fabrik_' . $listid . '.filter';
$sessionfilters = JArrayHelper::fromObject($app->getUserState($key));
 
// Out put each filter's label and value
$str = array();
 
for ($i = 0; $i < count($sessionfilters['label']); $i++)
{
  $str[] = $sessionfilters['label'][$i] . ' = ' . $sessionfilters['value'][$i];
}
 
return implode("\n", $str);
 
Hi Rob,

I dont understand what exactly I have to do. Put the php is the list definition? Define another element?
And how to I get access to the element (in my default.php of the list view).

I hope you can help me with a little more detailed instructions.

Thank you!
Carola
 
If I got Rob right:
create a new element, type = field, hidden=yes, eval=yes and put the code into the "default" section.
 
correct Troester - that is exactly what I meant, except I didn't type it as well as you :)
 
Hi there,

I am very frustrated. Nothing happens.

I added an element "hidden_data_filter1" to my list with the id 28 and I filled out as you said.
What is with the other params in list/ filter? Any combinations dont work...:(

Even if I put in the eval areathe simple code
$test="aaa";
return($test);

nothing happens.

Isn't the eval function just for forms and not to pre-populate a filter or an element shown in the list?

Again I am using the fabrik list module linked to list 28. For test reasons I even added the element in the list module to see what is in there.
Shouldn't there the result of the simple eval be shown? So "aaa" in that column?
Even if it works is your code right with $listid=28 and the row $key = 'com_fabrik.list8_com_fabrik_' . $listid . '.filter';
Should the "8" be also "28" then or is it right like this?

Anyway as long it doesn't even show the simple eval in my list something must be totally wrong?
And if it shows how can I read the data of it in the list-template for showing parts of it in a link, in which variable will it be?

Thanks,
Carola
 

Attachments

  • fabrik_sc1.png
    fabrik_sc1.png
    259.2 KB · Views: 454
yes sorry, poor advice on my part.
Instead try putting it in a calculation element and setting "Only Calc on Save" to "No", that should then run the code for each row that is rendered.
 
Hi Rob,
I set up my site / access for you under my sites as you proposed and provided all data there in the note.
Hope to here from you soon!

Thanks, Carola
 
sorry I've looked, I don't see an element called 'hidden_data_filter1' -which element (name and id) is the calculation on?
 
Hello Rob,
Hugh told me that you would take care of the problem.
I get a message that our silver support will expire soon again but since we prolonged the support I havent got an answer to our problem.
Please let me know what we can do to assist you to solve the problem or if you maybe cant solve the problem at all.
All relevant data incl. the data to the private access to our system you will find in our last email conversations (that was because the login was not possible although the support was prolonged)

Please answer asap.

Thank you and kind regards,
Carola
 
I've left a msg for Rob to forward me the emails you are referring to. I'll take a look as soon as he responds. Unless you can update your My Sites to include that info before then.

-- hugh
 
OK, I did exactly what Rob told you to do - made that 'hidden_data_field1' a calc element, and changed the 8 to 28. As you can see on your list, that is now setting the value of the calc to the filters being used.

The only real issue is that it is giving you the "raw" values for any filters which are joins, i.e. the foreign key value ('1') rather than the label ('ABS'). Which is what the search filters submit (the label of a 'select' dropdown in HTML forms is not submitted, only the value), and what we filter on.

I'm assuming you would prefer this to be the label? I'm looking now at how tough that would be to do. It probably won't be trivial, as we simply don't have that information at the point the row data is being built. This custom code would probably have to do table lookups, to get the label from the joined table for that row.

Anyway, some progress.

-- hugh
 
OK, I think the next step needs to be building the contact form.

Thinking about it, it would probably be easier to leave the filter data we're picking up in the calc element as "raw", and build the contact form so it has elements which match the ones you are searching for on the list.

So, where the main list has (say) a join for auswahl_mat1, we'd set up a matching element of the same name in your contact form.

Then in the calc element, instead of returning a simple comma separated list like I'm currently doing:

Code:
Material 1* = 1,Material 2* = 2

... is build an actual URL / link, with the matching element names for the contact form:

Code:
test

... where 'origid' would be a join element on your contact form pointing to the main list, and the others would be the matching joins described above.

That way, the calc would itself be the link you click to go to the contact form, and the query string args would pre-fill the appropriate elements on the contact form. Those elements could all be hidden, so all that shows is a simple "message" textarea (or whatever) for the contact message itself.

So ... if you could start building that contact form (assuming you understand what I'm getting at!) I can wait till you have it underway, then start experimenting building the links to it.

-- hugh
 
Hmmm, for some reason it won't let me post with the example URL I'm trying to show you.

So just ask for clarification if you need it. Main point is, in the contact form, create (hidden) join elements that match the ones you are filtering for on the main table, with the same name and same settings. Plus a join back to the main table.

-- hugh
 
Hi Hugh,

thanks for setting my account up again!

I understood mainly what you are saying BUT
I cant see the "raw" params you are talking about. So I chose on the page (which is in my private data and which I dont wont to be published here)
  • ABS and ALU (mat1 and mat2)
  • Erweichungspunkt 70-100 (which is in more options, Variable ep)
  • got the result list
but the email link on the right side of each row doesnt show the params?
It still shows f.e. the dummys fields for mat1 and mat2 and empty values for the other elements of the search form:

http://..../index.php?option=com_rsform&formId=5&lang=de&ksnr=&lf=&ep=&az=&mat1=Material1&mat2=Material2&oz=&vis=

If it did I could take it from there...

Thank you and kind regards,
Carola

 
Ah, I didn't know you were using RS Forms for the contact form. I have no clue how to build links for that.

Can you not use Fabrik to build the contact form?

-- hugh
 
Hello Hugh,

you dont have to know rsforms, that is not what I need.

Just display the 9 chosen filter params (Material1, Material 2, Klebstoffbasis ....) at the end of each row in the results, you can mass up the display, no problem, it is our test system (or display them all at the end of the screen.

It is in the template ...components\com_fabrik\views\list\tmpl\bue_klebstoffberater\default_row.php or just display the params at the end of the screen...

When I activate in default_row.php your
<?php
//echo $_POST['fabrik___filter[list_28_mod_fabrik_list_416][value][0]'];
?>

I see a mass of data, but still dont know how I get the filter elements...

Thank you much,
Carola


I still dont know how to get them
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top