scentful Posted September 22, 2013 Posted September 22, 2013 My check out shipping page requests that information on a sales rep be chosen. upon finishing the order, the information does not pass through to the confirmation page or the admin/order or invoice or packing slip pages. it in fact just doesn't add to the database the chosen id #. What am I missing...Anyone have any ideas? require('includes/application_top.php'); require('includes/classes/http_client.php'); $sales_reps = array(); $sales_reps[] = array('id' => 'Select a Sales person', 'text' => 'Select a Sales Person'); $sales_reps_query = tep_db_query("select * from " . TABLE_SALES_REPS . " order by sales_rep_lastname ASC"); while ($res = tep_db_fetch_array($sales_reps_query)) { $sales_reps[] = array('id' => $res['sales_rep_id'], 'text' => $res['sales_rep_firstname'] . ' ' . $res['sales_rep_lastname']); } .....and then later... // process the selected shipping method if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken) ) { if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (tep_not_null($HTTP_POST_VARS['comments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); } if ($HTTP_POST_VARS['sales_rep_id'] < 1) { $messageStack->add('checkout_address', 'A sales person must be selected.'); } else if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); if (!tep_session_is_registered('sales_rep_id')) tep_session_register('sales_rep_id'); if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) { $shipping = $HTTP_POST_VARS['shipping']; /***Begin SF***/ $sales_rep_id = $HTTP_POST_VARS['sales_rep_id']; Quote
Bob Terveuren Posted September 23, 2013 Posted September 23, 2013 Hi Try something like this maybe - this bit of code should be added in to the code chunk that is surrounded by the curly brackets starting after if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken) ) { Depending where it's put the value in break() should be adjusted so that if the sales_id is not POSTed then the code skips out of these curlies and stays on the shipping page (no redirect to checkout_payment) - also depending where it is placed may not register the shipping session so customer may have to reselect shipping ///// this chunk of code to sit somewhere inside the if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken) ) { set of curly brackets //// if ($HTTP_POST_VARS['sales_rep_id'] < 1) { $messageStack->add('checkout_address', 'A sales person must be selected.'); break(1); }else{ $_SESSION['sales_rep_id']=$HTTP_POST_VARS['sales_rep_id']; } //// end of chunk That should setup a new session with the sales_rep_id which should be there in checkout_confirmation & checkout_process - someplace in checkout_process you need to grab that value and save it to wherever you intend it to be in the database - then kill the session You could also change $sales_reps[] = array('id' => 'Select a Sales person', 'text' => 'Select a Sales Person'); to $sales_reps[] = array('id' => '0', 'text' => 'Select a Sales Person'); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.