Custom sql query for getting values of a checkbox field

More
9 years 3 months ago #52175 by rafah
This is my sql query.

SELECT attribs FROM `xrlwc_flexicontent_fields` WHERE id=17


Then result is

{"display_label":"1","show_acc_msg":"0","no_acc_msg":"","sql_mode":"0","field_elements":"1::Hair Salon%% 2::Unisex Salon%% 3::Spa Service%% 4::Skin care%%5::Hair Colouring%% 6::Manicure & Pedicure%%7::Foot massage%%8::Gym Service%%9::Luxury Spa%%","text_or_value":"1","display_all":"0","trigger_onprepare_content":"0","remove_space":"0","pretext":" ","posttext":":","separatorf":"5","opentag":"Category-","closetag":"","ns_pretext":"","ns_posttext":"","default_values":"","required":"0","pretext_form":"","posttext_form":"","separator":"0","opentag_form":"","closetag_form":"","max_values":"0","min_values":"0","exact_values":"0","filter_customize_options":"0","filter_custom_options":"SELECT value, value as text FROM #__flexicontent_fields_item_relations WHERE field_id='{field_id}' AND value != '' GROUP BY value","filter_default_value":"","filter_usefirstoption":"1","filter_firstoptiontext":"FLEXI_ALL","filter_compare_type":"0","filter_values_require_all":"0","filter_values_require_all_tip":"0","display_label_filter":"2","display_filter_as":"4","faceted_filter":"2","show_matching_items":"1","hide_disabled_values":"0","display_label_filter_s":"2","display_filter_as_s":"0","faceted_filter_s":"2","show_matching_items_s":"1","hide_disabled_values_s":"0"}


How to get only text values from this?

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

More
9 years 3 months ago #52186 by ggppdk
Hello

attribs is not the value of the field

it is the parameters


you should use "value" column


-- 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 3 months ago #52190 by rafah
Hi,

Then how to get the predefined values of this checkbox field.All value to text relations?

value column is present in xrlwc_flexicontent_fields_item_relations.Here only the number value is present.How to get its corresponding text?

when I use this query,I get only numbers
SELECT value as text FROM `xrlwc_flexicontent_fields_item_relations` where field_id=17 and item_id=1.

how to do this?please help me

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

More
9 years 3 months ago #52194 by ggppdk
Hello


the easiest way is to use FLEXIcontent helper functions


-- but first tell where do you need this ?

1. is it inside a FLEXIcontent component view (item view, category view, search view, etc ?)

2. is it inside any Joomla view ?

3. is it inside some custom script that does not load Joomla Framework ?



-- the Field configuration is in 1 table:
_flexicontent_fields


-- and the values are inside:
_flexicontent_fields_item_relations



you can use this:
www.flexicontent.org/documentation/faq/ ... -code.html


then you can use this for parameters:
$p = $item->fields->parameters->get('VARIABLE');




and this for values:
$field_id = 19;

// Use in ITEM view
$fvals = $item->fieldvalues[$field_id]; // or use $this->item


// Use in CATEGORY view (and in category layouts: author, mcat, myitems)
$fvals = $items[$i]->fieldvalues[$field_id]; // or use $item

if (!empty($fvals)) foreach ($fvals as $v) {
if ( @unserialize($v)!== false || $v=== 'b:0;' ) $v = unserialize($v);
var_dump($v);
}


-- 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.269 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