[SOLVED] How filter a dropdown element in the plug-Fabrik content

Status
Not open for further replies.

galo2015

New Member
Joomla 3.4 - Fabrik 3.3

registro_usuarios___sector2 my element type dropdown. (multiple choice yes)


...
...
...

$sc = $_GET [___ sector_comercial];

if (!empty ($sc)) {
if (count ($sc, 1) == 1) {$sector_comercial = $sc;} else {$sector_comercial = implode (',', $sc[value]);}
}
...

$order = '{fabrik view=list id=46 layout=visual1';

$order. = ' registro_usuarios___sector2_raw[value]='. $sector_comercial. 'registro_usuarios___sector2_raw[condition] = IN ';

$order= $order.'}';


echo $ order;
...
...

This does not work ....
 
Is it working if you are using a "hardcoded" string?

At least there must be a space ...$sector_comercial. ' registro_usuarios___sector2_raw[condition] = IN ';
 
At least there must be a space ...$sector_comercial. ' registro_usuarios___sector2_raw[condition] = IN '; Ok
Is it working if you are using a "hardcoded" string? No
 
Sorry for my English.

registro_usuarios___sector2 my element type dropdown. (multiple choice yes)
12 aaaaa 15 bbbbb 18 cccc 21 eeee
registro_usuarios___sector my element type databasejoin

registro_usuarios___sector2_raw // it stores data ... ['98','74','123',....]
registro_usuarios___sector_raw // it stores data .... 98


in joomla article with sourcerer plugin
....
$sc = $_GET [___ sector_comercial];
if (!empty ($sc)) {if (count ($sc, 1) == 1) {$sector_comercial = $sc;} else {$sector_comercial = implode (',', $sc[value]);}}
$order = '{fabrik view=list id=46 layout=visual1';
$order. = ' registro_usuarios___sector2_raw[value]='. $sector_comercial. ' registro_usuarios___sector2_raw[condition]=IN } ';
echo $ order; //This does not work ....
....
....
$sc = $_GET [___ sector_comercial];
if (!empty ($sc)) {if (count ($sc, 1) == 1) {$sector_comercial = $sc;} else {$sector_comercial = implode (',', $sc[value]);}}
$order = '{fabrik view=list id=46 layout=visual1';
$order. = ' registro_usuarios___sector_raw[value]='. $sector_comercial. ' registro_usuarios___sector_raw[condition]=IN } ';
echo $order; // This works OK
....
 
Yup I can see the issue here it should be fixed with this commit
https://github.com/Fabrik/fabrik/commit/16ff651ea63fec883058f7ba9d45052ff5c7e643

In additional there are a couple of issues with your PHP
Code:
$sc = $_GET [___ sector_comercial];

should be

PHP:
$sc = $_GET ['___ sector_comercial'];

and are you sure you want to do:

PHP:
count ($sc, 1)

the 1 here means to recursively count the array. I think you are incorrectly presuming it supplies a default value.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top