Referral program using CBSubs and Virtuemart?

13 years 2 weeks ago #156783 by jbfraser
I have a client that is using CBsubs and Virtuemart. They would like a scenario when a user becomes a member at a certain membership level, it gives them a unique referral code or something similar. That person can then give that code to their friends. If a friend uses that code and becomes a member at a certain membership level, that will "credit" their account. When this happens, the person that gave the referral can then use that credit in the virtuemart store. A basic referral program. Is this possible? I can't figure out how to do it.

Please Log in to join the conversation.

13 years 2 weeks ago #156795 by krileon
CBSubs does not provide any sort of referral system. I suppose you could generate a unique code and add it to a field using CBSubs SQL Actions. Then have a field at registration which users input a referral code. You then check that field with CBSubs SQL Actions and add a respect tick to another field for the referring user. It's very possible, bit complex and some trial and error but certainly possible. Example queries as below.
[cb:if referredby!=""]UPDATE `#__comprofiler` SET `cb_referrals` = ( `cb_referrals` + 1 ) WHERE `cb_referralcode` = '[referredby]'[/cb:if];
UPDATE `#__comprofiler` SET `cb_referralcode` = CONCAT( [user_id], SUBSTR( MD5( RAND() ), 1, 12 ) ) WHERE `id` = [user_id];

The above assumes you have 3 fields: cb_referrals, cb_referralcode, and cb_referredby. Please note the above is UNTESTED, it may require adjustments. Please test thoroughly. You would use the above in the activation field of your plan of CBSubs SQL Actions integration.

Easier approach is to just use PostAffiliatePro or IDevAffiliate which we provide integrations for and are full featured affiliation software.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.189 seconds

Facebook Twitter LinkedIn