/** * Copies address data to order address. * * @param OrderAddressInterface $orderAddress * @param array $addressData */ private function setAddressDataForOrder(&$orderAddress, $addressData) { $orderAddress->setStreet($this->getProperty($addressData, 'street', '')); $orderAddress->setNumber($this->getProperty($addressData, 'number', '')); $orderAddress->setAddition($this->getProperty($addressData, 'addition', '')); $orderAddress->setCity($this->getProperty($addressData, 'city', '')); $orderAddress->setZip($this->getProperty($addressData, 'zip', '')); $orderAddress->setState($this->getProperty($addressData, 'state', '')); $countryName = $this->getProperty($addressData, 'country', ''); // Get country name if country is an array. if (is_array($countryName)) { $countryName = ''; if (isset($countryName['name'])) { $countryName = $countryName['name']; } } $orderAddress->setCountry($countryName); $orderAddress->setEmail($this->getProperty($addressData, 'email', '')); $orderAddress->setPhone($this->getProperty($addressData, 'phone', '')); $orderAddress->setNote($this->getProperty($addressData, 'note', '')); $orderAddress->setPostboxCity($this->getProperty($addressData, 'postboxCity', '')); $orderAddress->setPostboxPostcode($this->getProperty($addressData, 'postboxPostcode', '')); $orderAddress->setPostboxNumber($this->getProperty($addressData, 'postboxNumber', '')); $address = null; if ($this->getProperty($addressData, 'address')) { $address = $this->getProperty($addressData, 'address'); } elseif ($this->getProperty($addressData, 'contactAddress')) { $address = $this->getProperty($addressData, 'contactAddress'); } if ($address) { $this->getAndSetOrderAddressByContactAddressId($address, null, null, $orderAddress); } }
/** * Copies address data from one order-address-interface to another. * * @param OrderAddressInterface $from * @param OrderAddressInterface $to */ public function copyValuesFromInterface(OrderAddressInterface $from, OrderAddressInterface $to) { // Account. $to->setAccountName($from->getAccountName()); $to->setUid($from->getUid()); // Contact. $to->setTitle($from->getTitle()); $to->setSalutation($from->getSalutation()); $to->setFormOfAddress($from->getFormOfAddress()); $to->setFirstName($from->getFirstName()); $to->setLastName($from->getLastName()); $to->setEmail($from->getEmail()); $to->setPhone($from->getPhone()); $to->setPhoneMobile($from->getPhoneMobile()); // Address. $to->setStreet($from->getStreet()); $to->setNumber($from->getNumber()); $to->setAddition($from->getAddition()); $to->setZip($from->getZip()); $to->setCity($from->getCity()); $to->setState($from->getState()); $to->setCountry($from->getCountry()); $to->setContactAddress($from->getContactAddress()); $to->setNote($from->getNote()); // Postbox. $to->setPostboxCity($from->getPostboxCity()); $to->setPostboxNumber($from->getPostboxNumber()); $to->setPostboxPostcode($from->getPostboxPostcode()); }