/** * Get billing address or create if none exists * @return Address */ public function getBillingAddress() { $objAddress = parent::getBillingAddress(); if (null === $objAddress && FE_USER_LOGGED_IN === true) { $objAddress = Address::findDefaultBillingForMember(\FrontendUser::getInstance()->id); if (null === $objAddress) { $objAddress = Address::createForMember(\FrontendUser::getInstance()->id, Isotope::getConfig()->getBillingFields()); } } if (null === $objAddress) { $objAddress = new Address(); $objAddress->country = Isotope::getConfig()->billing_country ?: Isotope::getConfig()->country; } return $objAddress; }
/** * Get billing address or create if none exists * * @return Address */ public function getBillingAddress() { $objAddress = parent::getBillingAddress(); // Try to load the default member address if (null === $objAddress && FE_USER_LOGGED_IN === true) { $objAddress = Address::findDefaultBillingForMember(\FrontendUser::getInstance()->id); } // Try to load the default collection address if (null === $objAddress) { $objAddress = Address::findDefaultBillingForProductCollection($this->id); } // Last option: create a new address, including member data if available if (null === $objAddress) { $objAddress = Address::createForProductCollection($this, Isotope::getConfig()->getBillingFields(), true); } return $objAddress; }