protected function HandleRow($row) { if (!($this->handleaddresses || $this->handleformfields)) { return $row; } $row = parent::HandleRow($row); if ($this->handleaddresses) { $addresses = array(); if (count($row['customerAddresses'])) { $x = 0; foreach ($row['customerAddresses'] as $address) { $addresses[] = array_combine(array_keys($this->addr_cache[$x]), array_values($address)); $x++; } } // create empty addresses to fill up the array if (count($addresses) < $this->maxaddr) { $diff = $this->maxaddr - count($addresses); $start = $this->maxaddr - $diff; for ($x = $start; $x < $diff; $x++) { $addresses[] = $this->addr_cache[$x]; } } $merged = array(); foreach ($addresses as $address) { $merged = array_merge($merged, $address); } // position of the addresses in the row $position = $this->GetFieldPosition("customerAddresses"); // generate the keys $keys = array_keys($row); $addr_keys = array_keys($merged); array_splice($keys, $position, 1, $addr_keys); // insert the addresses into row array_splice($row, $position, 1, $merged); $row = array_combine($keys, $row); } return $row; }