コード例 #1
0
 /**
  * Store date and score to customerAddress.
  * If the quoteAddress is not a saved customerAddress we do nothing
  * If it gets saved to the addressBook at end of checkout Magento´ convert functionality saves the data for us
  *
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return bool
  */
 public function saveCustomerAddress(Mage_Customer_Model_Address_Abstract $address)
 {
     $customerAddressId = $address->getCustomerAddressId();
     if (empty($customerAddressId)) {
         return false;
     }
     $customerAddress = $this->getFactory()->getModelCustomerAddress();
     $customerAddress->load($customerAddressId);
     if (!$customerAddress->hasData()) {
         return false;
     }
     $customerAddress->setData($this->prefix . '_score', $address->getData($this->prefix . '_score'));
     $customerAddress->setData($this->prefix . '_date', $address->getData($this->prefix . '_date'));
     $customerAddress->setData($this->prefix . '_hash', $address->getData($this->prefix . '_hash'));
     $customerAddress->setCity($address->getCity());
     $customerAddress->setStreetFull($address->getStreetFull());
     $customerAddress->setZip($address->getZip());
     $customerAddress->save();
     return true;
 }
コード例 #2
0
 /**
  * Determine if the address is from the customers address book or is a new address
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return bool
  */
 protected function _isAddressFromAddressBook(Mage_Customer_Model_Address_Abstract $address)
 {
     return $address->getId() && $address->getCustomerId() && $address->getCustomerAddressId();
 }