I am find value zip code is available or not try http://ift.tt/1T32Em7 this plug in when get zip code is available then few second after how can redirect anoter page ?
note: in this code header() function is not work.
protected function handleRequests()
{
global $wpdb;
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : null;
if( !$task )
return false;
if( $task == 'wc_check_delivery' || $task == 'wc_check_delivery2' )
{
$ops = get_option('wc_cd_settings', array());
if( !is_array($ops) )
$ops = array();
$code = trim($_GET['code']);
$query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code = '$code' LIMIT 1";
$row = $wpdb->get_row($query);
if( !$row )
{
$query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code LIKE '%*' AND SUBSTRING(code,1,LENGTH(code-1)) = SUBSTRING('$code',1,LENGTH(code-1)) AND LENGTH(code) <= LENGTH('$code') LIMIT 1";
$row = $wpdb->get_row($query);
if( !$row )
{
$query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code LIKE '%?' AND SUBSTRING(code,1,LENGTH(code-1)) = SUBSTRING('$code',1,LENGTH(code-1)) AND LENGTH(code)= LENGTH('$code') LIMIT 1";
// $query = "SELECT * FROM {$wpdb->prefix}wc_delivery_codes WHERE code LIKE '$code%' AND code LIKE '%*' LIMIT 1";
$row = $wpdb->get_row($query);
if( !$row )
{
if($task=="wc_check_delivery2")
die('false');
$msg = (isset($ops['error_msg']) && !empty($ops['error_msg'])) ? $ops['error_msg'] : __('Oops! This Zip/Pin code is not found');
die($msg);
}
}
}
//print_r($row);
$time = time();
$d_time = $time + ($this->_day_seconds * $row->days);
$msg = sprintf(__('Estimated Delivery in %d days (by %d %s, %d)'), $row->days, date('d', $d_time), date('M', $d_time), date('Y', $d_time)) . '<br/>';
if( !empty($row->note) )
$msg .= sprintf(__('Note: %s'), $row->note) . '<br/>';
die($msg);
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire