Skip to Content Skip to Menu

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

Conditional substitutions

  • austega
  • austega
  • OFFLINE
  • Posts: 94
  • Thanks: 0
  • Karma: 1
11 years 1 month ago #234314 by austega
Conditional substitutions was created by austega
I am having a problem getting a conditional substitution to work despite spending some time trying to unravel the tutorial .

In the CBS Invoice I am using

NOTE: The current status of this payment is <[PAYMENT_STATUS]>[cb:if [DATE_PAID]!=""] and the payment date was <[DATE_PAID]>[/cb:if].

and wanting the second part to only appear if there is a value in the DATE_PAID field. Currently it fails to appear even when the payment has been completed. (Without the if code it appears all the time.)

I have tried a number of combinations without success. I have looked at the database Baskets table and am guessing that the underlying field is the payment_date field which can be null.

Guidance sought.

J2.5.14, CB1.9, CBS 3.0.0

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago #234330 by krileon
Replied by krileon on topic Conditional substitutions
If it worked it'd be as follows, but I don't think you can use the CBSubs substitutions in an IF statement. They're for information display.

[cb:if DATE_PAID!=""]Content here.[/cb:if]

Please see the below tutorial for further substitution usage information. There are IF usage examples at the bottom.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


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.

  • austega
  • austega
  • OFFLINE
  • Posts: 94
  • Thanks: 0
  • Karma: 1
11 years 1 month ago #234383 by austega
Replied by austega on topic Conditional substitutions
Thanks Kyle, but can confirm this did not work in the IF statement.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago #234402 by krileon
Replied by krileon on topic Conditional substitutions
Yup, they're for display purposes only. If you want to condition such information you'll need to first query for it using a CB Query Field then try and condition the query field. We've plans to improve the substitution API so it'll be easier to add new values to it so things like this can be possible, but for now CB Query Field is probably the only way to do it for now.


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.

  • austega
  • austega
  • OFFLINE
  • Posts: 94
  • Thanks: 0
  • Karma: 1
11 years 1 month ago #234477 by austega
Replied by austega on topic Conditional substitutions
Thanks Kyle.

I think in my case the Query field option gets very messy given that each user might have many payments (each with a different DATE_PAID) so an open-ended number of Query fields would need to be created. And then there would need to be a conditional choice of the correct Query field to display in each Invoice.

I look forward to the next version of the substitution API. :)

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago #234497 by krileon
Replied by krileon on topic Conditional substitutions

I think in my case the Query field option gets very messy given that each user might have many payments (each with a different DATE_PAID) so an open-ended number of Query fields would need to be created. And then there would need to be a conditional choice of the correct Query field to display in each Invoice.

You only need the latest payment date so you won't need to grab every payment, but you probably would need a field per plan.

I look forward to the next version of the substitution API.

This isn't happening until way later. Like CB 2.0 later. So I would not wait for it and simply implement a workaround if this is needed now. Improved substitutions will not be in 1.10.0.


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