Version Notes
Indonesian Shippping Carriers
Download this release
Release Info
Developer | Ansyori |
Extension | aongkir |
Version | 1.0.0.1 |
Comparing to | |
See all releases |
Version 1.0.0.1
- app/code/local/Ansyori/Aongkir/Block/Index.php +15 -0
- app/code/local/Ansyori/Aongkir/Helper/Data.php +302 -0
- app/code/local/Ansyori/Aongkir/Model/Area.php +18 -0
- app/code/local/Ansyori/Aongkir/Model/Carrier/Ongkir.php +126 -0
- app/code/local/Ansyori/Aongkir/Model/Cron.php +13 -0
- app/code/local/Ansyori/Aongkir/Model/Mysql4/Area.php +15 -0
- app/code/local/Ansyori/Aongkir/Model/Mysql4/Area/Collection.php +19 -0
- app/code/local/Ansyori/Aongkir/Model/System/Config/Source/City.php +68 -0
- app/code/local/Ansyori/Aongkir/Model/System/Config/Source/Kurir.php +27 -0
- app/code/local/Ansyori/Aongkir/controllers/IndexController.php +81 -0
- app/code/local/Ansyori/Aongkir/etc/adminhtml.xml +23 -0
- app/code/local/Ansyori/Aongkir/etc/config.xml +92 -0
- app/code/local/Ansyori/Aongkir/etc/system.xml +176 -0
- app/code/local/Ansyori/Aongkir/sql/aongkir_setup/mysql4-install-1.0.0.php +55 -0
- app/design/frontend/base/default/layout/aongkir.xml +17 -0
- app/design/frontend/base/default/template/aongkir/billing.phtml +320 -0
- app/design/frontend/base/default/template/aongkir/edit.phtml +246 -0
- app/design/frontend/base/default/template/aongkir/shipping.phtml +246 -0
- app/design/frontend/rwd/default/layout/aongkir.xml +17 -0
- app/design/frontend/rwd/default/template/aongkir/billing.phtml +320 -0
- app/design/frontend/rwd/default/template/aongkir/edit.phtml +246 -0
- app/design/frontend/rwd/default/template/aongkir/shipping.phtml +246 -0
- app/etc/modules/Ansyori_Aongkir.xml +13 -0
- package.xml +18 -0
app/code/local/Ansyori/Aongkir/Block/Index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Block_Index extends Mage_Core_Block_Template{
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
}
|
app/code/local/Ansyori/Aongkir/Helper/Data.php
ADDED
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
|
10 |
+
class Ansyori_Aongkir_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
public function setLog($message,$filename='aongkir.log')
|
13 |
+
{
|
14 |
+
Mage::log($message,null,$filename);
|
15 |
+
}
|
16 |
+
|
17 |
+
public function config($config)
|
18 |
+
{
|
19 |
+
return Mage::getStoreConfig('carriers/ongkir/'.$config);
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
public function getApiKey()
|
24 |
+
{
|
25 |
+
return $this->config('apikey');
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getApiUrl()
|
29 |
+
{
|
30 |
+
return $this->config('apiurl');
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getRates($origin,$dest,$weight,$kurir)
|
34 |
+
{
|
35 |
+
$weight = $weight * 1000;
|
36 |
+
$post_fields = "origin=$origin&destination=$dest&weight=$weight&courier=$kurir";
|
37 |
+
|
38 |
+
|
39 |
+
$post = $this->requestPost('/cost',$post_fields);
|
40 |
+
|
41 |
+
$array_rates = array();
|
42 |
+
|
43 |
+
if($post['rajaongkir']['status']['code'] != '200')
|
44 |
+
{
|
45 |
+
return false;
|
46 |
+
};
|
47 |
+
|
48 |
+
$name_kurir = strtoupper($post['rajaongkir']['results'][0]['code']);
|
49 |
+
|
50 |
+
foreach($post['rajaongkir']['results'][0]['costs'] as $listrates)
|
51 |
+
{
|
52 |
+
$text = $name_kurir.' '.'('.$listrates['service'].') '.$listrates['description'];
|
53 |
+
|
54 |
+
|
55 |
+
foreach($listrates['cost'] as $main_rates):
|
56 |
+
$array_rates[] = array(
|
57 |
+
|
58 |
+
'text'=> $text.' '.$main_rates['note'],
|
59 |
+
'cost'=> $main_rates['value']
|
60 |
+
);
|
61 |
+
|
62 |
+
endforeach;
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
return $array_rates;
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
public function requestPost($method,$postfield)
|
71 |
+
{
|
72 |
+
|
73 |
+
$this->setLog('POST FIELDS : '.$postfield);
|
74 |
+
$this->setLog('URL : '.$this->getApiUrl().$method);
|
75 |
+
|
76 |
+
$curl = curl_init();
|
77 |
+
|
78 |
+
curl_setopt_array($curl, array(
|
79 |
+
CURLOPT_URL => $this->getApiUrl().$method,
|
80 |
+
CURLOPT_RETURNTRANSFER => true,
|
81 |
+
CURLOPT_ENCODING => "",
|
82 |
+
CURLOPT_MAXREDIRS => 10,
|
83 |
+
CURLOPT_TIMEOUT => 30,
|
84 |
+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
85 |
+
CURLOPT_CUSTOMREQUEST => "POST",
|
86 |
+
//CURLOPT_POSTFIELDS => "origin=501&destination=114&weight=1700&courier=jne",
|
87 |
+
CURLOPT_POSTFIELDS => $postfield,
|
88 |
+
CURLOPT_HTTPHEADER => array(
|
89 |
+
"key: ".$this->getApiKey()
|
90 |
+
),
|
91 |
+
));
|
92 |
+
|
93 |
+
$response = curl_exec($curl);
|
94 |
+
/*echo '<pre>';
|
95 |
+
print_r(json_decode($response,true));
|
96 |
+
|
97 |
+
$err = curl_error($curl);*/
|
98 |
+
$json = json_decode($response,true);
|
99 |
+
$array = print_r($json,true);
|
100 |
+
|
101 |
+
curl_close($curl);
|
102 |
+
|
103 |
+
$this->setLog('API LOG REQ : '.$array);
|
104 |
+
|
105 |
+
/* array */
|
106 |
+
return $json;
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
public function request($method)
|
112 |
+
{
|
113 |
+
$curl = curl_init();
|
114 |
+
|
115 |
+
curl_setopt_array($curl, array(
|
116 |
+
//CURLOPT_URL => "http://rajaongkir.com/api/starter/city",
|
117 |
+
CURLOPT_URL => $this->getApiUrl().$method,
|
118 |
+
CURLOPT_RETURNTRANSFER => true,
|
119 |
+
CURLOPT_ENCODING => "",
|
120 |
+
CURLOPT_MAXREDIRS => 10,
|
121 |
+
CURLOPT_TIMEOUT => 30,
|
122 |
+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
123 |
+
CURLOPT_CUSTOMREQUEST => "GET",
|
124 |
+
CURLOPT_HTTPHEADER => array(
|
125 |
+
"key: ".$this->getApiKey()
|
126 |
+
),
|
127 |
+
));
|
128 |
+
|
129 |
+
$response = curl_exec($curl);
|
130 |
+
/*echo '<pre>';
|
131 |
+
print_r(json_decode($response,true));
|
132 |
+
|
133 |
+
$err = curl_error($curl);*/
|
134 |
+
$this->setLog('API LOG REQ : '.print_r(json_decode($response,true)));
|
135 |
+
curl_close($curl);
|
136 |
+
|
137 |
+
/* array */
|
138 |
+
return json_decode($response,true);
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
public function getAllCity()
|
143 |
+
{
|
144 |
+
return $this->request('/city');
|
145 |
+
}
|
146 |
+
|
147 |
+
public function getAllProvince()
|
148 |
+
{
|
149 |
+
return $this->request('/province');
|
150 |
+
}
|
151 |
+
|
152 |
+
public function getCityProvince($provinceId)
|
153 |
+
{
|
154 |
+
return $this->request('/city?province='.$provinceId);
|
155 |
+
}
|
156 |
+
|
157 |
+
public function isCityExist($city_id)
|
158 |
+
{
|
159 |
+
$model = Mage::getModel('aongkir/area')->getCollection()
|
160 |
+
->addFieldToFilter('city_id',$city_id)
|
161 |
+
->getFirstItem();
|
162 |
+
return $model->getId();
|
163 |
+
}
|
164 |
+
|
165 |
+
public function fetchSql($sql)
|
166 |
+
{
|
167 |
+
try{
|
168 |
+
$resource = Mage::getSingleton('core/resource');
|
169 |
+
$writeConnection = $resource->getConnection('core_read');
|
170 |
+
return $writeConnection->fetchAll($sql);
|
171 |
+
|
172 |
+
}catch(Exception $xx)
|
173 |
+
{
|
174 |
+
$this->setLog('Erorr Sql : '.$xx->getMessage());
|
175 |
+
return false;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
public function sql($sql)
|
180 |
+
{
|
181 |
+
try{
|
182 |
+
$resource = Mage::getSingleton('core/resource');
|
183 |
+
$writeConnection = $resource->getConnection('core_write');
|
184 |
+
return $writeConnection->query($sql);
|
185 |
+
|
186 |
+
}catch(Exception $xx)
|
187 |
+
{
|
188 |
+
$this->setLog('Erorr Sql : '.$xx->getMessage());
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
public function getPrefixTable()
|
194 |
+
{
|
195 |
+
return Mage::getConfig()->getTablePrefix();
|
196 |
+
}
|
197 |
+
|
198 |
+
public function saveAreaToDb()
|
199 |
+
{
|
200 |
+
$data = $this->getAllProvince();
|
201 |
+
|
202 |
+
$model = Mage::getModel('aongkir/area');
|
203 |
+
|
204 |
+
$sql_delete_region = "
|
205 |
+
DELETE FROM ".$this->getPrefixTable()."directory_country_region WHERE country_id = 'ID'
|
206 |
+
";
|
207 |
+
|
208 |
+
|
209 |
+
$this->sql($sql_delete_region);
|
210 |
+
|
211 |
+
foreach($data['rajaongkir']['results'] as $prov)
|
212 |
+
{
|
213 |
+
/*$data_to_save = array();
|
214 |
+
$data_to_save = array(
|
215 |
+
|
216 |
+
'city_id' => $api_data['city_id']
|
217 |
+
);
|
218 |
+
*/
|
219 |
+
|
220 |
+
$code_prov = $prov['province_id'];
|
221 |
+
$name_prov = $prov['province'];
|
222 |
+
|
223 |
+
|
224 |
+
$sql_insert_province = "
|
225 |
+
INSERT INTO directory_country_region (country_id,code,default_name)
|
226 |
+
VALUES ('ID','$code_prov','$name_prov')
|
227 |
+
";
|
228 |
+
|
229 |
+
$this->sql($sql_insert_province);
|
230 |
+
|
231 |
+
$data_city = $this->getCityProvince($prov['province_id']);
|
232 |
+
foreach($data_city['rajaongkir']['results'] as $api_data):
|
233 |
+
try{
|
234 |
+
$check_id = $this->isCityExist($api_data['city_id']);
|
235 |
+
//$api_data['city_id'];
|
236 |
+
if(!$check_id)
|
237 |
+
{
|
238 |
+
$model->setData($api_data)
|
239 |
+
->save();
|
240 |
+
}else
|
241 |
+
{
|
242 |
+
$model->load($check_id)
|
243 |
+
->addData($api_data)
|
244 |
+
->setId($check_id)
|
245 |
+
->save();
|
246 |
+
}
|
247 |
+
}catch(Exception $xx)
|
248 |
+
{
|
249 |
+
$this->setLog('insert data area failed '.$xx->getMessage());
|
250 |
+
}
|
251 |
+
endforeach;
|
252 |
+
}
|
253 |
+
|
254 |
+
|
255 |
+
}
|
256 |
+
|
257 |
+
public function getJsCity()
|
258 |
+
{
|
259 |
+
$model = Mage::getModel('aongkir/area');
|
260 |
+
$provice = $model->getCollection()
|
261 |
+
->distinct(true)
|
262 |
+
->addFieldToSelect('province_id')
|
263 |
+
->addFieldToSelect('province')
|
264 |
+
|
265 |
+
->load()
|
266 |
+
;
|
267 |
+
|
268 |
+
$string = '';
|
269 |
+
|
270 |
+
foreach($provice as $data)
|
271 |
+
{
|
272 |
+
$string .= "
|
273 |
+
var provice_".$data->getProvinceId()." = [ ";
|
274 |
+
|
275 |
+
|
276 |
+
$city = $model->getCollection()
|
277 |
+
->distinct(true)
|
278 |
+
->addFieldToFilter('province_id',$data->getProvinceId())
|
279 |
+
->addFieldToSelect('city_id')
|
280 |
+
->addFieldToSelect('city_name')
|
281 |
+
->addFieldToSelect('type')
|
282 |
+
|
283 |
+
|
284 |
+
->load()
|
285 |
+
;
|
286 |
+
foreach($city as $data_city)
|
287 |
+
{
|
288 |
+
$string .= "
|
289 |
+
{ value: '".$data_city->getType().' '.$data_city->getCityName()."', data: '".$data_city->getCityId()."' },";
|
290 |
+
}
|
291 |
+
|
292 |
+
$string .="];
|
293 |
+
|
294 |
+
";
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
return $string;
|
299 |
+
}
|
300 |
+
|
301 |
+
}
|
302 |
+
|
app/code/local/Ansyori/Aongkir/Model/Area.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_Area extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
protected function _construct(){
|
12 |
+
|
13 |
+
$this->_init("aongkir/area");
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
18 |
+
|
app/code/local/Ansyori/Aongkir/Model/Carrier/Ongkir.php
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_Carrier_Ongkir
|
10 |
+
extends Mage_Shipping_Model_Carrier_Abstract
|
11 |
+
implements Mage_Shipping_Model_Carrier_Interface
|
12 |
+
{
|
13 |
+
protected $_code = 'ongkir';
|
14 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request){
|
15 |
+
if (!$this->getConfigFlag('active')) {
|
16 |
+
return false;
|
17 |
+
}
|
18 |
+
|
19 |
+
$list_euy = $this->getListRates();
|
20 |
+
|
21 |
+
$result = Mage::getModel('shipping/rate_result');
|
22 |
+
$count = 0;
|
23 |
+
foreach($list_euy as $jangar_kana_hulu)
|
24 |
+
{
|
25 |
+
$count++;
|
26 |
+
//getMethodRates($code,$title,$name,$rates)
|
27 |
+
$method = $this->getMethodRates('_'.$count,'',$jangar_kana_hulu['text'],$jangar_kana_hulu['cost']);
|
28 |
+
$result->append($method);
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
return $result;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function helper($type = 'aongkir')
|
38 |
+
{
|
39 |
+
return Mage::helper($type);
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getCityId()
|
43 |
+
{
|
44 |
+
$string_city = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress()->getCity();
|
45 |
+
|
46 |
+
|
47 |
+
$sql = "select * from daftar_alamat where concat(type,' ',city_name) = '$string_city' limit 0,1 ";
|
48 |
+
|
49 |
+
$res = $this->helper()->fetchSql($sql);
|
50 |
+
|
51 |
+
return $res[0]['city_id'];
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getListRates()
|
56 |
+
{
|
57 |
+
$origin = $this->getOriginId();
|
58 |
+
$dest = $this->getCityId();
|
59 |
+
$weight = $this->getBeratTotal();
|
60 |
+
$carriers = $this->getActiveCarriers();
|
61 |
+
|
62 |
+
$rate_list = array();
|
63 |
+
//getRates($origin,$dest,$weight,$kurir)
|
64 |
+
foreach($carriers as $kurir)
|
65 |
+
{
|
66 |
+
$rates_by_kurir = $this->helper()->getRates($origin,$dest,$weight,$kurir);
|
67 |
+
foreach($rates_by_kurir as $final_list)
|
68 |
+
{
|
69 |
+
$rate_list[] = array(
|
70 |
+
'text' => $final_list['text'],
|
71 |
+
'cost' => $final_list['cost'],
|
72 |
+
|
73 |
+
);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
$this->helper()->setLog('Final rate '.print_r($rate_list,true));
|
77 |
+
return $rate_list;
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
public function getActiveCarriers()
|
82 |
+
{
|
83 |
+
return explode(',',strtolower($this->helper()->config('kurir')));
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getOriginId()
|
87 |
+
{
|
88 |
+
return $this->helper()->config('origin');
|
89 |
+
}
|
90 |
+
|
91 |
+
public function getBeratTotal()
|
92 |
+
{
|
93 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
94 |
+
$totalWeight = 0;
|
95 |
+
foreach($items as $item) {
|
96 |
+
$totalWeight += ($item->getWeight() * $item->getQty()) ;
|
97 |
+
}
|
98 |
+
|
99 |
+
return $totalWeight;
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
public function getMethodRates($code,$title,$name,$rates)
|
104 |
+
{
|
105 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
106 |
+
$method->setCarrier($this->_code);
|
107 |
+
$method->setCarrierTitle($title);
|
108 |
+
$method->setMethod($this->_code.$code);
|
109 |
+
$method->setMethodTitle($name);
|
110 |
+
$method->setPrice($rates);
|
111 |
+
|
112 |
+
return $method;
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Get allowed shipping methods
|
119 |
+
*
|
120 |
+
* @return array
|
121 |
+
*/
|
122 |
+
public function getAllowedMethods()
|
123 |
+
{
|
124 |
+
return array($this->_code=>$this->getConfigData('name'));
|
125 |
+
}
|
126 |
+
}
|
app/code/local/Ansyori/Aongkir/Model/Cron.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_Cron{
|
10 |
+
public function UpdateAlamat(){
|
11 |
+
//do something
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Ansyori/Aongkir/Model/Mysql4/Area.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_Mysql4_Area extends Mage_Core_Model_Mysql4_Abstract
|
10 |
+
{
|
11 |
+
protected function _construct()
|
12 |
+
{
|
13 |
+
$this->_init("aongkir/area", "idx");
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Ansyori/Aongkir/Model/Mysql4/Area/Collection.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_Mysql4_Area_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
10 |
+
{
|
11 |
+
|
12 |
+
public function _construct(){
|
13 |
+
$this->_init("aongkir/area");
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
}
|
19 |
+
|
app/code/local/Ansyori/Aongkir/Model/System/Config/Source/City.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_System_Config_Source_City
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Options getter
|
14 |
+
*
|
15 |
+
* @return array
|
16 |
+
*/
|
17 |
+
|
18 |
+
public function helper()
|
19 |
+
{
|
20 |
+
return Mage::helper('aongkir');
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
public function toOptionArray()
|
27 |
+
{
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
if($this->helper()->getApiKey()):
|
32 |
+
|
33 |
+
//$this->helper()->saveAreaToDb();
|
34 |
+
|
35 |
+
$city_array = array();
|
36 |
+
$city_list = Mage::getModel('aongkir/area')->getCollection()->setOrder('province','ASC');
|
37 |
+
|
38 |
+
$count = Mage::getModel('aongkir/area')->getCollection()->count();
|
39 |
+
|
40 |
+
if(!$count)
|
41 |
+
{
|
42 |
+
$this->helper()->saveAreaToDb();
|
43 |
+
}
|
44 |
+
|
45 |
+
$city_array[] = array('value' => '', 'label'=> '--- Select Origin ('.$count.' Cities Registered) ---' );
|
46 |
+
foreach($city_list->getData() as $data)
|
47 |
+
{
|
48 |
+
$city_id = $data['city_id'];
|
49 |
+
$city_name = "Provinsi ".$data["province"]." ".$data["type"]." ".$data["city_name"]." Kodepos ".$data["postal_code"];
|
50 |
+
$city_array[] = array('value' => $city_id, 'label'=> $city_name );
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
//asort($city_array,);
|
55 |
+
//uasort($city_array, 'cmp');
|
56 |
+
return $city_array;
|
57 |
+
|
58 |
+
|
59 |
+
else:
|
60 |
+
return array(
|
61 |
+
|
62 |
+
array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('API KEY INVALID')),
|
63 |
+
|
64 |
+
);
|
65 |
+
endif;
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
app/code/local/Ansyori/Aongkir/Model/System/Config/Source/Kurir.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_Model_System_Config_Source_Kurir
|
10 |
+
{
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Options getter
|
14 |
+
*
|
15 |
+
* @return array
|
16 |
+
*/
|
17 |
+
public function toOptionArray()
|
18 |
+
{
|
19 |
+
return array(
|
20 |
+
|
21 |
+
array('value' => 'JNE', 'label'=>Mage::helper('adminhtml')->__('JNE')),
|
22 |
+
array('value' => 'POS', 'label'=>Mage::helper('adminhtml')->__('POS')),
|
23 |
+
array('value' => 'TIKI', 'label'=>Mage::helper('adminhtml')->__('TIKI')),
|
24 |
+
);
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/local/Ansyori/Aongkir/controllers/IndexController.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
class Ansyori_Aongkir_IndexController extends Mage_Core_Controller_Front_Action{
|
10 |
+
public function IndexAction() {
|
11 |
+
|
12 |
+
$this->loadLayout();
|
13 |
+
$this->renderLayout();
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
public function cityAction()
|
18 |
+
{
|
19 |
+
$model = Mage::getModel('aongkir/area');
|
20 |
+
$prov_id = $this->getRequest()->getParam('prov_id');
|
21 |
+
|
22 |
+
|
23 |
+
$region = Mage::getModel('directory/region')->load($prov_id);
|
24 |
+
$state_code = $region->getCode(); //CA
|
25 |
+
|
26 |
+
|
27 |
+
$city = $model->getCollection()
|
28 |
+
->distinct(true)
|
29 |
+
->addFieldToFilter('province_id',$state_code)
|
30 |
+
->addFieldToSelect('city_id')
|
31 |
+
->addFieldToSelect('city_name')
|
32 |
+
->addFieldToSelect('type')
|
33 |
+
|
34 |
+
|
35 |
+
->load()
|
36 |
+
;
|
37 |
+
foreach($city as $data_city)
|
38 |
+
{
|
39 |
+
$region_cities[] = array(
|
40 |
+
'city_id' => $data_city->getCityId(),
|
41 |
+
'display_name' => $data_city->getType() . ' ' .$data_city->getCityName(),
|
42 |
+
);
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
echo json_encode($region_cities);
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function xcityAction()
|
53 |
+
{
|
54 |
+
$model = Mage::getModel('aongkir/area');
|
55 |
+
$prov_id = $_GET['query'];
|
56 |
+
|
57 |
+
|
58 |
+
$region = Mage::getModel('directory/region')->load($prov_id);
|
59 |
+
$state_code = $region->getCode(); //CA
|
60 |
+
|
61 |
+
|
62 |
+
$city = $model->getCollection()
|
63 |
+
->distinct(true)
|
64 |
+
->addFieldToFilter('province_id',$state_code)
|
65 |
+
->addFieldToSelect('city_id')
|
66 |
+
->addFieldToSelect('city_name')
|
67 |
+
->addFieldToSelect('type')
|
68 |
+
|
69 |
+
|
70 |
+
->load()
|
71 |
+
;
|
72 |
+
foreach($city as $data_city)
|
73 |
+
{
|
74 |
+
$string .= "{ value: '".$data_city->getType().' '.$data_city->getCityName()."', data: '".$data_city->getCityId()."' },";
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
echo $string."{value: 'Kabupaten Badung', data: '17' },{ value: 'Kabupaten Bangli', data: '32' },{ value: 'Kabupaten Buleleng', data: '94' },{ value: 'Kota Denpasar', data: '114' },{ value: 'Kabupaten Gianyar', data: '128' },{ value: 'Kabupaten Jembrana', data: '161' },{ value: 'Kabupaten Karangasem', data: '170' },{ value: 'Kabupaten Klungkung', data: '197' },{ value: 'Kabupaten Tabanan', data: '447' },";
|
80 |
+
}
|
81 |
+
}
|
app/code/local/Ansyori/Aongkir/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<aongkir translate="title" module="aongkir">
|
12 |
+
<title>Ongkir by Raja Ongkir Section</title>
|
13 |
+
<sort_order>9999</sort_order>
|
14 |
+
</aongkir>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/local/Ansyori/Aongkir/etc/config.xml
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ansyori_Aongkir>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Ansyori_Aongkir>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<aongkir>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Ansyori_Aongkir</module>
|
14 |
+
<frontName>aongkir</frontName>
|
15 |
+
</args>
|
16 |
+
</aongkir>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<aongkir>
|
21 |
+
<file>aongkir.xml</file>
|
22 |
+
</aongkir>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<helpers>
|
28 |
+
<aongkir>
|
29 |
+
<class>Ansyori_Aongkir_Helper</class>
|
30 |
+
</aongkir>
|
31 |
+
</helpers>
|
32 |
+
<blocks>
|
33 |
+
<aongkir>
|
34 |
+
<class>Ansyori_Aongkir_Block</class>
|
35 |
+
</aongkir>
|
36 |
+
</blocks>
|
37 |
+
<models>
|
38 |
+
<aongkir>
|
39 |
+
<class>Ansyori_Aongkir_Model</class>
|
40 |
+
<resourceModel>aongkir_mysql4</resourceModel>
|
41 |
+
</aongkir>
|
42 |
+
<aongkir_mysql4>
|
43 |
+
<class>Ansyori_Aongkir_Model_Mysql4</class>
|
44 |
+
<entities>
|
45 |
+
<area>
|
46 |
+
<table>daftar_alamat</table>
|
47 |
+
</area>
|
48 |
+
</entities>
|
49 |
+
</aongkir_mysql4>
|
50 |
+
</models>
|
51 |
+
<resources>
|
52 |
+
<aongkir_setup>
|
53 |
+
<setup>
|
54 |
+
<module>Ansyori_Aongkir</module>
|
55 |
+
</setup>
|
56 |
+
<connection>
|
57 |
+
<use>core_setup</use>
|
58 |
+
</connection>
|
59 |
+
</aongkir_setup>
|
60 |
+
<aongkir_write>
|
61 |
+
<connection>
|
62 |
+
<use>core_write</use>
|
63 |
+
</connection>
|
64 |
+
</aongkir_write>
|
65 |
+
<aongkir_read>
|
66 |
+
<connection>
|
67 |
+
<use>core_read</use>
|
68 |
+
</connection>
|
69 |
+
</aongkir_read>
|
70 |
+
</resources>
|
71 |
+
</global>
|
72 |
+
<default>
|
73 |
+
<carriers>
|
74 |
+
<ongkir>
|
75 |
+
<active>1</active>
|
76 |
+
<model>aongkir/carrier_ongkir</model>
|
77 |
+
<name>Ongkir</name>
|
78 |
+
<title>Ongkir</title>
|
79 |
+
<description>RajaOngkir.com</description>
|
80 |
+
<sort_order>0</sort_order>
|
81 |
+
</ongkir>
|
82 |
+
</carriers>
|
83 |
+
</default>
|
84 |
+
<crontab>
|
85 |
+
<jobs>
|
86 |
+
<aongkir_updatealamat>
|
87 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
88 |
+
<run><model>aongkir/cron::UpdateAlamat</model></run>
|
89 |
+
</aongkir_updatealamat>
|
90 |
+
</jobs>
|
91 |
+
</crontab>
|
92 |
+
</config>
|
app/code/local/Ansyori/Aongkir/etc/system.xml
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<!--<aongkir translate="label" module="aongkir">
|
5 |
+
<label>Ongkir by Raja Ongkir</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>9999</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<aongkir translate="label">
|
14 |
+
<label>Configuration</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>0</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<enable translate="label">
|
22 |
+
<label>Enable</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>0</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
<comment>Enable This Extension</comment>
|
30 |
+
</enable>
|
31 |
+
<apiurl translate="label">
|
32 |
+
<label>Api URL</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
<comment>http://rajaongkir.com/api/starter or http://rajaongkir.com/api/basic</comment>
|
39 |
+
</apiurl>
|
40 |
+
<apikey translate="label">
|
41 |
+
<label>Api Key</label>
|
42 |
+
<frontend_type>password</frontend_type>
|
43 |
+
<sort_order>2</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
<comment>Get Your API Key at rajaongkir.com</comment>
|
48 |
+
</apikey>
|
49 |
+
<origin translate="label">
|
50 |
+
<label>City Origins</label>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<source_model>Ansyori_Aongkir_Model_System_Config_Source_City</source_model>
|
53 |
+
<sort_order>3</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
<comment>Shipping (you have to enter api key first to get city list)</comment>
|
58 |
+
</origin>
|
59 |
+
<kurir translate="label">
|
60 |
+
<label>Shipping Couriers</label>
|
61 |
+
<frontend_type>multiselect</frontend_type>
|
62 |
+
<source_model>Ansyori_Aongkir_Model_System_Config_Source_Kurir</source_model>
|
63 |
+
<sort_order>4</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>1</show_in_store>
|
67 |
+
<comment>Select Courires</comment>
|
68 |
+
</kurir>
|
69 |
+
</fields>
|
70 |
+
</aongkir>
|
71 |
+
</groups>
|
72 |
+
</aongkir>-->
|
73 |
+
<carriers translate="label" module="aongkir">
|
74 |
+
<groups>
|
75 |
+
<ongkir translate="label">
|
76 |
+
<label>Ongkir by Raja Ongkir</label>
|
77 |
+
<frontend_type>text</frontend_type>
|
78 |
+
<sort_order>0</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
<model>aongkir/carrier_ongkir</model>
|
83 |
+
<fields>
|
84 |
+
<active translate="label">
|
85 |
+
<label>Enabled</label>
|
86 |
+
<frontend_type>select</frontend_type>
|
87 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
88 |
+
<sort_order>1</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
</active>
|
93 |
+
<title translate="label">
|
94 |
+
<label>Title</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<sort_order>2</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
</title>
|
101 |
+
<name translate="label">
|
102 |
+
<label>Method Name</label>
|
103 |
+
<frontend_type>text</frontend_type>
|
104 |
+
<sort_order>3</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
</name>
|
109 |
+
|
110 |
+
<sort_order translate="label">
|
111 |
+
<label>Sort Order</label>
|
112 |
+
<frontend_type>text</frontend_type>
|
113 |
+
<sort_order>100</sort_order>
|
114 |
+
<show_in_default>1</show_in_default>
|
115 |
+
<show_in_website>1</show_in_website>
|
116 |
+
<show_in_store>1</show_in_store>
|
117 |
+
<sort_order>100</sort_order>
|
118 |
+
</sort_order>
|
119 |
+
|
120 |
+
|
121 |
+
<apiurl translate="label">
|
122 |
+
<label>Api URL</label>
|
123 |
+
<frontend_type>text</frontend_type>
|
124 |
+
<sort_order>1</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>1</show_in_store>
|
128 |
+
<comment>http://rajaongkir.com/api/starter or http://rajaongkir.com/api/basic</comment>
|
129 |
+
</apiurl>
|
130 |
+
<apikey translate="label">
|
131 |
+
<label>Api Key</label>
|
132 |
+
<frontend_type>password</frontend_type>
|
133 |
+
<sort_order>2</sort_order>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>1</show_in_website>
|
136 |
+
<show_in_store>1</show_in_store>
|
137 |
+
<comment>Get Your API Key at rajaongkir.com</comment>
|
138 |
+
</apikey>
|
139 |
+
<origin translate="label">
|
140 |
+
<label>City Origins</label>
|
141 |
+
<frontend_type>select</frontend_type>
|
142 |
+
<source_model>Ansyori_Aongkir_Model_System_Config_Source_City</source_model>
|
143 |
+
<sort_order>3</sort_order>
|
144 |
+
<show_in_default>1</show_in_default>
|
145 |
+
<show_in_website>1</show_in_website>
|
146 |
+
<show_in_store>1</show_in_store>
|
147 |
+
<comment>Shipping (you have to enter api key first to get city list)</comment>
|
148 |
+
</origin>
|
149 |
+
<kurir translate="label">
|
150 |
+
<label>Shipping Couriers</label>
|
151 |
+
<frontend_type>multiselect</frontend_type>
|
152 |
+
<source_model>Ansyori_Aongkir_Model_System_Config_Source_Kurir</source_model>
|
153 |
+
<sort_order>4</sort_order>
|
154 |
+
<show_in_default>1</show_in_default>
|
155 |
+
<show_in_website>1</show_in_website>
|
156 |
+
<show_in_store>1</show_in_store>
|
157 |
+
<comment>Select Courires</comment>
|
158 |
+
</kurir>
|
159 |
+
|
160 |
+
<jquery translate="label">
|
161 |
+
<label>Include jQuery Lib</label>
|
162 |
+
<frontend_type>select</frontend_type>
|
163 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
164 |
+
<sort_order>999</sort_order>
|
165 |
+
<show_in_default>1</show_in_default>
|
166 |
+
<show_in_website>1</show_in_website>
|
167 |
+
<show_in_store>1</show_in_store>
|
168 |
+
</jquery>
|
169 |
+
|
170 |
+
|
171 |
+
</fields>
|
172 |
+
</ongkir>
|
173 |
+
</groups>
|
174 |
+
</carriers>
|
175 |
+
</sections>
|
176 |
+
</config>
|
app/code/local/Ansyori/Aongkir/sql/aongkir_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
$installer = $this;
|
10 |
+
|
11 |
+
$installer->startSetup();
|
12 |
+
|
13 |
+
$installer->run("
|
14 |
+
|
15 |
+
DROP TABLE IF EXISTS {$this->getTable('daftar_alamat')};
|
16 |
+
CREATE TABLE {$this->getTable('daftar_alamat')} (
|
17 |
+
idx int(10) unsigned auto_increment NOT NULL ,
|
18 |
+
|
19 |
+
`city_id` int(10) NOT NULL default '0',
|
20 |
+
`province_id` int(10) NOT NULL default '0',
|
21 |
+
`city_name` varchar(255) NOT NULL default '',
|
22 |
+
`province` varchar(255) NOT NULL default '',
|
23 |
+
`type` varchar(255) NOT NULL default '',
|
24 |
+
`postal_code` varchar(30) NOT NULL default '',
|
25 |
+
|
26 |
+
`last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
27 |
+
|
28 |
+
PRIMARY KEY(idx)
|
29 |
+
|
30 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
");
|
37 |
+
/*
|
38 |
+
idx int(10) unsigned NOT NULL auto_increment,
|
39 |
+
website_id int(11) NOT NULL default '0',
|
40 |
+
dest_country_id varchar(4) NOT NULL default '0',
|
41 |
+
dest_region_id int(10) NOT NULL default '0',
|
42 |
+
dest_city varchar(30) NOT NULL default '',
|
43 |
+
dest_zip varchar(10) NOT NULL default '',
|
44 |
+
dest_zip_to varchar(10) NOT NULL default '',
|
45 |
+
condition_name varchar(20) NOT NULL default '',
|
46 |
+
condition_from_value decimal(12,4) NOT NULL default '0.0000',
|
47 |
+
condition_to_value decimal(12,4) NOT NULL default '0.0000',
|
48 |
+
price decimal(12,4) NOT NULL default '0.0000',
|
49 |
+
cost decimal(12,4) NOT NULL default '0.0000',
|
50 |
+
delivery_type varchar(255) NOT NULL default '',
|
51 |
+
*/
|
52 |
+
|
53 |
+
$installer->endSetup();
|
54 |
+
|
55 |
+
|
app/design/frontend/base/default/layout/aongkir.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="1.0.0">
|
3 |
+
<customer_address_form>
|
4 |
+
<reference name="customer_address_edit">
|
5 |
+
<action method="setTemplate"><template>aongkir/edit.phtml</template></action>
|
6 |
+
</reference>
|
7 |
+
</customer_address_form>
|
8 |
+
<checkout_onepage_index>
|
9 |
+
<reference name="checkout.onepage.billing">
|
10 |
+
<action method="setTemplate"><template>aongkir/billing.phtml</template></action>
|
11 |
+
</reference>
|
12 |
+
<reference name="checkout.onepage.shipping">
|
13 |
+
<action method="setTemplate"><template>aongkir/shipping.phtml</template></action>
|
14 |
+
</reference>
|
15 |
+
</checkout_onepage_index>
|
16 |
+
</layout>
|
17 |
+
|
app/design/frontend/base/default/template/aongkir/billing.phtml
ADDED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
|
12 |
+
<?php
|
13 |
+
$penolong = Mage::helper('aongkir');
|
14 |
+
?>
|
15 |
+
|
16 |
+
<form id="co-billing-form" action="">
|
17 |
+
<div class="fieldset">
|
18 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
19 |
+
<ul class="form-list">
|
20 |
+
<?php if ($this->customerHasAddresses()): ?>
|
21 |
+
<li class="wide">
|
22 |
+
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
|
23 |
+
<div class="input-box">
|
24 |
+
<?php echo $this->getAddressesHtmlSelect('billing') ?>
|
25 |
+
</div>
|
26 |
+
</li>
|
27 |
+
<?php endif; ?>
|
28 |
+
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> class="scaffold-form">
|
29 |
+
<div class="fieldset">
|
30 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
31 |
+
<ul>
|
32 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
33 |
+
<li class="fields">
|
34 |
+
<div class="field">
|
35 |
+
<label for="billing:company"><?php echo $this->__('Company') ?></label>
|
36 |
+
<div class="input-box">
|
37 |
+
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
41 |
+
<div class="field">
|
42 |
+
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
43 |
+
<div class="input-box">
|
44 |
+
<input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
<?php endif; ?>
|
48 |
+
</li>
|
49 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
50 |
+
<li class="wide">
|
51 |
+
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
52 |
+
<div class="input-box">
|
53 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
54 |
+
</div>
|
55 |
+
</li>
|
56 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
57 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
58 |
+
<li class="wide">
|
59 |
+
<label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php endfor; ?>
|
65 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
66 |
+
<li class="wide">
|
67 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
68 |
+
<div class="input-box">
|
69 |
+
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php endif; ?>
|
73 |
+
|
74 |
+
<li class="fields">
|
75 |
+
<div class="field">
|
76 |
+
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
77 |
+
<div class="input-box">
|
78 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<div class="field">
|
82 |
+
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
83 |
+
<div class="input-box">
|
84 |
+
<?php echo $this->getCountryHtmlSelect('billing') ?>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
</li>
|
88 |
+
|
89 |
+
<li class="fields">
|
90 |
+
|
91 |
+
<div class="field">
|
92 |
+
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
93 |
+
<div class="input-box">
|
94 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
95 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
96 |
+
</select>
|
97 |
+
<script type="text/javascript">
|
98 |
+
//<![CDATA[
|
99 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
100 |
+
//]]>
|
101 |
+
</script>
|
102 |
+
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<div class="field">
|
107 |
+
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
108 |
+
<div class="input-box">
|
109 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
|
113 |
+
</li>
|
114 |
+
|
115 |
+
<li class="fields">
|
116 |
+
<div class="field">
|
117 |
+
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
118 |
+
<div class="input-box">
|
119 |
+
<input type="tel" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<div class="field">
|
123 |
+
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
|
124 |
+
<div class="input-box">
|
125 |
+
<input type="tel" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
</li>
|
129 |
+
|
130 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
131 |
+
|
132 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
133 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
134 |
+
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
135 |
+
<li class="fields">
|
136 |
+
<?php if ($_dob->isEnabled()): ?>
|
137 |
+
<div class="field">
|
138 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
139 |
+
</div>
|
140 |
+
<?php endif; ?>
|
141 |
+
<?php if ($_gender->isEnabled()): ?>
|
142 |
+
<div class="field">
|
143 |
+
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
144 |
+
</div>
|
145 |
+
<?php endif ?>
|
146 |
+
</li>
|
147 |
+
<?php endif ?>
|
148 |
+
|
149 |
+
<?php if ($this->isTaxvatEnabled()):?>
|
150 |
+
<li><?php echo $this->getTaxvatHtml() ?></li>
|
151 |
+
<?php endif; ?>
|
152 |
+
|
153 |
+
<li class="fields" id="register-customer-password">
|
154 |
+
<div class="field">
|
155 |
+
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
156 |
+
<div class="input-box">
|
157 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
<div class="field">
|
161 |
+
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
162 |
+
<div class="input-box">
|
163 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
</li>
|
167 |
+
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
|
168 |
+
<?php endif; ?>
|
169 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
170 |
+
<li class="control">
|
171 |
+
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
172 |
+
</li>
|
173 |
+
<?php else:?>
|
174 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
175 |
+
<?php endif; ?>
|
176 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
177 |
+
</ul>
|
178 |
+
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
|
179 |
+
</div>
|
180 |
+
</li>
|
181 |
+
<?php if ($this->canShip()): ?>
|
182 |
+
<li class="control">
|
183 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
|
184 |
+
<li class="control">
|
185 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
186 |
+
</li>
|
187 |
+
<?php endif; ?>
|
188 |
+
</ul>
|
189 |
+
<?php if (!$this->canShip()): ?>
|
190 |
+
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
191 |
+
<?php endif; ?>
|
192 |
+
<div class="buttons-set" id="billing-buttons-container">
|
193 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
194 |
+
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
195 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
196 |
+
</span>
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
</form>
|
200 |
+
<script type="text/javascript">
|
201 |
+
//<![CDATA[
|
202 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
203 |
+
var billingForm = new VarienForm('co-billing-form');
|
204 |
+
|
205 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
206 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
207 |
+
|
208 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
209 |
+
if ($('onepage-guest-register-button')) {
|
210 |
+
Event.observe($('onepage-guest-register-button'), 'click', function(event) {
|
211 |
+
var billingRememberMe = $('co-billing-form').select('#remember-me-box');
|
212 |
+
if (billingRememberMe.length > 0) {
|
213 |
+
if ($('login:guest') && $('login:guest').checked) {
|
214 |
+
billingRememberMe[0].hide();
|
215 |
+
} else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
|
216 |
+
billingRememberMe[0].show();
|
217 |
+
}
|
218 |
+
}
|
219 |
+
});
|
220 |
+
}
|
221 |
+
//]]>
|
222 |
+
</script>
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
|
227 |
+
<?php if($penolong->config('jquery')): ?>
|
228 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
229 |
+
<?php endif ?>
|
230 |
+
<script>
|
231 |
+
|
232 |
+
function playAjax_billing(CURRENT_CITY_ID,PROV_ID)
|
233 |
+
{
|
234 |
+
//var CURRENT_CITY_ID =
|
235 |
+
jQuery.ajax({
|
236 |
+
type: 'GET',
|
237 |
+
url: '<?php echo $this->getUrl('aongkir/index/city/')?>',
|
238 |
+
data: 'prov_id='+PROV_ID,
|
239 |
+
dataType: 'json',
|
240 |
+
success: function(data){
|
241 |
+
if(data){
|
242 |
+
|
243 |
+
jQuery('input#billing\\:city').replaceWith('<select name="billing[city]" class=" required-entry" id="billing:city"></select>');
|
244 |
+
|
245 |
+
jQuery('select#billing\\:city').empty().append(
|
246 |
+
jQuery("<option value=''><?php echo $this->__('Please select city') ?></option>")
|
247 |
+
|
248 |
+
|
249 |
+
);
|
250 |
+
|
251 |
+
jQuery.each(data, function(index, city){
|
252 |
+
//console.log('CITY ID : '+city.city_id+' disp name :'+city.display_name);
|
253 |
+
|
254 |
+
if(CURRENT_CITY_ID == city.display_name){
|
255 |
+
jQuery('select#billing\\:city').append(
|
256 |
+
jQuery("<option></option>")
|
257 |
+
.text(city.display_name)
|
258 |
+
.val(city.display_name)
|
259 |
+
.prop('selected','selected')
|
260 |
+
)
|
261 |
+
}else
|
262 |
+
{
|
263 |
+
jQuery('select#billing\\:city').append(
|
264 |
+
jQuery("<option></option>")
|
265 |
+
.text(city.display_name)
|
266 |
+
.val(city.display_name)
|
267 |
+
)
|
268 |
+
}
|
269 |
+
|
270 |
+
});
|
271 |
+
}
|
272 |
+
}
|
273 |
+
});
|
274 |
+
|
275 |
+
|
276 |
+
};
|
277 |
+
|
278 |
+
var aongkir = jQuery.noConflict();
|
279 |
+
|
280 |
+
|
281 |
+
jQuery(document).ready(function(e) {
|
282 |
+
|
283 |
+
var CURRENT_CITY_ID = '<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>' ;
|
284 |
+
var COUNTRY_ID = jQuery('select#billing\\:country_id :selected').val();
|
285 |
+
console.log('CURRENT_CITY_ID is '+CURRENT_CITY_ID);
|
286 |
+
var PROV_ID = jQuery('select#billing\\:region_id :selected').val();
|
287 |
+
|
288 |
+
if(CURRENT_CITY_ID)
|
289 |
+
{
|
290 |
+
playAjax_billing(CURRENT_CITY_ID,PROV_ID);
|
291 |
+
//CURRENT_CITY_ID = jQuery('select#city :selected').val();
|
292 |
+
//jQuery('select#city').find('option[value="'+CURRENT_CITY_ID+'"]').attr('selected', 'selected');
|
293 |
+
};
|
294 |
+
|
295 |
+
jQuery('select#billing\\:region_id').change(function(e) {
|
296 |
+
PROV_ID = jQuery('select#billing\\:region_id :selected').val();
|
297 |
+
playAjax_billing(CURRENT_CITY_ID,PROV_ID);
|
298 |
+
});
|
299 |
+
|
300 |
+
jQuery('select#billing\\:country_id').change(function(e) {
|
301 |
+
|
302 |
+
COUNTRY_ID = jQuery('select#billing\\:country_id :selected').val();
|
303 |
+
|
304 |
+
if(COUNTRY_ID != 'ID')
|
305 |
+
{
|
306 |
+
/*balikin ke awal*/
|
307 |
+
|
308 |
+
jQuery('select#billing\\:city').replaceWith('<input type="text" title="City" name="billing[city]" value="" class="input-text required-entry" id="billing:city">');
|
309 |
+
|
310 |
+
}else
|
311 |
+
{
|
312 |
+
jQuery('select#billing\\:region_id').find('option[value=""]').attr('selected', 'selected');
|
313 |
+
jQuery('input#billing\\:city').replaceWith('<select name="billing[city]" class=" required-entry" id="billing:city"></select>');
|
314 |
+
}
|
315 |
+
|
316 |
+
});
|
317 |
+
|
318 |
+
|
319 |
+
});
|
320 |
+
</script>
|
app/design/frontend/base/default/template/aongkir/edit.phtml
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
$penolong = Mage::helper('aongkir');
|
13 |
+
?>
|
14 |
+
|
15 |
+
<?php if($this->getTitle()): ?>
|
16 |
+
<div class="page-title">
|
17 |
+
<h1><?php echo $this->getTitle() ?></h1>
|
18 |
+
</div>
|
19 |
+
<?php endif; ?>
|
20 |
+
<?php echo $this->getMessagesBlock()->toHtml() ?>
|
21 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
|
22 |
+
<div class="fieldset">
|
23 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
24 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
25 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
26 |
+
<h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
|
27 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
28 |
+
<ul class="form-list">
|
29 |
+
<li class="fields">
|
30 |
+
<?php echo $this->getNameBlockHtml() ?>
|
31 |
+
</li>
|
32 |
+
<li class="wide">
|
33 |
+
<label for="company"><?php echo $this->__('Company') ?></label>
|
34 |
+
<div class="input-box">
|
35 |
+
<input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<li class="fields">
|
39 |
+
<div class="field">
|
40 |
+
<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
41 |
+
<div class="input-box">
|
42 |
+
<input type="tel" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<div class="field">
|
46 |
+
<label for="fax"><?php echo $this->__('Fax') ?></label>
|
47 |
+
<div class="input-box">
|
48 |
+
<input type="tel" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" />
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
</li>
|
52 |
+
</ul>
|
53 |
+
</div>
|
54 |
+
<div class="fieldset">
|
55 |
+
<h2 class="legend"><?php echo $this->__('Address') ?></h2>
|
56 |
+
<ul class="form-list">
|
57 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
58 |
+
<li class="wide">
|
59 |
+
<label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
65 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
66 |
+
<li class="wide">
|
67 |
+
<label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
|
68 |
+
<div class="input-box">
|
69 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php endfor; ?>
|
73 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
74 |
+
<li class="wide">
|
75 |
+
<label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
|
76 |
+
<div class="input-box">
|
77 |
+
<input type="text" name="vat_id" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" id="vat_id" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
78 |
+
</div>
|
79 |
+
</li>
|
80 |
+
<?php endif; ?>
|
81 |
+
|
82 |
+
<li class="fields">
|
83 |
+
<div class="field">
|
84 |
+
<label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
85 |
+
<div class="input-box">
|
86 |
+
<input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<div class="field">
|
90 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
91 |
+
<div class="input-box">
|
92 |
+
<?php echo $this->getCountryHtmlSelect() ?>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
</li>
|
96 |
+
|
97 |
+
<li class="fields">
|
98 |
+
<div class="field">
|
99 |
+
<label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
100 |
+
<div class="input-box">
|
101 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
102 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
103 |
+
</select>
|
104 |
+
<script type="text/javascript">
|
105 |
+
//<![CDATA[
|
106 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
107 |
+
//]]>
|
108 |
+
</script>
|
109 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<div class="field">
|
113 |
+
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
114 |
+
<div class="input-box">
|
115 |
+
<input type="text" name="city" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
</li>
|
120 |
+
|
121 |
+
<li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
|
122 |
+
<?php if($this->isDefaultBilling()): ?>
|
123 |
+
<strong><?php echo $this->__('Default Billing Address') ?></strong>
|
124 |
+
<?php elseif($this->canSetAsDefaultBilling()): ?>
|
125 |
+
<input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as My Default Billing Address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
|
126 |
+
<?php else: ?>
|
127 |
+
<input type="hidden" name="default_billing" value="1" />
|
128 |
+
<?php endif; ?>
|
129 |
+
</li>
|
130 |
+
<li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
|
131 |
+
<?php if($this->isDefaultShipping()): ?>
|
132 |
+
<strong><?php echo $this->__('Default Shipping Address') ?></strong>
|
133 |
+
<?php elseif($this->canSetAsDefaultShipping()): ?>
|
134 |
+
<input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as My Default Shipping Address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
|
135 |
+
<?php else: ?>
|
136 |
+
<input type="hidden" name="default_shipping" value="1" />
|
137 |
+
<?php endif; ?>
|
138 |
+
</li>
|
139 |
+
</ul>
|
140 |
+
</div>
|
141 |
+
<div class="buttons-set">
|
142 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
143 |
+
<button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
|
144 |
+
</div>
|
145 |
+
</form>
|
146 |
+
<script type="text/javascript">
|
147 |
+
//<![CDATA[
|
148 |
+
var dataForm = new VarienForm('form-validate', true);
|
149 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
|
150 |
+
//]]>
|
151 |
+
</script>
|
152 |
+
|
153 |
+
<?php if($penolong->config('jquery')): ?>
|
154 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
155 |
+
<?php endif ?>
|
156 |
+
<script>
|
157 |
+
|
158 |
+
function playAjax(CURRENT_CITY_ID,PROV_ID)
|
159 |
+
{
|
160 |
+
//var CURRENT_CITY_ID =
|
161 |
+
jQuery.ajax({
|
162 |
+
type: 'GET',
|
163 |
+
url: '<?php echo $this->getUrl('aongkir/index/city/')?>',
|
164 |
+
data: 'prov_id='+PROV_ID,
|
165 |
+
dataType: 'json',
|
166 |
+
success: function(data){
|
167 |
+
if(data){
|
168 |
+
|
169 |
+
jQuery('input#city').replaceWith('<select name="city" title="City" class="required-entry" id="city"></select>');
|
170 |
+
|
171 |
+
jQuery('select#city').empty().append(
|
172 |
+
jQuery("<option value=''><?php echo $this->__('Please select city') ?></option>")
|
173 |
+
|
174 |
+
|
175 |
+
);
|
176 |
+
|
177 |
+
jQuery.each(data, function(index, city){
|
178 |
+
//console.log('CITY ID : '+city.city_id+' disp name :'+city.display_name);
|
179 |
+
|
180 |
+
if(CURRENT_CITY_ID == city.display_name){
|
181 |
+
jQuery('select#city').append(
|
182 |
+
jQuery("<option></option>")
|
183 |
+
.text(city.display_name)
|
184 |
+
.val(city.display_name)
|
185 |
+
.prop('selected','selected')
|
186 |
+
)
|
187 |
+
}else
|
188 |
+
{
|
189 |
+
jQuery('select#city').append(
|
190 |
+
jQuery("<option></option>")
|
191 |
+
.text(city.display_name)
|
192 |
+
.val(city.display_name)
|
193 |
+
)
|
194 |
+
}
|
195 |
+
|
196 |
+
});
|
197 |
+
}
|
198 |
+
}
|
199 |
+
});
|
200 |
+
|
201 |
+
|
202 |
+
};
|
203 |
+
|
204 |
+
var aongkir = jQuery.noConflict();
|
205 |
+
|
206 |
+
|
207 |
+
jQuery(document).ready(function(e) {
|
208 |
+
|
209 |
+
var CURRENT_CITY_ID = '<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>' ;
|
210 |
+
var COUNTRY_ID = jQuery('select#country :selected').val();
|
211 |
+
console.log('CURRENT_CITY_ID is '+CURRENT_CITY_ID);
|
212 |
+
var PROV_ID = jQuery('select#region_id :selected').val();
|
213 |
+
|
214 |
+
if(CURRENT_CITY_ID)
|
215 |
+
{
|
216 |
+
playAjax(CURRENT_CITY_ID,PROV_ID);
|
217 |
+
//CURRENT_CITY_ID = jQuery('select#city :selected').val();
|
218 |
+
//jQuery('select#city').find('option[value="'+CURRENT_CITY_ID+'"]').attr('selected', 'selected');
|
219 |
+
};
|
220 |
+
|
221 |
+
jQuery('select#region_id').change(function(e) {
|
222 |
+
PROV_ID = jQuery('select#region_id :selected').val();
|
223 |
+
playAjax(CURRENT_CITY_ID,PROV_ID);
|
224 |
+
});
|
225 |
+
|
226 |
+
jQuery('select#country').change(function(e) {
|
227 |
+
|
228 |
+
COUNTRY_ID = jQuery('select#country :selected').val();
|
229 |
+
|
230 |
+
if(COUNTRY_ID != 'ID')
|
231 |
+
{
|
232 |
+
/*balikin ke awal*/
|
233 |
+
|
234 |
+
jQuery('select#city').replaceWith('<input type="text" name="city" title="City" class="input-text required-entry" id="city">');
|
235 |
+
|
236 |
+
}else
|
237 |
+
{
|
238 |
+
jQuery('select#region_id').find('option[value=""]').attr('selected', 'selected');
|
239 |
+
jQuery('input#city').replaceWith('<select name="city" title="City" class="required-entry" id="city"></select>');
|
240 |
+
}
|
241 |
+
|
242 |
+
});
|
243 |
+
|
244 |
+
|
245 |
+
});
|
246 |
+
</script>
|
app/design/frontend/base/default/template/aongkir/shipping.phtml
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
$penolong = Mage::helper('aongkir');
|
13 |
+
?>
|
14 |
+
|
15 |
+
<form action="" id="co-shipping-form">
|
16 |
+
<ul class="form-list">
|
17 |
+
<?php if ($this->customerHasAddresses()): ?>
|
18 |
+
<li class="wide">
|
19 |
+
<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
|
20 |
+
<div class="input-box">
|
21 |
+
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
22 |
+
</div>
|
23 |
+
</li>
|
24 |
+
<?php endif ?>
|
25 |
+
<li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?> class="scaffold-form">
|
26 |
+
<div class="fieldset">
|
27 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
28 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
29 |
+
<ul>
|
30 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
31 |
+
<li class="fields">
|
32 |
+
<div class="fields">
|
33 |
+
<label for="shipping:company"><?php echo $this->__('Company') ?></label>
|
34 |
+
<div class="input-box">
|
35 |
+
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</li>
|
39 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
40 |
+
<li class="wide">
|
41 |
+
<label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
42 |
+
<div class="input-box">
|
43 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
44 |
+
</div>
|
45 |
+
</li>
|
46 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
47 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
48 |
+
<li class="wide">
|
49 |
+
<label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Address') ?> <?php echo $_i ?></label>
|
50 |
+
<div class="input-box">
|
51 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
52 |
+
</div>
|
53 |
+
</li>
|
54 |
+
<?php endfor; ?>
|
55 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
56 |
+
<li class="wide">
|
57 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
|
58 |
+
<div class="input-box">
|
59 |
+
<input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
60 |
+
</div>
|
61 |
+
</li>
|
62 |
+
<?php endif; ?>
|
63 |
+
|
64 |
+
<li class="fields">
|
65 |
+
<div class="field">
|
66 |
+
<label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
67 |
+
<div class="input-box">
|
68 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
<div class="field">
|
72 |
+
<label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
73 |
+
<div class="input-box">
|
74 |
+
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
</li>
|
78 |
+
|
79 |
+
<li class="fields">
|
80 |
+
<div class="field">
|
81 |
+
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
82 |
+
<div class="input-box">
|
83 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
84 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
85 |
+
</select>
|
86 |
+
<script type="text/javascript">
|
87 |
+
//<![CDATA[
|
88 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
89 |
+
//]]>
|
90 |
+
</script>
|
91 |
+
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
|
95 |
+
<div class="field">
|
96 |
+
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
97 |
+
<div class="input-box">
|
98 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
</li>
|
103 |
+
|
104 |
+
<li class="fields">
|
105 |
+
<div class="field">
|
106 |
+
<label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
107 |
+
<div class="input-box">
|
108 |
+
<input type="tel" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
<div class="field">
|
112 |
+
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
|
113 |
+
<div class="input-box">
|
114 |
+
<input type="tel" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
</li>
|
118 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
119 |
+
<li class="control">
|
120 |
+
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
121 |
+
<?php else:?>
|
122 |
+
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
123 |
+
<?php endif;?>
|
124 |
+
</ul>
|
125 |
+
</div>
|
126 |
+
</li>
|
127 |
+
<li class="control">
|
128 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
|
129 |
+
</li>
|
130 |
+
</ul>
|
131 |
+
<div class="buttons-set" id="shipping-buttons-container">
|
132 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
133 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
134 |
+
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
135 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
136 |
+
</span>
|
137 |
+
</div>
|
138 |
+
</form>
|
139 |
+
<script type="text/javascript">
|
140 |
+
//<![CDATA[
|
141 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
142 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
143 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
144 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
145 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
146 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
147 |
+
|
148 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
149 |
+
//]]>
|
150 |
+
</script>
|
151 |
+
|
152 |
+
|
153 |
+
<?php if($penolong->config('jquery')): ?>
|
154 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
155 |
+
<?php endif ?>
|
156 |
+
<script>
|
157 |
+
|
158 |
+
function playAjaxShipping(CURRENT_CITY_ID,PROV_ID)
|
159 |
+
{
|
160 |
+
//var CURRENT_CITY_ID =
|
161 |
+
jQuery.ajax({
|
162 |
+
type: 'GET',
|
163 |
+
url: '<?php echo $this->getUrl('aongkir/index/city/')?>',
|
164 |
+
data: 'prov_id='+PROV_ID,
|
165 |
+
dataType: 'json',
|
166 |
+
success: function(data){
|
167 |
+
if(data){
|
168 |
+
|
169 |
+
jQuery('input#shipping\\:city').replaceWith('<select name="shipping[city]" class=" required-entry" id="shipping:city"></select>');
|
170 |
+
|
171 |
+
jQuery('select#shipping\\:city').empty().append(
|
172 |
+
jQuery("<option value=''><?php echo $this->__('Please select city') ?></option>")
|
173 |
+
|
174 |
+
|
175 |
+
);
|
176 |
+
|
177 |
+
jQuery.each(data, function(index, city){
|
178 |
+
//console.log('CITY ID : '+city.city_id+' disp name :'+city.display_name);
|
179 |
+
|
180 |
+
if(CURRENT_CITY_ID == city.display_name){
|
181 |
+
jQuery('select#shipping\\:city').append(
|
182 |
+
jQuery("<option></option>")
|
183 |
+
.text(city.display_name)
|
184 |
+
.val(city.display_name)
|
185 |
+
.prop('selected','selected')
|
186 |
+
)
|
187 |
+
}else
|
188 |
+
{
|
189 |
+
jQuery('select#shipping\\:city').append(
|
190 |
+
jQuery("<option></option>")
|
191 |
+
.text(city.display_name)
|
192 |
+
.val(city.display_name)
|
193 |
+
)
|
194 |
+
}
|
195 |
+
|
196 |
+
});
|
197 |
+
}
|
198 |
+
}
|
199 |
+
});
|
200 |
+
|
201 |
+
|
202 |
+
};
|
203 |
+
|
204 |
+
var aongkir = jQuery.noConflict();
|
205 |
+
|
206 |
+
|
207 |
+
jQuery(document).ready(function(e) {
|
208 |
+
|
209 |
+
var CURRENT_CITY_ID = '<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>' ;
|
210 |
+
var COUNTRY_ID = jQuery('select#shipping\\:country_id :selected').val();
|
211 |
+
console.log('CURRENT_CITY_ID is '+CURRENT_CITY_ID);
|
212 |
+
var PROV_ID = jQuery('select#shipping\\:region_id :selected').val();
|
213 |
+
|
214 |
+
if(CURRENT_CITY_ID)
|
215 |
+
{
|
216 |
+
playAjaxShipping(CURRENT_CITY_ID,PROV_ID);
|
217 |
+
//CURRENT_CITY_ID = jQuery('select#city :selected').val();
|
218 |
+
//jQuery('select#city').find('option[value="'+CURRENT_CITY_ID+'"]').attr('selected', 'selected');
|
219 |
+
};
|
220 |
+
|
221 |
+
jQuery('select#shipping\\:region_id').change(function(e) {
|
222 |
+
PROV_ID = jQuery('select#shipping\\:region_id :selected').val();
|
223 |
+
playAjaxShipping(CURRENT_CITY_ID,PROV_ID);
|
224 |
+
});
|
225 |
+
|
226 |
+
jQuery('select#shipping\\:country_id').change(function(e) {
|
227 |
+
|
228 |
+
COUNTRY_ID = jQuery('select#shipping\\:country_id :selected').val();
|
229 |
+
|
230 |
+
if(COUNTRY_ID != 'ID')
|
231 |
+
{
|
232 |
+
/*balikin ke awal*/
|
233 |
+
|
234 |
+
jQuery('select#shipping\\:city').replaceWith('<input type="text" title="City" name="shipping[city]" value="" class="input-text required-entry" id="shipping:city">');
|
235 |
+
|
236 |
+
}else
|
237 |
+
{
|
238 |
+
jQuery('select#shipping\\:region_id').find('option[value=""]').attr('selected', 'selected');
|
239 |
+
jQuery('input#shipping\\:city').replaceWith('<select name="shipping[city]" class=" required-entry" id="shipping:city"></select>');
|
240 |
+
}
|
241 |
+
|
242 |
+
});
|
243 |
+
|
244 |
+
|
245 |
+
});
|
246 |
+
</script>
|
app/design/frontend/rwd/default/layout/aongkir.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="1.0.0">
|
3 |
+
<customer_address_form>
|
4 |
+
<reference name="customer_address_edit">
|
5 |
+
<action method="setTemplate"><template>aongkir/edit.phtml</template></action>
|
6 |
+
</reference>
|
7 |
+
</customer_address_form>
|
8 |
+
<checkout_onepage_index>
|
9 |
+
<reference name="checkout.onepage.billing">
|
10 |
+
<action method="setTemplate"><template>aongkir/billing.phtml</template></action>
|
11 |
+
</reference>
|
12 |
+
<reference name="checkout.onepage.shipping">
|
13 |
+
<action method="setTemplate"><template>aongkir/shipping.phtml</template></action>
|
14 |
+
</reference>
|
15 |
+
</checkout_onepage_index>
|
16 |
+
</layout>
|
17 |
+
|
app/design/frontend/rwd/default/template/aongkir/billing.phtml
ADDED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
|
12 |
+
<?php
|
13 |
+
$penolong = Mage::helper('aongkir');
|
14 |
+
?>
|
15 |
+
|
16 |
+
<form id="co-billing-form" action="">
|
17 |
+
<div class="fieldset">
|
18 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
19 |
+
<ul class="form-list">
|
20 |
+
<?php if ($this->customerHasAddresses()): ?>
|
21 |
+
<li class="wide">
|
22 |
+
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
|
23 |
+
<div class="input-box">
|
24 |
+
<?php echo $this->getAddressesHtmlSelect('billing') ?>
|
25 |
+
</div>
|
26 |
+
</li>
|
27 |
+
<?php endif; ?>
|
28 |
+
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> class="scaffold-form">
|
29 |
+
<div class="fieldset">
|
30 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
31 |
+
<ul>
|
32 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
33 |
+
<li class="fields">
|
34 |
+
<div class="field">
|
35 |
+
<label for="billing:company"><?php echo $this->__('Company') ?></label>
|
36 |
+
<div class="input-box">
|
37 |
+
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
41 |
+
<div class="field">
|
42 |
+
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
43 |
+
<div class="input-box">
|
44 |
+
<input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
<?php endif; ?>
|
48 |
+
</li>
|
49 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
50 |
+
<li class="wide">
|
51 |
+
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
52 |
+
<div class="input-box">
|
53 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
54 |
+
</div>
|
55 |
+
</li>
|
56 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
57 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
58 |
+
<li class="wide">
|
59 |
+
<label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php endfor; ?>
|
65 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
66 |
+
<li class="wide">
|
67 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
|
68 |
+
<div class="input-box">
|
69 |
+
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php endif; ?>
|
73 |
+
|
74 |
+
<li class="fields">
|
75 |
+
<div class="field">
|
76 |
+
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
77 |
+
<div class="input-box">
|
78 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<div class="field">
|
82 |
+
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
83 |
+
<div class="input-box">
|
84 |
+
<?php echo $this->getCountryHtmlSelect('billing') ?>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
</li>
|
88 |
+
|
89 |
+
<li class="fields">
|
90 |
+
|
91 |
+
<div class="field">
|
92 |
+
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
93 |
+
<div class="input-box">
|
94 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
95 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
96 |
+
</select>
|
97 |
+
<script type="text/javascript">
|
98 |
+
//<![CDATA[
|
99 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
100 |
+
//]]>
|
101 |
+
</script>
|
102 |
+
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
|
106 |
+
<div class="field">
|
107 |
+
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
108 |
+
<div class="input-box">
|
109 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
|
113 |
+
</li>
|
114 |
+
|
115 |
+
<li class="fields">
|
116 |
+
<div class="field">
|
117 |
+
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
118 |
+
<div class="input-box">
|
119 |
+
<input type="tel" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<div class="field">
|
123 |
+
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
|
124 |
+
<div class="input-box">
|
125 |
+
<input type="tel" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
</li>
|
129 |
+
|
130 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
131 |
+
|
132 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
133 |
+
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
134 |
+
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
|
135 |
+
<li class="fields">
|
136 |
+
<?php if ($_dob->isEnabled()): ?>
|
137 |
+
<div class="field">
|
138 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
139 |
+
</div>
|
140 |
+
<?php endif; ?>
|
141 |
+
<?php if ($_gender->isEnabled()): ?>
|
142 |
+
<div class="field">
|
143 |
+
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
144 |
+
</div>
|
145 |
+
<?php endif ?>
|
146 |
+
</li>
|
147 |
+
<?php endif ?>
|
148 |
+
|
149 |
+
<?php if ($this->isTaxvatEnabled()):?>
|
150 |
+
<li><?php echo $this->getTaxvatHtml() ?></li>
|
151 |
+
<?php endif; ?>
|
152 |
+
|
153 |
+
<li class="fields" id="register-customer-password">
|
154 |
+
<div class="field">
|
155 |
+
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
156 |
+
<div class="input-box">
|
157 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
<div class="field">
|
161 |
+
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
|
162 |
+
<div class="input-box">
|
163 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
</li>
|
167 |
+
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
|
168 |
+
<?php endif; ?>
|
169 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
170 |
+
<li class="control">
|
171 |
+
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
172 |
+
</li>
|
173 |
+
<?php else:?>
|
174 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
175 |
+
<?php endif; ?>
|
176 |
+
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
177 |
+
</ul>
|
178 |
+
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
|
179 |
+
</div>
|
180 |
+
</li>
|
181 |
+
<?php if ($this->canShip()): ?>
|
182 |
+
<li class="control">
|
183 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
|
184 |
+
<li class="control">
|
185 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
186 |
+
</li>
|
187 |
+
<?php endif; ?>
|
188 |
+
</ul>
|
189 |
+
<?php if (!$this->canShip()): ?>
|
190 |
+
<input type="hidden" name="billing[use_for_shipping]" value="1" />
|
191 |
+
<?php endif; ?>
|
192 |
+
<div class="buttons-set" id="billing-buttons-container">
|
193 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
194 |
+
<span class="please-wait" id="billing-please-wait" style="display:none;">
|
195 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
196 |
+
</span>
|
197 |
+
</div>
|
198 |
+
</div>
|
199 |
+
</form>
|
200 |
+
<script type="text/javascript">
|
201 |
+
//<![CDATA[
|
202 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
203 |
+
var billingForm = new VarienForm('co-billing-form');
|
204 |
+
|
205 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
206 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
207 |
+
|
208 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
|
209 |
+
if ($('onepage-guest-register-button')) {
|
210 |
+
Event.observe($('onepage-guest-register-button'), 'click', function(event) {
|
211 |
+
var billingRememberMe = $('co-billing-form').select('#remember-me-box');
|
212 |
+
if (billingRememberMe.length > 0) {
|
213 |
+
if ($('login:guest') && $('login:guest').checked) {
|
214 |
+
billingRememberMe[0].hide();
|
215 |
+
} else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
|
216 |
+
billingRememberMe[0].show();
|
217 |
+
}
|
218 |
+
}
|
219 |
+
});
|
220 |
+
}
|
221 |
+
//]]>
|
222 |
+
</script>
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
|
227 |
+
<?php if($penolong->config('jquery')): ?>
|
228 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
229 |
+
<?php endif ?>
|
230 |
+
<script>
|
231 |
+
|
232 |
+
function playAjax_billing(CURRENT_CITY_ID,PROV_ID)
|
233 |
+
{
|
234 |
+
//var CURRENT_CITY_ID =
|
235 |
+
jQuery.ajax({
|
236 |
+
type: 'GET',
|
237 |
+
url: '<?php echo $this->getUrl('aongkir/index/city/')?>',
|
238 |
+
data: 'prov_id='+PROV_ID,
|
239 |
+
dataType: 'json',
|
240 |
+
success: function(data){
|
241 |
+
if(data){
|
242 |
+
|
243 |
+
jQuery('input#billing\\:city').replaceWith('<select name="billing[city]" class=" required-entry" id="billing:city"></select>');
|
244 |
+
|
245 |
+
jQuery('select#billing\\:city').empty().append(
|
246 |
+
jQuery("<option value=''><?php echo $this->__('Please select city') ?></option>")
|
247 |
+
|
248 |
+
|
249 |
+
);
|
250 |
+
|
251 |
+
jQuery.each(data, function(index, city){
|
252 |
+
//console.log('CITY ID : '+city.city_id+' disp name :'+city.display_name);
|
253 |
+
|
254 |
+
if(CURRENT_CITY_ID == city.display_name){
|
255 |
+
jQuery('select#billing\\:city').append(
|
256 |
+
jQuery("<option></option>")
|
257 |
+
.text(city.display_name)
|
258 |
+
.val(city.display_name)
|
259 |
+
.prop('selected','selected')
|
260 |
+
)
|
261 |
+
}else
|
262 |
+
{
|
263 |
+
jQuery('select#billing\\:city').append(
|
264 |
+
jQuery("<option></option>")
|
265 |
+
.text(city.display_name)
|
266 |
+
.val(city.display_name)
|
267 |
+
)
|
268 |
+
}
|
269 |
+
|
270 |
+
});
|
271 |
+
}
|
272 |
+
}
|
273 |
+
});
|
274 |
+
|
275 |
+
|
276 |
+
};
|
277 |
+
|
278 |
+
var aongkir = jQuery.noConflict();
|
279 |
+
|
280 |
+
|
281 |
+
jQuery(document).ready(function(e) {
|
282 |
+
|
283 |
+
var CURRENT_CITY_ID = '<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>' ;
|
284 |
+
var COUNTRY_ID = jQuery('select#billing\\:country_id :selected').val();
|
285 |
+
console.log('CURRENT_CITY_ID is '+CURRENT_CITY_ID);
|
286 |
+
var PROV_ID = jQuery('select#billing\\:region_id :selected').val();
|
287 |
+
|
288 |
+
if(CURRENT_CITY_ID)
|
289 |
+
{
|
290 |
+
playAjax_billing(CURRENT_CITY_ID,PROV_ID);
|
291 |
+
//CURRENT_CITY_ID = jQuery('select#city :selected').val();
|
292 |
+
//jQuery('select#city').find('option[value="'+CURRENT_CITY_ID+'"]').attr('selected', 'selected');
|
293 |
+
};
|
294 |
+
|
295 |
+
jQuery('select#billing\\:region_id').change(function(e) {
|
296 |
+
PROV_ID = jQuery('select#billing\\:region_id :selected').val();
|
297 |
+
playAjax_billing(CURRENT_CITY_ID,PROV_ID);
|
298 |
+
});
|
299 |
+
|
300 |
+
jQuery('select#billing\\:country_id').change(function(e) {
|
301 |
+
|
302 |
+
COUNTRY_ID = jQuery('select#billing\\:country_id :selected').val();
|
303 |
+
|
304 |
+
if(COUNTRY_ID != 'ID')
|
305 |
+
{
|
306 |
+
/*balikin ke awal*/
|
307 |
+
|
308 |
+
jQuery('select#billing\\:city').replaceWith('<input type="text" title="City" name="billing[city]" value="" class="input-text required-entry" id="billing:city">');
|
309 |
+
|
310 |
+
}else
|
311 |
+
{
|
312 |
+
jQuery('select#billing\\:region_id').find('option[value=""]').attr('selected', 'selected');
|
313 |
+
jQuery('input#billing\\:city').replaceWith('<select name="billing[city]" class=" required-entry" id="billing:city"></select>');
|
314 |
+
}
|
315 |
+
|
316 |
+
});
|
317 |
+
|
318 |
+
|
319 |
+
});
|
320 |
+
</script>
|
app/design/frontend/rwd/default/template/aongkir/edit.phtml
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
$penolong = Mage::helper('aongkir');
|
13 |
+
?>
|
14 |
+
|
15 |
+
<?php if($this->getTitle()): ?>
|
16 |
+
<div class="page-title">
|
17 |
+
<h1><?php echo $this->getTitle() ?></h1>
|
18 |
+
</div>
|
19 |
+
<?php endif; ?>
|
20 |
+
<?php echo $this->getMessagesBlock()->toHtml() ?>
|
21 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
|
22 |
+
<div class="fieldset">
|
23 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
24 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
25 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
26 |
+
<h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
|
27 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
28 |
+
<ul class="form-list">
|
29 |
+
<li class="fields">
|
30 |
+
<?php echo $this->getNameBlockHtml() ?>
|
31 |
+
</li>
|
32 |
+
<li class="wide">
|
33 |
+
<label for="company"><?php echo $this->__('Company') ?></label>
|
34 |
+
<div class="input-box">
|
35 |
+
<input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<li class="fields">
|
39 |
+
<div class="field">
|
40 |
+
<label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
41 |
+
<div class="input-box">
|
42 |
+
<input type="tel" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<div class="field">
|
46 |
+
<label for="fax"><?php echo $this->__('Fax') ?></label>
|
47 |
+
<div class="input-box">
|
48 |
+
<input type="tel" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" />
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
</li>
|
52 |
+
</ul>
|
53 |
+
</div>
|
54 |
+
<div class="fieldset">
|
55 |
+
<h2 class="legend"><?php echo $this->__('Address') ?></h2>
|
56 |
+
<ul class="form-list">
|
57 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
58 |
+
<li class="wide">
|
59 |
+
<label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
|
60 |
+
<div class="input-box">
|
61 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
65 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
66 |
+
<li class="wide">
|
67 |
+
<label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Street Address %s', $_i) ?></label>
|
68 |
+
<div class="input-box">
|
69 |
+
<input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php endfor; ?>
|
73 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
74 |
+
<li class="wide">
|
75 |
+
<label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
|
76 |
+
<div class="input-box">
|
77 |
+
<input type="text" name="vat_id" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" id="vat_id" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
78 |
+
</div>
|
79 |
+
</li>
|
80 |
+
<?php endif; ?>
|
81 |
+
|
82 |
+
<li class="fields">
|
83 |
+
<div class="field">
|
84 |
+
<label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
85 |
+
<div class="input-box">
|
86 |
+
<input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<div class="field">
|
90 |
+
<label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
91 |
+
<div class="input-box">
|
92 |
+
<?php echo $this->getCountryHtmlSelect() ?>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
</li>
|
96 |
+
|
97 |
+
<li class="fields">
|
98 |
+
<div class="field">
|
99 |
+
<label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
100 |
+
<div class="input-box">
|
101 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
102 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
103 |
+
</select>
|
104 |
+
<script type="text/javascript">
|
105 |
+
//<![CDATA[
|
106 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
107 |
+
//]]>
|
108 |
+
</script>
|
109 |
+
<input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<div class="field">
|
113 |
+
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
114 |
+
<div class="input-box">
|
115 |
+
<input type="text" name="city" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
</li>
|
120 |
+
|
121 |
+
<li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
|
122 |
+
<?php if($this->isDefaultBilling()): ?>
|
123 |
+
<strong><?php echo $this->__('Default Billing Address') ?></strong>
|
124 |
+
<?php elseif($this->canSetAsDefaultBilling()): ?>
|
125 |
+
<input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as My Default Billing Address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
|
126 |
+
<?php else: ?>
|
127 |
+
<input type="hidden" name="default_billing" value="1" />
|
128 |
+
<?php endif; ?>
|
129 |
+
</li>
|
130 |
+
<li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
|
131 |
+
<?php if($this->isDefaultShipping()): ?>
|
132 |
+
<strong><?php echo $this->__('Default Shipping Address') ?></strong>
|
133 |
+
<?php elseif($this->canSetAsDefaultShipping()): ?>
|
134 |
+
<input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as My Default Shipping Address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
|
135 |
+
<?php else: ?>
|
136 |
+
<input type="hidden" name="default_shipping" value="1" />
|
137 |
+
<?php endif; ?>
|
138 |
+
</li>
|
139 |
+
</ul>
|
140 |
+
</div>
|
141 |
+
<div class="buttons-set">
|
142 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
143 |
+
<button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
|
144 |
+
</div>
|
145 |
+
</form>
|
146 |
+
<script type="text/javascript">
|
147 |
+
//<![CDATA[
|
148 |
+
var dataForm = new VarienForm('form-validate', true);
|
149 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
|
150 |
+
//]]>
|
151 |
+
</script>
|
152 |
+
|
153 |
+
<?php if($penolong->config('jquery')): ?>
|
154 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
155 |
+
<?php endif ?>
|
156 |
+
<script>
|
157 |
+
|
158 |
+
function playAjax(CURRENT_CITY_ID,PROV_ID)
|
159 |
+
{
|
160 |
+
//var CURRENT_CITY_ID =
|
161 |
+
jQuery.ajax({
|
162 |
+
type: 'GET',
|
163 |
+
url: '<?php echo $this->getUrl('aongkir/index/city/')?>',
|
164 |
+
data: 'prov_id='+PROV_ID,
|
165 |
+
dataType: 'json',
|
166 |
+
success: function(data){
|
167 |
+
if(data){
|
168 |
+
|
169 |
+
jQuery('input#city').replaceWith('<select name="city" title="City" class="required-entry" id="city"></select>');
|
170 |
+
|
171 |
+
jQuery('select#city').empty().append(
|
172 |
+
jQuery("<option value=''><?php echo $this->__('Please select city') ?></option>")
|
173 |
+
|
174 |
+
|
175 |
+
);
|
176 |
+
|
177 |
+
jQuery.each(data, function(index, city){
|
178 |
+
//console.log('CITY ID : '+city.city_id+' disp name :'+city.display_name);
|
179 |
+
|
180 |
+
if(CURRENT_CITY_ID == city.display_name){
|
181 |
+
jQuery('select#city').append(
|
182 |
+
jQuery("<option></option>")
|
183 |
+
.text(city.display_name)
|
184 |
+
.val(city.display_name)
|
185 |
+
.prop('selected','selected')
|
186 |
+
)
|
187 |
+
}else
|
188 |
+
{
|
189 |
+
jQuery('select#city').append(
|
190 |
+
jQuery("<option></option>")
|
191 |
+
.text(city.display_name)
|
192 |
+
.val(city.display_name)
|
193 |
+
)
|
194 |
+
}
|
195 |
+
|
196 |
+
});
|
197 |
+
}
|
198 |
+
}
|
199 |
+
});
|
200 |
+
|
201 |
+
|
202 |
+
};
|
203 |
+
|
204 |
+
var aongkir = jQuery.noConflict();
|
205 |
+
|
206 |
+
|
207 |
+
jQuery(document).ready(function(e) {
|
208 |
+
|
209 |
+
var CURRENT_CITY_ID = '<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>' ;
|
210 |
+
var COUNTRY_ID = jQuery('select#country :selected').val();
|
211 |
+
console.log('CURRENT_CITY_ID is '+CURRENT_CITY_ID);
|
212 |
+
var PROV_ID = jQuery('select#region_id :selected').val();
|
213 |
+
|
214 |
+
if(CURRENT_CITY_ID)
|
215 |
+
{
|
216 |
+
playAjax(CURRENT_CITY_ID,PROV_ID);
|
217 |
+
//CURRENT_CITY_ID = jQuery('select#city :selected').val();
|
218 |
+
//jQuery('select#city').find('option[value="'+CURRENT_CITY_ID+'"]').attr('selected', 'selected');
|
219 |
+
};
|
220 |
+
|
221 |
+
jQuery('select#region_id').change(function(e) {
|
222 |
+
PROV_ID = jQuery('select#region_id :selected').val();
|
223 |
+
playAjax(CURRENT_CITY_ID,PROV_ID);
|
224 |
+
});
|
225 |
+
|
226 |
+
jQuery('select#country').change(function(e) {
|
227 |
+
|
228 |
+
COUNTRY_ID = jQuery('select#country :selected').val();
|
229 |
+
|
230 |
+
if(COUNTRY_ID != 'ID')
|
231 |
+
{
|
232 |
+
/*balikin ke awal*/
|
233 |
+
|
234 |
+
jQuery('select#city').replaceWith('<input type="text" name="city" title="City" class="input-text required-entry" id="city">');
|
235 |
+
|
236 |
+
}else
|
237 |
+
{
|
238 |
+
jQuery('select#region_id').find('option[value=""]').attr('selected', 'selected');
|
239 |
+
jQuery('input#city').replaceWith('<select name="city" title="City" class="required-entry" id="city"></select>');
|
240 |
+
}
|
241 |
+
|
242 |
+
});
|
243 |
+
|
244 |
+
|
245 |
+
});
|
246 |
+
</script>
|
app/design/frontend/rwd/default/template/aongkir/shipping.phtml
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Indonesia Shipping Carriers
|
4 |
+
* @copyright Copyright (c) 2015 Ansyori B.
|
5 |
+
* @email ansyori@gmail.com / ansyori@kemanaservices.com
|
6 |
+
* @build_date March 2015
|
7 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
8 |
+
*/
|
9 |
+
?>
|
10 |
+
|
11 |
+
<?php
|
12 |
+
$penolong = Mage::helper('aongkir');
|
13 |
+
?>
|
14 |
+
|
15 |
+
<form action="" id="co-shipping-form">
|
16 |
+
<ul class="form-list">
|
17 |
+
<?php if ($this->customerHasAddresses()): ?>
|
18 |
+
<li class="wide">
|
19 |
+
<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
|
20 |
+
<div class="input-box">
|
21 |
+
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
22 |
+
</div>
|
23 |
+
</li>
|
24 |
+
<?php endif ?>
|
25 |
+
<li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?> class="scaffold-form">
|
26 |
+
<div class="fieldset">
|
27 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
28 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
29 |
+
<ul>
|
30 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
31 |
+
<li class="fields">
|
32 |
+
<div class="fields">
|
33 |
+
<label for="shipping:company"><?php echo $this->__('Company') ?></label>
|
34 |
+
<div class="input-box">
|
35 |
+
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
</li>
|
39 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
40 |
+
<li class="wide">
|
41 |
+
<label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
42 |
+
<div class="input-box">
|
43 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
44 |
+
</div>
|
45 |
+
</li>
|
46 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
47 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
48 |
+
<li class="wide">
|
49 |
+
<label for="billing:street<?php echo $_i ?>"><?php echo $this->__('Address') ?> <?php echo $_i ?></label>
|
50 |
+
<div class="input-box">
|
51 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
52 |
+
</div>
|
53 |
+
</li>
|
54 |
+
<?php endfor; ?>
|
55 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
56 |
+
<li class="wide">
|
57 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
|
58 |
+
<div class="input-box">
|
59 |
+
<input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
60 |
+
</div>
|
61 |
+
</li>
|
62 |
+
<?php endif; ?>
|
63 |
+
|
64 |
+
<li class="fields">
|
65 |
+
<div class="field">
|
66 |
+
<label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
67 |
+
<div class="input-box">
|
68 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
<div class="field">
|
72 |
+
<label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
73 |
+
<div class="input-box">
|
74 |
+
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
</li>
|
78 |
+
|
79 |
+
<li class="fields">
|
80 |
+
<div class="field">
|
81 |
+
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
82 |
+
<div class="input-box">
|
83 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
84 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
85 |
+
</select>
|
86 |
+
<script type="text/javascript">
|
87 |
+
//<![CDATA[
|
88 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
89 |
+
//]]>
|
90 |
+
</script>
|
91 |
+
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
|
95 |
+
<div class="field">
|
96 |
+
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
97 |
+
<div class="input-box">
|
98 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
</li>
|
103 |
+
|
104 |
+
<li class="fields">
|
105 |
+
<div class="field">
|
106 |
+
<label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
107 |
+
<div class="input-box">
|
108 |
+
<input type="tel" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
<div class="field">
|
112 |
+
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
|
113 |
+
<div class="input-box">
|
114 |
+
<input type="tel" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
</li>
|
118 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
119 |
+
<li class="control">
|
120 |
+
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
121 |
+
<?php else:?>
|
122 |
+
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
123 |
+
<?php endif;?>
|
124 |
+
</ul>
|
125 |
+
</div>
|
126 |
+
</li>
|
127 |
+
<li class="control">
|
128 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
|
129 |
+
</li>
|
130 |
+
</ul>
|
131 |
+
<div class="buttons-set" id="shipping-buttons-container">
|
132 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
133 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
134 |
+
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
135 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
136 |
+
</span>
|
137 |
+
</div>
|
138 |
+
</form>
|
139 |
+
<script type="text/javascript">
|
140 |
+
//<![CDATA[
|
141 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
142 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
143 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
144 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
145 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
146 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
147 |
+
|
148 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
149 |
+
//]]>
|
150 |
+
</script>
|
151 |
+
|
152 |
+
|
153 |
+
<?php if($penolong->config('jquery')): ?>
|
154 |
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
155 |
+
<?php endif ?>
|
156 |
+
<script>
|
157 |
+
|
158 |
+
function playAjaxShipping(CURRENT_CITY_ID,PROV_ID)
|
159 |
+
{
|
160 |
+
//var CURRENT_CITY_ID =
|
161 |
+
jQuery.ajax({
|
162 |
+
type: 'GET',
|
163 |
+
url: '<?php echo $this->getUrl('aongkir/index/city/')?>',
|
164 |
+
data: 'prov_id='+PROV_ID,
|
165 |
+
dataType: 'json',
|
166 |
+
success: function(data){
|
167 |
+
if(data){
|
168 |
+
|
169 |
+
jQuery('input#shipping\\:city').replaceWith('<select name="shipping[city]" class=" required-entry" id="shipping:city"></select>');
|
170 |
+
|
171 |
+
jQuery('select#shipping\\:city').empty().append(
|
172 |
+
jQuery("<option value=''><?php echo $this->__('Please select city') ?></option>")
|
173 |
+
|
174 |
+
|
175 |
+
);
|
176 |
+
|
177 |
+
jQuery.each(data, function(index, city){
|
178 |
+
//console.log('CITY ID : '+city.city_id+' disp name :'+city.display_name);
|
179 |
+
|
180 |
+
if(CURRENT_CITY_ID == city.display_name){
|
181 |
+
jQuery('select#shipping\\:city').append(
|
182 |
+
jQuery("<option></option>")
|
183 |
+
.text(city.display_name)
|
184 |
+
.val(city.display_name)
|
185 |
+
.prop('selected','selected')
|
186 |
+
)
|
187 |
+
}else
|
188 |
+
{
|
189 |
+
jQuery('select#shipping\\:city').append(
|
190 |
+
jQuery("<option></option>")
|
191 |
+
.text(city.display_name)
|
192 |
+
.val(city.display_name)
|
193 |
+
)
|
194 |
+
}
|
195 |
+
|
196 |
+
});
|
197 |
+
}
|
198 |
+
}
|
199 |
+
});
|
200 |
+
|
201 |
+
|
202 |
+
};
|
203 |
+
|
204 |
+
var aongkir = jQuery.noConflict();
|
205 |
+
|
206 |
+
|
207 |
+
jQuery(document).ready(function(e) {
|
208 |
+
|
209 |
+
var CURRENT_CITY_ID = '<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>' ;
|
210 |
+
var COUNTRY_ID = jQuery('select#shipping\\:country_id :selected').val();
|
211 |
+
console.log('CURRENT_CITY_ID is '+CURRENT_CITY_ID);
|
212 |
+
var PROV_ID = jQuery('select#shipping\\:region_id :selected').val();
|
213 |
+
|
214 |
+
if(CURRENT_CITY_ID)
|
215 |
+
{
|
216 |
+
playAjaxShipping(CURRENT_CITY_ID,PROV_ID);
|
217 |
+
//CURRENT_CITY_ID = jQuery('select#city :selected').val();
|
218 |
+
//jQuery('select#city').find('option[value="'+CURRENT_CITY_ID+'"]').attr('selected', 'selected');
|
219 |
+
};
|
220 |
+
|
221 |
+
jQuery('select#shipping\\:region_id').change(function(e) {
|
222 |
+
PROV_ID = jQuery('select#shipping\\:region_id :selected').val();
|
223 |
+
playAjaxShipping(CURRENT_CITY_ID,PROV_ID);
|
224 |
+
});
|
225 |
+
|
226 |
+
jQuery('select#shipping\\:country_id').change(function(e) {
|
227 |
+
|
228 |
+
COUNTRY_ID = jQuery('select#shipping\\:country_id :selected').val();
|
229 |
+
|
230 |
+
if(COUNTRY_ID != 'ID')
|
231 |
+
{
|
232 |
+
/*balikin ke awal*/
|
233 |
+
|
234 |
+
jQuery('select#shipping\\:city').replaceWith('<input type="text" title="City" name="shipping[city]" value="" class="input-text required-entry" id="shipping:city">');
|
235 |
+
|
236 |
+
}else
|
237 |
+
{
|
238 |
+
jQuery('select#shipping\\:region_id').find('option[value=""]').attr('selected', 'selected');
|
239 |
+
jQuery('input#shipping\\:city').replaceWith('<select name="shipping[city]" class=" required-entry" id="shipping:city"></select>');
|
240 |
+
}
|
241 |
+
|
242 |
+
});
|
243 |
+
|
244 |
+
|
245 |
+
});
|
246 |
+
</script>
|
app/etc/modules/Ansyori_Aongkir.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ansyori_Aongkir>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Shipping />
|
9 |
+
</depends>
|
10 |
+
<version>1.0.0</version>
|
11 |
+
</Ansyori_Aongkir>
|
12 |
+
</modules>
|
13 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>aongkir</name>
|
4 |
+
<version>1.0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>open source</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Indonesian Shippping Carriers</summary>
|
10 |
+
<description>Indonesian Shippping Carriers</description>
|
11 |
+
<notes>Indonesian Shippping Carriers</notes>
|
12 |
+
<authors><author><name>Ansyori</name><user>ansyori</user><email>ansyori@gmail.com</email></author></authors>
|
13 |
+
<date>2015-03-27</date>
|
14 |
+
<time>02:41:06</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Ansyori"><dir name="Aongkir"><dir name="Block"><file name="Index.php" hash="eb68794e0f3220839a02dba0f9f7f105"/></dir><dir name="Helper"><file name="Data.php" hash="053a1cbaebc94470d1c05e34f1c32571"/></dir><dir name="Model"><file name="Area.php" hash="a50294a1ead04ef920bd79c457f4bc8a"/><dir name="Carrier"><file name="Ongkir.php" hash="00666f69245ba15234bbba91579a2b79"/></dir><file name="Cron.php" hash="df18b4f51639879ce741063dcd34ce23"/><dir name="Mysql4"><dir name="Area"><file name="Collection.php" hash="5a1d6cfd02be80f7038f3cafd27f3ec1"/></dir><file name="Area.php" hash="79392c31d15280d608e47a12bcda6685"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="City.php" hash="db48d237dd037433d142e7bfd4fbe15a"/><file name="Kurir.php" hash="6b42824b026a709f56faa600e6cf1428"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="0fecc86f6fc58a6bd23375c628cd683e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7524c909e4c0ac821d4e0d41379c04d2"/><file name="config.xml" hash="ad9e0216ad24f345651bb8be9b096d42"/><file name="system.xml" hash="e1213117c56a0585cf75a459a5464a30"/></dir><dir name="sql"><dir name="aongkir_setup"><file name="mysql4-install-1.0.0.php" hash="4e8ba5ec0e19a30d13bb9568be4605eb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="aongkir.xml" hash="ec81d1456c144f706915d4daa6fb14d0"/></dir><dir name="template"><dir name="aongkir"><file name="billing.phtml" hash="c1b9f178f56c66e0a27c797c7cce3c8b"/><file name="edit.phtml" hash="5cf1cf4425ec2311c8475a648ac38137"/><file name="shipping.phtml" hash="b65870bda7c2ba76a0ef2f22fdf339a2"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="aongkir.xml" hash="ec81d1456c144f706915d4daa6fb14d0"/></dir><dir name="template"><dir name="aongkir"><file name="billing.phtml" hash="c1b9f178f56c66e0a27c797c7cce3c8b"/><file name="edit.phtml" hash="5cf1cf4425ec2311c8475a648ac38137"/><file name="shipping.phtml" hash="b65870bda7c2ba76a0ef2f22fdf339a2"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ansyori_Aongkir.xml" hash="f7f4be17fe16141cff15994c4f202a0f"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|