Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

where would i replace for cb query multiselect optgroup?

8 years 7 months ago #279310 by uperformro
Hello!

Had to pull some data out of a K2 extra_fields, which stores the JSON data like "Pite\u0219ti" instead of "Pitești" (the \u0219 is the "ș" letter).


I've had a look through the cbqueryfield.php, but I don't really see where/how I'd do a str_replace to get those dumb \u0xxx translated to the proper diacriticals.

The data, as you can see, is being used for the optgroup, as:

<optgroup label="Pite\u0219ti" id="cb_studiouritot____cbf26">
<option value="beauty-chat-studio" id="cb_studiouritot____cbf27">Beauty Chat Studio</option>
<option value="black-orchid-studio" id="cb_studiouritot____cbf28">Black Orchid Studio</option>
<option value="black-buc" id="cb_studiouritot____cbf29">Black Studio (București)</option>
<option value="black-tm" id="cb_studiouritot____cbf30">Black Studio (Târgu Mureș)</option>
</optgroup>

Just need to know how/where to edit the CB Query php or js to slot in something to replace those \u0xxx codes.

Thanks!

Maria
Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279339 by krileon
K2 stores the extra field select options as a JSON encoded string. CB Query Field isn't really designed to handle that scenario. You're better off using CB Code Field where you can generate a select fields options using raw PHP. Your PHP would use K2 API or query for that row directly and parse the JSON out properly.

Also worth noting we do not support core edits and can not advise you regarding them beyond file locations.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

8 years 7 months ago #279356 by uperformro
Oh good point. I'll look at the CB Code ... did a very messy query in the meantime as a band-aid. Couldn't get a unicode-to-UTF function to do anything, so did a series of REPLACE()s. Eh, it works.

Thanks!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279382 by krileon
Believe K2 has API for specifically grabbing extra fields. You'll need to consult with K2 or review API documentation if available for such usage, but should make building the list significantly easier.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

Moderators: beatnantkrileon
Powered by Kunena Forum