Hello sitepoint!
It’s been a while since I’ve been on here - and in the past this was always a great place to come from time to time when I hit a wall; That’s what brings me back here now ---- hit a wall while working on a Script I’m configuring for a Website that functions as an evolving community for a sales organization - There are leadership ranks that are achieved by referrals - customer acquisition goals; and overall team production. I’ve got the first half of the script done, which can accurately read whether or not a team member is ranked as a ‘customer’, or a ‘team member’ - but now I need this script to determine the remaining leadership ranks —
Here’s what I have so Far
//define each level arrarys
$freelevel = array('IboToolBox'=>$row_rankingspage['ibotoolbox_jid'],'Netspend'=>$row_rankingspage['netspend_idnum'],'ImFacePlate'=>$row_rankingspage['imfaceuser'],'BigCrumbs'=>$row_rankingspage['bigcrumbs_username'],);
$bonuslevel = array('Amazon'=>$row_rankingspage['amazonuser'],'ZNZ'=>$row_rankingspage['zipnada'],'AdzLy'=>$row_rankingspage['adzly_idnum'],'Ebates'=>$row_rankingspage['ebatesidnum'],'FourCorners'=>$row_rankingspage['bidernet_tng']);
$tenlevel = array('GDI'=>$row_rankingspage['crazygood_username'],'ILA'=>$row_rankingspage['gvo_username']);
$fiftylevel = array('Stiforp'=>$row_rankingspage['stiforp_username'],'MCA'=>$row_rankingspage['mca_username'],'LevelOneNetwork'=>$row_rankingspage['levelone_tng'],'DSDom'=>$row_rankingspage['solavei_name']);
$hunnidlevel = array('WakeUpNow'=>$row_rankingspage['tng_wun']);
// check free level array to see if it's empty or full
$checkfreelevel = 'unlocked';
if (empty($freelevel['IboToolBox']) or empty($freelevel['Netspend']) or empty($freelevel['ImFacePlate']) or empty($freelevel['BigCrumbs'])) {
$checkfreelevel = 'locked';
}
// check bonus level array
$checkbonuslevel = 'unlocked';
if (empty($bonuslevel['Amazon']) && empty($bonuslevel['ZNZ']) && empty($bonuslevel['AdzLy']) && empty($bonuslevel['Ebates'])) {
$checkbonuslevel = 'locked';
}
//check $10 level arrary to see if it's empty or if at least one program is unlocked
$checktenlevel = "unlocked";
if (empty($tenlevel['GDI']) && empty($tenlevel['ILA'])) {
$checktenlevel = "locked";
}
// check $50 level array
$checkfiftylevel = 'unlocked';
if (empty($fiftylevel['MCA']) && empty($fiftylevel['Stiforp']) && empty($fiftylevel['LevelOneNetwork']) && empty($fiftylevel['DSDom'])) {
$checkfiftylevel = 'locked';
}
// check $100 level array
$checkhunnidlevel = 'unlocked';
if (empty($hunnidlevel['WakeUpNow'])) {
$checkhunnidlevel = 'locked';
}
// determine the Rank!
$ranktng = "lead";
if ($checkfreelevel == "unlocked") {
$ranktng = "customer";
}
if ($ranktng == "customer" && $checktenlevel == "unlocked") {
$ranktng = "team member";
}
//end of rank
//determine the Number of Referrals
The Remaining Ranks are based on production - So I was thinking that First, I would need a Function that could Determine the Number of Referrals; and then secondly, Determine How many are ranked Customers (display $numberofcustomers (for example) - ) — and also How many of those referrals are Ranked as Team Members
— So that was the first wall I was hitting; Tried several things and none of them seemed to get me the result I was looking for; if anyone can help with that aspect of the script; that would be awesome — and very beneficial to the final part of the script.
I figure If I can manage to get a Function that look through the database, which stores all of this information; determine how many peeople were referred by a User; and how many of those referrals are customers, and how many are team members; that it would make the final steps pretty simple (in theory of course — I’m having difficulty with it so; perhaps not so simple?) ----
If a user has 5 Referrals who are Team Members; then their $ranktng needs to be set at The next rank, Team Leader
If a user has 3 Referrals who are Team Leaders; then their $ranktng needs to be set at The Next Rank; Team director
— and I’m assuming that if it’s possible to get this script to update the $ranktng - To the Next Rank ---- that I can pretty much write in the Remaining Ranks; as they’d all pretty much look similar to these last two. I hope this makes sense; and I hope it’s possible to pull this off. I’ve read a bunch of theories on ‘what I think’ are ways to pull this off; Possibly an Inner Join — something that might store the $rankTNG to make it easier to read and calculate; but again — that’s why I’m here; Can’t seem to figure out exactly how to pull this off.
Is there anyone willing to help out with this?
who knows; someone else may be attempting to do something similar and this thread can serve as a Open-source discussion; to help them do this too; thanks in advance to more skilled php-coders than I; hoping someone or a few someones are willing to help me tackle this.