Skip to Content Skip to Menu

Counter field for Cbsubs

  • activha
  • activha
  • OFFLINE
  • Posts: 2279
  • Thanks: 113
  • Karma: 13
6 years 6 months ago #298505 by activha
Counter field for Cbsubs was created by activha
Hello

I need your help on a subject regarding CBsubs.

We would like to set up a live counter on our webpage with the number of CBsubs subscribers for paying plans only and for a definite country.

So say that we have paying plan ids 6,10, 11 and 12 and that we want to display the number of active subscribers with an address in France for these plans, what would you suggest ?

We would need something live updated at each new subscriber.

Thanks for the hint
Jean

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68607
  • Thanks: 9108
  • Karma: 1434
6 years 6 months ago #298511 by krileon
Replied by krileon on topic Counter field for Cbsubs
I suppose you could do that with CB Query Field and its Query field then just query for the subscription count to a specific plan and join it with _comprofiler to filter on a country field. You could then display the query field anywhere substitution are supported. The below for example might work.

Code:
SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub LEFT JOIN `#__comprofiler` AS cb ON cb.`user_id` = sub.`user_id` WHERE cb.`cb_subs_inv_address_country` = 'COUNTRY_HERE' AND sub.`status` = 'A' AND sub.`plan_id` = PLAN_ID_HERE


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2279
  • Thanks: 113
  • Karma: 13
6 years 6 months ago #298528 by activha
Replied by activha on topic Counter field for Cbsubs
Thanks

Can we complicate things a little with a drop down list of countries which would display for each country the above count ?
How could we set up things ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68607
  • Thanks: 9108
  • Karma: 1434
6 years 6 months ago #298529 by krileon
Replied by krileon on topic Counter field for Cbsubs
You'd have to use a Code field for that and completely code that usage. I suppose you'd just grab all the counts, place them in an array, then use JS to show/hide the relevant count based off the dropdown value. Sorry, but that's beyond me being able to provide you a simple example.


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2279
  • Thanks: 113
  • Karma: 13
6 years 6 months ago #298530 by activha
Replied by activha on topic Counter field for Cbsubs
Ok thanks

One question : is it better to use cb_subs_inv_address_country instead of cb_country ?
Seems like lots of subscribers did not fill the cb_subs_inv_address_country but are required to fill cb_country on registration

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 68607
  • Thanks: 9108
  • Karma: 1434
6 years 6 months ago #298532 by krileon
Replied by krileon on topic Counter field for Cbsubs

One question : is it better to use cb_subs_inv_address_country instead of cb_country ?

cb_subs_inv_address_country is where CBSubs stores the users country, but only if they subscribed to something and completed the invoice address fields. I assume cb_country is your CB field. I suppose it doesn't particularly matter depending on how your site is setup.

Seems like lots of subscribers did not fill the cb_subs_inv_address_country but are required to fill cb_country on registration

In that case I suggest just using cb_country.


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

Facebook Twitter LinkedIn