Skip to Content Skip to Menu

[SOLVED] Coupon code query field / referring user

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 208
  • Thanks: 27
  • Karma: 0
2 years 1 day ago - 1 year 11 months ago #331241 by fdinkler
I have two related questions regarding Promotions.
I have reviewed the use cases in Chater 8 of the documentation, and they were helpful.

My use case is "Refer a Friend" promotion, where I want to offer a $10 credit to a referring user when a new user signs-up and enters the referring user's Joomla ID on the registration form.

Question 1):  Can a coupon code field (referred to within the Promotion) be dynamically populated at registration time? My thought is to create the unique coupon code by concatenating the new user's Joomla ID with the referring user's Joomla ID.

Question 2):  All of the PUCs are specific to the logged-in user/new user. I need to communicate the generated code to the Referring user, not the Registering/New User.
Suggestions?
Best,
Fred
Last edit: 1 year 11 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: 48419
  • Thanks: 8274
  • Karma: 1443
2 years 1 day ago - 2 years 1 day ago #331242 by krileon
Replied by krileon on topic Coupon code query field / referring user
If it's a flat credit amount I wouldn't use coupon codes at all. Use an always applied promotion and set its conditions to check if the referral field has a value. Then have that coupons value come from a field. The below for example would pull its coupon value from a field AND subtract it once used.

Basic > Promotion Calculation
Promotion Type: Applies to all purchases
The promotion is: A: A fixed amount A from a CB field
CB Field containing amount: cb_referrals
Deduct used amount from CB field once payment is completed: Yes, remove amount from CB field after payment is completed
Conditions
First condition: This condition:
Date A, Field A or Value A: Following CB field
CB Field A: cb_referrals
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 B )

That should cover the promotion aspect. The cb_referrals field would contain how much of a discount they have. So if it's set to 10 they get a $10 discount. I suggest using a number or integer field for this.

Now you just need to add the $10 to the field. You can do that using CB Auto Actions. You said you have a referrer field? If that contains the user id of the user that referred them then you'd just set the Field action to use that field as its User. Now you can easily add $10 to the user that referred them. Another option is to let CB Invites act as your referral system and when an invite is accepted add $10 to the user who sent the invite.


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: 2 years 1 day ago by krileon.

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

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 208
  • Thanks: 27
  • Karma: 0
1 year 11 months ago #331405 by fdinkler
Replied by fdinkler on topic Coupon code query field / referring user
Thanks for the tips, Kyle.
RE:  
Code:
Another option is to let CB Invites act as your referral system and when an invite is accepted add $10 to the user who sent the invite.

Would you use an AutoAction to credit the Inviter's credit field?

Regards,
Fred

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 year 11 months ago #331408 by krileon
Replied by krileon on topic Coupon code query field / referring user
Yes, a Field action in CB Auto Actions should work fine for that. The invites_onInviteAccept trigger is fired when an invite is accepted. It contains the below variables.
Code:
$_PLUGINS->trigger( 'invites_onInviteAccept', array( $row, $code, $user ) );

var1 is the invite object, var2 is the invite code, and var3 is the user accepting the invite. To get the user id of the user who sent the invite you'd use [var1_user_id]. This can be used in the field action to modify the field value of the user who sent the invite.


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.

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 208
  • Thanks: 27
  • Karma: 0
1 year 11 months ago #331411 by fdinkler
Replied by fdinkler on topic Coupon code query field / referring user
Excellent - thanks very much - topic is closed...

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

Moderators: beatnantkrileon
Powered by Kunena Forum