リビジョン b3a58ce1 app/Controller/TopController.php

差分を見る:

app/Controller/TopController.php
37 37
 * @var array
38 38
 */
39 39
	var $name = 'top';
40
	public $uses = array('ContactValidate');
40
	public $uses = array('ContactValidate','Zipcode');
41 41
	public $layout = 'procedure';
42 42

  
43 43
	function beforeFilter(){
......
69 69
	public function company() {
70 70
	}
71 71
/**
72
 *	mypage 
73
 */
74
	public function mypage() {
75
	}
76
/**
77
 *	howto 
78
 */
79
	public function howto() {
80
	}
81
/**
72 82
 * contact
73 83
 */
74 84
	public function contact() {
......
97 107
	public function contact_complete() {
98 108
		$this->set('contact',$this->Session->read('contact'));
99 109
		$name = $this->Session->read('contact.ContactValidate.name');
100
		$mail = $this->Session->read('contact.ContactValidate.mail');
110
		$mail = $this->Session->read('contact.ContactValidate.email');
101 111
		$comment = $this->Session->read('contact.ContactValidate.comment');
102 112
		$Email = new CakeEmail();
103 113
		$Email->charset('ISO-2022-JP');
104 114
		$Email->emailFormat('text');
105 115
		$Email->template('user_contact');
106 116
		$Email->viewVars(array('name'=>$name,'comment'=>$comment));
107
		$Email->from($mail);
108
		$Email->to('yano@i-hearts.jp');
117
		$Email->from('yano@i-hearts.jp');
118
		$Email->to($mail);
109 119
		$Email->subject('[PICT CODE]問い合わせ');
110 120
		$Email->send();
111 121
	}
122

  
123

  
124
/**
125
 *郵便番号から住所を自動入力する* 
126
 *
127
 * View/add.ctp
128
 */
129
	public function zipsearch() {
130
		App::import('Model','ConnectionManager');
131
        $db =ConnectionManager::getDataSource('default');
132

  
133
		//Users/zipsearch.ctpを自動で見に行くのを防止
134
		$this->autoRender = false;
135

  
136
        	//リクエストがajaxメソッドで送られてきた場合
137
       		if($this->request->is('ajax')) {
138
            
139
            	//formのパラメータ取得
140
           	$post = $this->request->data['ContactValidate']['postcode'];
141
           	// var_dump($post);
142
           	// exit;
143
			// $options = array(
144
			// 'conditions'=>array(
145
			// 	'postcode like' => $post.'%' ,
146
			// )
147
		// );
148
		$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
149
       
150
		// データをjsonに変換して出力
151
		echo json_encode($result);
152

  
153
		}
154
	}
155

  
112 156
}

他の形式にエクスポート: Unified diff