Ignore:
Timestamp:
2009/10/29 21:10:03 (14 years ago)
Author:
shutta
Message:

郵便番号から住所を取得する同一処理が複数箇所に記述されていたので、SC_Utilsにまとめた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/shopping/LC_Page_Shopping_DelivAddr.php

    r18276 r18355  
    138138                // 郵便番号から住所の取得 
    139139                if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") { 
    140                     $address = $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']); 
     140                    $address = SC_Utils_Ex::sfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']); 
    141141                    $this->arrForm['pref'] = @$address[0]['state']; 
    142142                    $this->arrForm['addr01'] = @$address[0]['city'] . @$address[0]['town']; 
     
    298298    } 
    299299 
    300     // 郵便番号から住所の取得 
    301     function lfGetAddress($zipcode) { 
    302  
    303         $conn = new SC_DBconn(ZIP_DSN); 
    304  
    305         // 郵便番号検索文作成 
    306         $zipcode = mb_convert_kana($zipcode ,"n"); 
    307         $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?"; 
    308  
    309         $data_list = $conn->getAll($sqlse, array($zipcode)); 
    310  
    311         // インデックスと値を反転させる。 
    312         $arrREV_PREF = array_flip($this->arrPref); 
    313  
    314         /* 
    315           総務省からダウンロードしたデータをそのままインポートすると 
    316           以下のような文字列が入っているので 対策する。 
    317           ・(1・19丁目) 
    318           ・以下に掲載がない場合 
    319         */ 
    320         $town =  $data_list[0]['town']; 
    321         $town = ereg_replace("(.*)$","",$town); 
    322         $town = ereg_replace("以下に掲載がない場合","",$town); 
    323         $data_list[0]['town'] = $town; 
    324         $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']]; 
    325  
    326         return $data_list; 
    327     } 
    328  
    329300    /* 別のお届け先住所を一時受注テーブルへ */ 
    330301    function lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id) { 
Note: See TracChangeset for help on using the changeset viewer.