Beispiel #1
0
 /**
  * Get shipping address or create if none exists
  *
  * @return Address
  */
 public function getShippingAddress()
 {
     $objAddress = parent::getShippingAddress();
     // Try to load the default member address
     if (null === $objAddress && FE_USER_LOGGED_IN === true) {
         $objAddress = Address::findDefaultShippingForMember(\FrontendUser::getInstance()->id);
     }
     // Try to load the default collection address
     if (null === $objAddress) {
         $objAddress = Address::findDefaultShippingForProductCollection($this->id);
     }
     // Last option: create a new address, including member data if available
     if (null === $objAddress) {
         $objAddress = Address::createForProductCollection($this, Isotope::getConfig()->getShippingFields(), false, true);
     }
     return $objAddress;
 }
 /**
  * Get default address for this collection and address type
  *
  * @return AddressModel
  */
 protected function getDefaultAddress()
 {
     $objAddress = AddressModel::findDefaultShippingForProductCollection(Isotope::getCart()->id);
     if (null === $objAddress) {
         $objAddress = AddressModel::createForProductCollection(Isotope::getCart(), Isotope::getConfig()->getShippingFields(), false, 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;
 }