/** * Check whether specified shipping address is default for its customer * * @param Address $address * @return bool */ protected function _isDefaultShipping($address) { return $address->getId() && $address->getId() == $address->getCustomer()->getDefaultShipping() || $address->getIsPrimaryShipping() || $address->getIsDefaultShipping(); }
/** * Replace existing Address Model with a new one * * @param Address $address * @return $this */ public function push(Address $address) { $this->registry[$address->getId()] = $address; return $this; }
/** * Check if address is primary * * @param Address $address * @return boolean */ public function isAddressPrimary(Address $address) { if (!$address->getId()) { return false; } return $address->getId() == $this->getDefaultBilling() || $address->getId() == $this->getDefaultShipping(); }
/** * Check whether specified address should be processed in after_save event handler * * @param Address $address * @return bool */ protected function _canProcessAddress($address) { if ($address->getForceProcess()) { return true; } if ($this->_coreRegistry->registry(self::VIV_CURRENTLY_SAVED_ADDRESS) != $address->getId()) { return false; } $configAddressType = $this->_customerAddress->getTaxCalculationAddressType(); if ($configAddressType == AbstractAddress::TYPE_SHIPPING) { return $this->_isDefaultShipping($address); } return $this->_isDefaultBilling($address); }