Template dans la version 1.5.6 RC3

6 years 1 month ago #23342 by Chabi01
Hello Georgios (i found your name in the Faq ;) ,

Ok, i try to work using your code... Could you tell me if i'm ok below and show me what is wrong if so ?

I have a checkbox field with 2 checkbox and a radio button with 3 options

Field type : checkbox
Field name : My checkbox
Field name in the database : my_checkbox
Field id : 120
Value of the checkbox : 1=yes 2=no 3=maybe

Field type : radio button
Field name : my_radio_buttons
Field name in the database : my_radiobtn
Field id : 130
Value of the checkbox : 1=present 2=absent 3=precise later


The code i figured out :
// first filter
if ($fields[$f]->name == "my_checkbox" ) {
   ?>
<input type="checkbox" name="filter_120" id="filter_120" value="1" />&nbsp;YES<br />
<input type="checkbox" name="filter_120" id="filter_120" value="2" />&nbsp;NO<br />
<input type="checkbox" name="filter_120" id="filter_120" value="3" />&nbsp;MAYBE<br />
      <?php
} else if(isset($fields[$f]->html)) {
   What is the hmtl code here ? I don't understand what is the proper code here...
} else {
   echo $noplugin;
}
// second filter

if ($fields[$f]->name == "my_radio_buttons" ) {
   ?>
<input type="radio" name="filter_130" id="filter_130" value="1" />&bsp;PRESENT<br />
<input type="radio" name="filter_130" id="filter_130" value="2" />&nbsp;ABSENT<br />
<input type="radio" name="filter_130" id="filter_130" value="3" />&nbsp;PRECISE LATER<br />
      <?php
} else if(isset($fields[$f]->html)) {
   What is the hmtl code here ? I don't understand what is the proper code here...
} else {
   echo $noplugin;
}

//and i continue for every filter ?...

Thanks :)

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

6 years 1 month ago #23363 by ggppdk
It is now clear to be, what you want to achieve

all the names should be
name="filter_120[]"
and not
name="filter_120"

but still this will not work, since currently, FLEXIcontent category (and search view too) filtering does not support multi-valued filters

Also the best way to implement what you need (BUT NOT MULTIVALUE FILTER) would be this:
Duplicate the field you desire
http://www.flexicontent.org/documentati ... ields.html

and then change the function that creates the filter !!!

What you suggest is interesting and useful and i know exactly how to implement for fields: select, selectmultiple, radio, radioimage checkbox

For this feature we would need to
-- change category (and search) model to support multi-valued filters and
-- add parameters to the fields to control filter creation
-- filters will be multi-valued via multi-select form field, or via an array of checkboxes

But this is can not be added to current version (too late) and also it is a days work, that i don't have now (to alter the above fields and the category and search model)

New enhancement issue: 391
http://code.google.com/p/flexicontent/i ... ail?id=391

Regards


-- 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 review. Thanks!

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

6 years 1 month ago #23367 by Chabi01
Thanks Georgios,
I understood the problem to solve.

But if i come back to my example and if i want to have only one choice (even with radio and checkbox), can you tell me what is wrong in my code ?
Thanks again for the time you spend here :)

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

6 years 1 month ago #23371 by ggppdk
you need a single if-elseif-else chain also the name of the fields in the search view is their name and not filter_<id>, the latter is in category view.

ALSO NOTE , for advanced search view the "Advanced Search (in fields)" needs more work, so i cannot be sure it will work, plus don't forget to enable advanced search mode for your custom fields and then recreate the search-index

CODE should be like:
if ($fields[$f]->name == "my_checkbox" ) {  // first CUSTOM field

	?>
	<input type="radio"  name="my_checkbox"  value="1" />&nbsp;YES<br />
	<input type="radio"  name="my_checkbox"  value="2" />&nbsp;NO<br />
	<input type="radio"  name="my_checkbox"  value="3" />&nbsp;MAYBE<br />
	<?php

} else if ($fields[$f]->name == "my_radio_buttons" ) { // second CUSTOM field
	
	?>
	<input type="radio"  name="my_radio_buttons"  value="1" />&nbsp;PRESENT<br />
	<input type="radio"  name="my_radio_buttons"  value="2" />&nbsp;ABSENT<br />
	<input type="radio"  name="my_radio_buttons"  value="3" />&nbsp;PRECISE LATER<br />
	<?php
	
} else if (isset($fields[$f]->html)) {    // all other fields
   echo $fields[$f]->html;

} else {
   echo $noplugin;
}


-- 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 review. Thanks!

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

6 years 1 month ago #23389 by Chabi01
Thanks for this Georgious,
I'm going to try this out :)
Again, thanks for all your valuable answers :)
Best wishes :)

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

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.