Commit 44dc89b9 authored by Imran Hussain's avatar Imran Hussain
Browse files

Write a function to work around broken msl shit

parent 6c713711
Loading
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -31,11 +31,28 @@ $membership_data = $formated_raw_data["table1"]["table1_Product_Collection"]["ta

// make a new array that just contains *every* member no matter what they bought
$just_members = array();
foreach ($membership_data as $typeOfMember) {
	foreach ($typeOfMember["Detail_Collection"]["Detail"] as $member) {

function filter_array($data){
	global $just_members;
	// we have more than one type of member if this is true
	if (count($data[0]["Detail_Collection"]["Detail"][0]["@attributes"]) == 7){
		//split them up then feed them back
		foreach ($data as $membershipType){
		 	filter_array($membershipType);
 		}
 	// we have more then 1 of the same type of member if this is true
 	} else if (count($data["Detail_Collection"]["Detail"][0]["@attributes"]) == 7) {
 		//wack them onto the used array
 		foreach ($data["Detail_Collection"]["Detail"] as $member) {
	 	 	array_push($just_members, $member["@attributes"]);
 	 	}
  	// we have 1 member :(
 	} else if (count($data["Detail_Collection"]["Detail"]["@attributes"]) == 7) {
		array_push($just_members, $data["Detail_Collection"]["Detail"]["@attributes"]);
	}
}

filter_array($membership_data);

/* You can now use $just_members to probe member detials. It's an array of arrays which each contain:
* transaction_id (recepit id)