/** * Return reference of account by $cmlAccount object. * @param CmlAccount $cmlAccount */ private function getReference($cmlAccount) { $name = $cmlAccount->getName(); $result = $this->query("select id from Accounts where accountname='{$name}';"); return $this->getFirstReference($result); }
/** * Initlizate account address if it exists. * @param CmlAccount $cmlAccount * @param SimpleXmlElement $xmlAccount */ private function parseAccountAddress($cmlAccount, $xmlAccount) { //TODO: In next version diff phis and legal addreses $address = null; /* Phisical or legal face */ if ($this->isChildExists($xmlAccount, 'АдресРегистрации')) { $xmlAddress = $xmlAccount->АдресРегистрации; } elseif ($this->isChildExists($xmlAccount, 'Адрес')) { $xmlAddress = $xmlAccount->Адрес; } else { return; } /* Parse addres fields */ foreach ($xmlAddress->АдресноеПоле as $xmlAddressPart) { if ($this->isChildExists($xmlAddressPart, 'Значение')) { $address = $address . $this->getChildContent($xmlAddressPart, 'Значение') . " "; } } if ($address != null) { $cmlAccount->initAccountAddress($address, $address); //shipping and billing equals in this version } }