echo '<br>'; } } else { echo 'Exist reference id:' . $subStoreRefID . '<br>'; } } } } //return; } } } else { if ($_pgR["act"] == "fixlatlong") { $total = global_common::getTotalRecord(Model_Store::TBL_SL_STORE, $objConnection); for ($index = 1; $index <= $total / Model_Store::NUM_PER_PAGE + 1; $index++) { $allStores = $objStore->getAllStore($index); //print_r($allStores); //break; foreach ($allStores as $store) { // print_r($store); //add urlencode to your address $rawAddr = $store[global_mapping::Address] . ', ' . $store[global_mapping::DistrictName] . ', ' . str_replace("TP.", "", $store[global_mapping::CityName]) . ', Việt Nam'; //$address = urlencode($rawAddr); //$address = str_replace(" ", "+", $address); //echo $rawAddr; if ($store[global_mapping::Latitude] == '10.8230990000' && $store[global_mapping::Longitude] == '106.6296640000') { echo '<br>Start get lat long: ' . $rawAddr; //$json = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false"); //$json = json_decode($json); $mapLocation = global_common::getLocation($_gmapAPI, $rawAddr); $lat = $mapLocation['lat'];
} } else { $cat = '0'; } if ($address) { if ($condition) { $condition .= ' AND '; } $condition .= '`' . global_mapping::Name . '` like \'%' . $address . '%\''; } //echo $condition; //print_r($location); //return; $allStores = Application::getVar('allStores_' . $cat . '_' . $address); if (!$allStores) { $allStores = $objStore->getAllStore(0, global_mapping::StoreID . ',' . global_mapping::Latitude . ',' . global_mapping::Longitude, $condition); Application::setVar('allStores_' . $cat . '_' . $address, $allStores); } //print_r($allStores); //return; $count = 0; //return; $result = array(); //echo $distance.'<br>'; foreach ($allStores as $item) { //echo date('Y-m-d H:i:s').'<br>'; //removing // $count++; // if($count>=1000) // break; //End removing