コード例 #1
0
ファイル: Country.php プロジェクト: uiDeveloper116/webstore
 /**
  * Return a list of countries with the passed
  * country code as the first option
  *
  * @param $code
  * @return array|CActiveRecord[]
  */
 public static function sortShippingCountries($code)
 {
     if (is_null($code) === true) {
         $code = _xls_country();
     }
     $arrCountry = self::getShippingCountries();
     $objMatchingCountry = null;
     foreach ($arrCountry as $key => $country) {
         if ($country->code === $code) {
             $objMatchingCountry = $country;
             unset($arrCountry[$key]);
             break;
         }
     }
     if (is_null($objMatchingCountry) === true) {
         // something has gone wrong
         Yii::log(sprintf('Country with code %s not found in list', $code), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
         return $arrCountry;
     }
     return array_merge(array($objMatchingCountry), $arrCountry);
 }
コード例 #2
0
ファイル: wsamazon.php プロジェクト: hjlan/webstore
 protected function getMWSUrl()
 {
     switch (_xls_country()) {
         case 'CN':
             return "https://mws.amazonservices.com.cn";
         case 'DE':
         case 'ES':
         case 'FR':
         case 'IN':
         case 'GB':
         case 'UK':
             return "https://mws-eu.amazonservices.com";
         case 'CA':
             return "https://mws.amazonservices.ca";
         case 'IT':
             return "https://mws.amazonservices.it";
         case 'JP':
             return "https://mws.amazonservices.jp";
         case 'US':
             return "https://mws.amazonservices.com";
         default:
             return null;
     }
 }
コード例 #3
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'state':
             if ($this->state_id) {
                 return State::CodeById($this->state_id);
             } else {
                 return null;
             }
         case 'country':
             if ($this->country_id) {
                 return Country::CodeById($this->country_id);
             } else {
                 return null;
             }
         case 'country_name':
             if ($this->country_id) {
                 return Country::CountryById($this->country_id);
             } else {
                 return null;
             }
         case 'mainname':
         case 'fullname':
             return $this->first_name . " " . $this->last_name;
         case 'block':
             return $this->address1 . chr(13) . $this->address2 . chr(13) . $this->city . chr(13) . $this->state . chr(13) . $this->postal . chr(13) . $this->country;
         case 'htmlblock':
             return $this->address1 . '<br>' . (!empty($this->address2) ? $this->address2 . "<br>" : "") . $this->city . ' ' . $this->state . " " . $this->postal . '<br>' . $this->country_name;
         case 'shipblock':
             return $this->first_name . " " . $this->last_name . chr(13) . $this->address1 . chr(13) . (!empty($this->company) ? $this->company . " " . $this->address2 : $this->address2) . chr(13) . $this->city . chr(13) . $this->state . " " . $this->postal . chr(13) . $this->country;
         case 'formattedblock':
             if ($this->customer_id == Yii::app()->user->id) {
                 return $this->first_name . " " . $this->last_name . '<br>' . $this->address1 . '<br>' . (!empty($this->company) ? $this->company . "<br>" : "") . (!empty($this->address2) ? $this->address2 . "<br>" : "") . $this->city . ' ' . $this->state . " " . $this->postal . '<br>' . (_xls_country() != $this->country ? $this->country : "");
             } else {
                 return Yii::t('global', 'Directly to gift recipient') . '<br>' . $this->first_name . " " . $this->last_name;
             }
         case 'formattedblockcountry':
             return $this->first_name . " " . $this->last_name . '<br>' . $this->address1 . '<br>' . (!empty($this->company) ? $this->company . "<br>" : "") . (!empty($this->address2) ? $this->address2 . "<br>" : "") . $this->city . ' ' . $this->state . " " . $this->postal . '<br>' . (_xls_country() != $this->country ? $this->country_name : "");
         default:
             return parent::__get($strName);
     }
 }
コード例 #4
0
ファイル: helpers.php プロジェクト: uiDeveloper116/webstore
function _xls_html_storeaddress()
{
    $str = '';
    $str .= Yii::app()->params['STORE_ADDRESS1'] . '<br>';
    $str .= Yii::app()->params['STORE_ADDRESS2'] ? Yii::app()->params['STORE_ADDRESS2'] . '<br>' : '';
    $str .= Yii::app()->params['STORE_CITY'] ? Yii::app()->params['STORE_CITY'] . ', ' : '';
    $str .= Yii::app()->params['STORE_STATE'] ? State::CodeById(Yii::app()->params['STORE_STATE']) . '<br>' : '';
    $intIdCountry = Yii::app()->params['STORE_COUNTRY'];
    if (is_null($intIdCountry) === false) {
        if (Country::CodeById($intIdCountry) !== _xls_country()) {
            $str .= Yii::app()->params['STORE_COUNTRY'] ? Country::CountryById(Yii::app()->params['STORE_COUNTRY']) . '<br>' : '';
        }
    }
    $str .= Yii::app()->params['STORE_ZIP'] ? Yii::app()->params['STORE_ZIP'] : '';
    return $str;
}