Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

information not adding to database from checkout_shipping page


Recommended Posts

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?






$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.');



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'];

Link to comment
Share on other sites



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.');
//// 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');




$sales_reps[] = array('id' => '0', 'text' => 'Select a Sales Person');

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...