get_var($purchlog); //exit($id); $usersql = "SELECT DISTINCT `".WPSC_TABLE_SUBMITED_FORM_DATA."`.value, `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` LEFT JOIN `".WPSC_TABLE_SUBMITED_FORM_DATA."` ON `".WPSC_TABLE_CHECKOUT_FORMS."`.id = `".WPSC_TABLE_SUBMITED_FORM_DATA."`.`form_id` WHERE `".WPSC_TABLE_SUBMITED_FORM_DATA."`.log_id=".$id." ORDER BY `".WPSC_TABLE_CHECKOUT_FORMS."`.`order`" ; //exit($usersql); $formfields = $wpdb->get_results($usersql); if(count($formfields) < 1){ $usersql = "SELECT DISTINCT `".WPSC_TABLE_CHECKOUT_FORMS."`.* FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `type` != 'heading'"; $formfields = $wpdb->get_results($usersql); } //exit('
'.print_r($formfields,true).'
'); //echo '
'.print_r($formfields, true).'
'; if(isset($_POST)){ //echo '
'.print_r($_POST, true).'
'; foreach($_POST as $key=>$value){ if($value != '-1'){ $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='".$value."' WHERE id=".$key; $complete = $wpdb->query($sql); // exit(' ' .$sql); } $numChaged++; $numQueries ++; } $sql = "UPDATE `".WPSC_TABLE_CHECKOUT_FORMS."` SET `unique_name`='delivertoafriend' WHERE `name` = '2. Shipping details'"; $wpdb->query($sql); add_option('wpsc_purchaselogs_fixed',true); } function wpsc_select_options_purchlogs_fix($id){ ?>

'; printf( __ngettext( 'Check Out Form Fields updated.', 'Check Out Form Fields updated.', $numChanged, $numQueries ), $numChanged , $numQueries); echo '

'; } ?>

name,$duplicate) && $fields->name != 'State'){ echo '
'; echo '

Billing '.$fields->name.'

'; echo '
'; echo ''; echo wpsc_select_options_purchlogs_fix($fields->id); echo '
'; echo '
'; $duplicate[] = $fields->name; }else{ echo '
'; echo '

Shipping '.$fields->name.'

'; echo '
'; echo ''; echo wpsc_select_options_purchlogs_fix($fields->id); echo '
'; echo '
'; } } //exit('
'.print_r($duplicate, true).'
'); ?>