コード例 #1
0
ファイル: Address.php プロジェクト: sojimaxi/avatax
 /**
  * Sets attributes from the AvaTax Response address on the Mage address.
  *
  * @return $this
  */
 protected function _convertResponseAddress()
 {
     $street = array($this->_responseAddress->getLine1(), $this->_responseAddress->getLine2());
     $region = Mage::getModel('directory/region')->loadByCode($this->_responseAddress->getRegion(), $this->_mageAddress->getCountryId());
     $this->_mageAddress->setStreet($street)->setCity($this->_responseAddress->getCity())->setRegionId($region->getId())->setPostcode($this->_responseAddress->getPostalCode())->setCountryId($this->_responseAddress->getCountry())->save()->setAddressNormalized(true);
     return $this;
 }
コード例 #2
0
 /**
  * Transfer data from a physical address payload to a Magento address model.
  *
  * @param IPhysicalAddress
  * @param Mage_Customer_Model_Address_Abstract
  * @return self
  */
 public function transferPhysicalAddressPayloadToAddress(IPhysicalAddress $addressPayload, Mage_Customer_Model_Address_Abstract $address)
 {
     /** @var string */
     $region = $addressPayload->getMainDivision();
     $address->setStreet($addressPayload->getLines())->setCity($addressPayload->getCity())->setCountryId($addressPayload->getCountryCode())->setRegionId($this->getRegionIdByCode($region, $addressPayload->getCountryCode()))->setRegion($region)->setPostcode($addressPayload->getPostalCode());
     return $this;
 }