Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

[SOLVED] Configuring a Country field with CB Query field plugin

  • mz
  • mz
  • OFFLINE
  • Posts: 34
  • Thanks: 4
  • Karma: 0
6 years 9 months ago - 6 years 9 months ago #301887 by mz
Hi,

I have made a field function similar to the continent/country case explained in Configuring a Country field with CB Query field plugin
Nice feature.

I have made the specific field searchable in the list view. Would it be possible to make the setup in a way that we can select the continent and then have all countries within filtered in the search?
As it is now I have to multiselect all contries within the specific continent...

In my case I have used the field option - dropdown multiselect.

Thanks.
Last edit: 6 years 9 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
6 years 9 months ago - 6 years 9 months ago #301897 by krileon

I have made the specific field searchable in the list view. Would it be possible to make the setup in a way that we can select the continent and then have all countries within filtered in the search?

Only way to do that is use 2 separate fields. 1 for continent and 1 for countries on that continent. You'd update the countries field using CB Core Fields Ajax and its Update On functionality.


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.
Last edit: 6 years 9 months ago by krileon.

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

  • mz
  • mz
  • OFFLINE
  • Posts: 34
  • Thanks: 4
  • Karma: 0
6 years 9 months ago #301934 by mz
Hi Kyle,

Thanks. Sorry but I am still bit green in this. I understand the 2 field need and the function but can you please help me clarifying the following:

Field 1 - continents: I am trying to use a "normal" dropdown multiselect field type. In here I use the continents as values
Field 2 - countries: I am trying to use the Query dropdown multiselect field type. In here I select it to "update on functionalty" from Field 1. I am Still using Parameter Query and make select from db columns.
How do I match the 2 fields and set this up correct to make it function?

FYI - I have made 2 columns in the database. To make the query "continent/country" function work I have entered the specific continent in all rows that matches the country, ok.

I have another issue as well. I noticed that there was a mess in my "country" order when published in cb from the database. The order looks ok in the database. After a lot of list adjustments I discoved that a total of 198 "countries" within one continent is ok but adding more "countries" to the same continent breaks the order. When adding further countries under the same continent they are now published in the start of the list under the specfic continent. It looks fine in the db and are structured/sorted according to a unique id.
Is the max 198? Can you help me here?

Thanks.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
6 years 9 months ago #301960 by krileon

Field 2 - countries: I am trying to use the Query dropdown multiselect field type. In here I select it to "update on functionalty" from Field 1. I am Still using Parameter Query and make select from db columns.
How do I match the 2 fields and set this up correct to make it function?

Your country field should include in its query a check against the continent field. Example query as follows. Use the Update On functionality provided by CB Core Fields Ajax as the Update On in CB Query Field is deprecated and will be removed in a later release.

Code:
SELECT `country_code`, `country_name` FROM `#__countries` WHERE `continent` = '[cb_continent]'

I have another issue as well. I noticed that there was a mess in my "country" order when published in cb from the database. The order looks ok in the database. After a lot of list adjustments I discoved that a total of 198 "countries" within one continent is ok but adding more "countries" to the same continent breaks the order. When adding further countries under the same continent they are now published in the start of the list under the specfic continent. It looks fine in the db and are structured/sorted according to a unique id.
Is the max 198? Can you help me here?

Use ORDER BY clause in your query to determine how to order them. See the below if you're not familiar with SQL SELECT syntax.

dev.mysql.com/doc/refman/5.6/en/select.html


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.

  • mz
  • mz
  • OFFLINE
  • Posts: 34
  • Thanks: 4
  • Karma: 0
6 years 9 months ago #301990 by mz
Hi again,

Thanks. I am now using a two field option, ok.

1. Is it correct that I cannot multiselect on the field I check against for the Update On functionality? It only updates on single select...

2. Update On functionality: I have used field type - Query Drop Down (Multi-select). In this I write the query under the Parameters tab / Query Tab. I also use the update on functionality on the same tab. This works well! Not sure if you refer to the CB Query Field on the Integrations tab as the one I cannot use?

3. I copied your query example from below, thanks. Strangly when I used the: FROM `#__countries` did not work (table doesn´t exist), had to write FROM `countries` to make it work?

4. Order by: I was already using the ORDER BY clause. I was using it one the continents and the continents are ordered perfectly. Problem was/is that the "countries" (240 units) was mixed up under one continent. Continents was ordered alfabeticle and the countries numeric. Max. 198 "countries" was ordered ok. Everything above that count was messed up. Now I choose to ORDER BY "countries" and that works.

Thanks.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
6 years 9 months ago #302003 by krileon

1. Is it correct that I cannot multiselect on the field I check against for the Update On functionality? It only updates on single select...

You can, but your database query needs to handle that. The below should work for example by converting the |*| delimitered multi-select to something SQL can understand.

Code:
SELECT `country_code`, `country_name` FROM `#__countries` WHERE FIND_IN_SET( `continent`, REPLACE( '[cb_continent]', '|*|', ',' ) ) > 0

2. Update On functionality: I have used field type - Query Drop Down (Multi-select). In this I write the query under the Parameters tab / Query Tab. I also use the update on functionality on the same tab. This works well! Not sure if you refer to the CB Query Field on the Integrations tab as the one I cannot use?

Install CB Core Fields Ajax and use its Update On functionality. It's a much more compatible and advanced update on usage than what's included with CB Query Field, which was the first attempt at implementing something like this and will eventually be completely removed as it's replaced by the functionality in CB Core Fields Ajax.

3. I copied your query example from below, thanks. Strangly when I used the: FROM `#__countries` did not work (table doesn´t exist), had to write FROM `countries` to make it work?

It's just an example. I've no idea what your database structure is and you'll need to adjust it as necessary. #__ will be replaced by your Joomla table prefix. If your countries table is prefixed like your other tables then remove #__ as needed.


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