Beispiel #1
0
 /**
  * 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;
 }
Beispiel #2
0
 /**
  * Get default address for this collection and address type
  *
  * @return Address
  */
 protected function getDefaultAddress()
 {
     $objAddress = AddressModel::findDefaultBillingForProductCollection(Isotope::getCart()->id);
     if (null === $objAddress) {
         $objAddress = AddressModel::createForProductCollection(Isotope::getCart(), Isotope::getConfig()->getBillingFields(), true);
     }
     return $objAddress;
 }
 /**
  * Get default address for this collection and address type
  *
  * @param bool $useBilling
  *
  * @return Address
  */
 private function getDefaultAddress($useBilling)
 {
     $objAddress = null;
     $intCart = Isotope::getCart()->id;
     if ($intCart > 0) {
         if ($useBilling) {
             $objAddress = Address::findDefaultBillingForProductCollection($intCart);
         } else {
             $objAddress = Address::findDefaultShippingForProductCollection($intCart);
         }
     }
     if (null === $objAddress) {
         $objAddress = Address::createForProductCollection(Isotope::getCart(), $useBilling ? Isotope::getConfig()->getBillingFields() : Isotope::getConfig()->getShippingFields(), $useBilling, !$useBilling);
     }
     return $objAddress;
 }