/** * @param Mage_Sales_Model_Order_Address $address * @return array */ protected function _getShopgateAddressFromOrderAddress($address) { $shopgateAddress = new ShopgateAddress(); $shopgateAddress->setFirstName($address->getFirstname()); $shopgateAddress->setLastName($address->getLastname()); $shopgateAddress->setGender($this->_getCustomerHelper()->getShopgateCustomerGender($address)); $shopgateAddress->setCompany($address->getCompany()); $shopgateAddress->setPhone($address->getTelephone()); $shopgateAddress->setStreet1($address->getStreet1()); $shopgateAddress->setStreet2($address->getStreet2()); $shopgateAddress->setCity($address->getCity()); $shopgateAddress->setZipcode($address->getPostcode()); $shopgateAddress->setCountry($address->getCountry()); $shopgateAddress->setState($this->_getHelper()->getIsoStateByMagentoRegion($address)); return $shopgateAddress->toArray(); }
/** * @param ShopgateCustomer $shopgateCustomer * @param Mage_Customer_Model_Customer $magentoCustomer * @return ShopgateCustomer */ protected function _getCustomerSetAddresses(&$shopgateCustomer, $magentoCustomer) { $aAddresses = array(); foreach ($magentoCustomer->getAddresses() as $magentoCustomerAddress) { /** @var Mage_Customer_Model_Address $magentoCustomerAddress */ $shopgateAddress = new ShopgateAddress(); $shopgateAddress->setId($magentoCustomerAddress->getId()); $shopgateAddress->setIsDeliveryAddress(1); $shopgateAddress->setIsInvoiceAddress(1); $shopgateAddress->setFirstName($magentoCustomerAddress->getFirstname()); $shopgateAddress->setLastName($magentoCustomerAddress->getLastname()); $shopgateAddress->setGender($this->_getCustomerHelper()->getShopgateCustomerGender($magentoCustomerAddress)); $shopgateAddress->setCompany($magentoCustomerAddress->getCompany()); $shopgateAddress->setMail($magentoCustomerAddress->getMail()); $shopgateAddress->setPhone($magentoCustomerAddress->getTelephone()); $shopgateAddress->setStreet1($magentoCustomerAddress->getStreet1()); $shopgateAddress->setStreet2($magentoCustomerAddress->getStreet2()); $shopgateAddress->setCity($magentoCustomerAddress->getCity()); $shopgateAddress->setZipcode($magentoCustomerAddress->getPostcode()); $shopgateAddress->setCountry($magentoCustomerAddress->getCountry()); $shopgateAddress->setState($this->_getHelper()->getIsoStateByMagentoRegion($magentoCustomerAddress)); $aAddresses[] = $shopgateAddress; } $shopgateCustomer->setAddresses($aAddresses); return $shopgateCustomer; }