Promotional discount amount calculated using cb field

6 years 11 months ago #293574 by osmodels
Hi

We have a sponsored subscription plan wherein a corporate sponsors the membership of "n" number of individuals.

I am capturing the number of individuals enrolled in the plan using a Radio field. I want to use this field value in the CB Promotions, using a negative discount add the additional fee per member.

Currently I am using hard-coded values in the Radio button field. For eg if the user selects 6 members an amount of 2000 is added, if he selects 7 then 4000 is added etc.. In promotions I am using the option fixed amount from CB field.

Now the data from the field stored in the DB is the amount, using which is not very meaningful for the client. I would like to use the value of 6 itself and use promotions to calculate the amount.

In promotions I noticed another option "Fixed Amount". On selecting this a field "Fixed Discount Amount in currency above" was displayed. In the info tooltip, I read Cb field substitutions can be used here.

I was wondering if I could substitute the calculation here. Eg. could I enter " ([cb_field] - 5) * 2000 " in this field. Will this calculation be accepted? If so, it would greatly help me.

Thanks

Please Log in to join the conversation.

6 years 11 months ago - 6 years 11 months ago #293585 by krileon
You're needing to do an actual math operation which it can not do. Best I can suggest is use CB Query Field and do your calculations using SQL then substitute in the query field. Example CB Query Field usage as follows.

SELECT ( ( `FIELD_NAME` - 5 ) * 2000  ) FROM `#__comprofiler` WHERE `id` = '[user_id]'


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.
The following user(s) said Thank You: osmodels

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.176 seconds

Facebook Twitter LinkedIn