[SOLVED] plan depending of an active user
- erilam
- OFFLINE
- Posts: 823
- Thanks: 99
- Karma: 22
I'm working on a project where a promotion can be offer for a member if someone of his familly is already a member (and his subscription is active of course).
So my question is how can I set my registrtion form to check this condition ? I think it will be a great thing if I could insert a field (i.e my parent ID) and if the system check in the database if this member is activ or not.
Is there someone who do that or not ?
Thank you by advance for your answers
PS: here are the subscription plan I want to set :
- enterprise (exclusive),
- association(exclusive),
- private individual(exclusive)
-- family (depends on private individual)
Eric Lamy (erix)
www.agerix.fr/
Please Log in or Create an account to join the conversation.
- krileon
- ONLINE
- Posts: 68605
- Thanks: 9108
- Karma: 1434
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.
- erilam
- OFFLINE
- Posts: 823
- Thanks: 99
- Karma: 22
krileon wrote: I suggest creating a field for them to supply username or user id of the family member.
Done
krileon wrote: Then use CB Query Field to query the database to see if that username or user id has an active subscription.
Done
With this query :
krileon wrote: You could then condition that field in a CBSubs Promotion to give them a discount.
Done but it doesn't wok so here are the sreenshot, may be you will see what is wrong (I hope so) :
FireShot Screen Capture #008.png
Condition tab, timing tab and group tab no settings and
Eric Lamy (erix)
www.agerix.fr/
Please Log in or Create an account to join the conversation.
- krileon
- ONLINE
- Posts: 68605
- Thanks: 9108
- Karma: 1434
The above will basically output the subscription id for a user matching the parent field with an active or renewed status.
Once the above is tested working (display it on profile for a user with the parent field correctly set to see if it outputs fine) you'll need to configure your promotion as follows.
Promotion Type: Applies to all purchases
Which plans must be purchased at same time: Your plan
First condition: This condition:
Date A, Field A or Value A: Constant Value or String (CB substitutions can be used)
Value A: [cb:userfield field="YOUR_QUERY_FIELD_NAME" /]
Date B, Field B or Value B: Constant Value or String (CB substitutions can be used)
Value B: 0
Condition 1 (> for Dates): A > B (Value A is larger than Value
All other parameters are assumed left default (except promotional amount of course). This should do the trick.
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.
- erilam
- OFFLINE
- Posts: 823
- Thanks: 99
- Karma: 22
krileon wrote: There's "rn" in your screenshot with your query. Please don't use linebreaks in your query as you could end up with this problem. It also seams the tab or the query plugin isn't published, I only speak English so don't know what that error says specifically when editing the field.
The message said that the field wasn't publish, I change. Thx for rn, I was searching why this prefix was there after registration
krileon wrote: Please try the below query.
Code:SELECT `id` FROM `#__cbsubs_subscriptions` WHERE `user_id` = '[cb_numaderentparent]' AND `status` IN ( 'A', 'R' )
The above will basically output the subscription id for a user matching the parent field with an active or renewed status.
I change to
and it works :
krileon wrote: Once the above is tested working (display it on profile for a user with the parent field correctly set to see if it outputs fine) you'll need to configure your promotion as follows.
Promotion Type: Applies to all purchases
Which plans must be purchased at same time: Your plan
First condition: This condition:
Date A, Field A or Value A: Constant Value or String (CB substitutions can be used)
Value A: [cb:userfield field="YOUR_QUERY_FIELD_NAME" /]
Date B, Field B or Value B: Constant Value or String (CB substitutions can be used)
Value B: 0
Condition 1 (> for Dates): A > B (Value A is larger than Value
All other parameters are assumed left default (except promotional amount of course). This should do the trick.[/quote]
You're the best it works perfectly !!
You are the best !
Eric Lamy (erix)
www.agerix.fr/
Please Log in or Create an account to join the conversation.
- erilam
- OFFLINE
- Posts: 823
- Thanks: 99
- Karma: 22
1) First problem
If I write a false number I have the promotion.
In phpmyadmin a query with a false number send empty
and the condition A>B with A empty and B='false number' give the promotion
2) Second problem
If I don't write anything in the B field I always have the promotion. So I set the default value for the B field to 0 and add a condition like this
Maybe the same problem ?
Eric Lamy (erix)
www.agerix.fr/
Please Log in or Create an account to join the conversation.