Пример #1
0
 /**
  * Get shipping address or create if none exists
  * @return  Address
  */
 public function getShippingAddress()
 {
     $objAddress = parent::getShippingAddress();
     if (null === $objAddress && FE_USER_LOGGED_IN === true) {
         $objAddress = Address::findDefaultShippingForMember(\FrontendUser::getInstance()->id);
         if (null === $objAddress) {
             $objAddress = Address::createForMember(\FrontendUser::getInstance()->id, Isotope::getConfig()->getShippingFields());
         }
     }
     if (null === $objAddress) {
         $objAddress = new Address();
         $objAddress->country = Isotope::getConfig()->shipping_country;
     }
     return $objAddress;
 }
Пример #2
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;
 }