I am working on my unilevel multi level marketing.
Now I can successfully referred users and show them as below:
My Levels
Level 1 = member referred by me Level 2 = member referred by my level 1 user Level 3 = member referred by my level 2 user Leve 4 = member referred by my level 3 user
My Problem is If Any of of the user under "Level 4" referred a New Member
It will look like this.
::Level 1:: ::Level 2:: ::Level 3:: ::Level 4::
- user_1 - user_2 - user_3 - user_4
And if "user_4" under Level 4 referred a new member..
I need to give 100 reward bonus the user_3, user_2, and user_1.
Note: The only user that will receive the bonus reward is the users who referred the user from level 4 to level 2.
user_1 referred user_2, user_2 referred user_3 and user_3 referred user_4
so the user_3 down to user_1 will receive the bonus reward...
You can store upline levels in your user table, too. During registration you grab upline, then upline of upline, etc so that later you can get them when querying the user table.
I do this 6 levels deep so it is 6 more queries but I don't really care, registering doesn't happen a million times a day.
Here's my user table from my traffic exchange ... hope it helps. As you can see I also use an upline_val column to store surf credits which can later be claimed by their uplines with a button "claim credits from referrals".
and register model code to create member:
That's about all I can do I guess.