Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

oddie

Archived
  • Posts

    14
  • Joined

  • Last visited

Profile Information

  • Real Name
    oddie

oddie's Achievements

  1. i've made another modification to control the session i created this table CREATE TABLE ls_status ( id int(255) NOT NULL auto_increment, session_id varchar(255) NOT NULL default '', status varchar(10) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; then i modified these files in catalog/live_support.php (to open the conversation) just below the welcome message tep_db_query("insert into " . TABLE_LS_STATUS . " (id, session_id, status) values ('', '" . $osCsid . "', 'yes')"); ] in catalog/ls_comm_main.php (only post if the conversation is open) before // Lets read the contents of the conversation $conversation_query = tep_db_query("select id, guest, tech, message, tech_reply from " . TABLE_LS_CONVERSATIONS . " a where tech ='Soporte' and session_id = '" . $osCsid . "' order by id desc"); while ($conversation =tep_db_fetch_array($conversation_query)) { if($conversation['tech_reply'] == '0') { echo "<span class="question"><b>$conversation[guest]:</b> $conversation[message]</span><br>n"; } if($conversation['tech_reply'] == '1') { echo "<span class="reply"><b>$conversation[tech]:</b> $conversation[message]</span><br>n"; } if($conversation['tech_reply'] == '2') { echo "<p align="center" class="system"> $conversation[message]</p><br>n"; } } after $status_query = tep_db_query("select status from " . TABLE_LS_STATUS . " a where session_id = '" . $osCsid . "'"); while ($status_info =tep_db_fetch_array($status_query)) { $status = $status_info['status']; } if ($status=='yes') { // Lets read the contents of the conversation $conversation_query = tep_db_query("select id, guest, tech, message, tech_reply from " . TABLE_LS_CONVERSATIONS . " a where tech ='Soporte' and session_id = '" . $osCsid . "' order by id desc"); while ($conversation =tep_db_fetch_array($conversation_query)) { if($conversation['tech_reply'] == '0') { echo "<span class="question"><b>$conversation[guest]:</b> $conversation[message]</span><br>n"; } if($conversation['tech_reply'] == '1') { echo "<span class="reply"><b>$conversation[tech]:</b> $conversation[message]</span><br>n"; } if($conversation['tech_reply'] == '2') { echo "<p align="center" class="system"> $conversation[message]</p><br>n"; } } } else { echo "Session is closed yadayadayada"; } in catalog/ls_comm_top.php (leave ls_conversation empty if the session is closed) before if($text) { $guest_query = tep_db_query("select guest from " . TABLE_LS_CONVERSATIONS . " a where session_id = '" . $osCsid . "'"); while ($guest_info =tep_db_fetch_array($guest_query)) { $guest = $guest_info['guest']; } $message = tep_db_prepare_input($HTTP_POST_VARS['text']); tep_db_query("insert into " . TABLE_LS_CONVERSATIONS . " (id, guest, tech, session_id, message, tech_reply) values ('', '" . $guest . "', 'Soporte', '" . $osCsid . "', '" . $message . "', '0')"); } after $status_query = tep_db_query("select status from " . TABLE_LS_STATUS . " a where session_id = '" . $osCsid . "'"); while ($status_info =tep_db_fetch_array($status_query)) { $status = $status_info['status']; } if ($status=='yes') { if($text) { $guest_query = tep_db_query("select guest from " . TABLE_LS_CONVERSATIONS . " a where session_id = '" . $osCsid . "'"); while ($guest_info =tep_db_fetch_array($guest_query)) { $guest = $guest_info['guest']; } $message = tep_db_prepare_input($HTTP_POST_VARS['text']); tep_db_query("insert into " . TABLE_LS_CONVERSATIONS . " (id, guest, tech, session_id, message, tech_reply) values ('', '" . $guest . "', 'Soporte', '" . $osCsid . "', '" . $message . "', '0')"); } } in catalog/ls_comm_top.php (just in case) before echo "<td> <input class=textbox size=30 name=text> <input class=button type=submit value=Send></td>"; after <? $status_query = tep_db_query("select status from " . TABLE_LS_STATUS . " a where session_id = '" . $osCsid . "'"); while ($status_info =tep_db_fetch_array($status_query)) { $status = $status_info['status']; } if ($status=='yes') { echo "<td> <input class=textbox size=30 name=text> <input class=button type=submit value=Send></td>"; } else { echo "i told you, session is closed"; } ?> in catalog/ls_exit.php (what to do if the admin closed the session) put it just below the for cycle $status_query = tep_db_query("select status from " . TABLE_LS_STATUS . " a where session_id = '" . $osCsid . "'"); while ($status_info =tep_db_fetch_array($status_query)) { $status = $status_info['status']; } echo $status; if ($status=='yes') { $guest =''; $message='the customer is gone'; tep_db_query("insert into " . TABLE_LS_CONVERSATIONS . " (id, guest, tech, session_id, message, tech_reply) values ('', '" . $guest . "', 'Sales', '" . $osCsid . "', '" . $message . "', '0')"); echo "<script>window.close()</script>"; } else { echo "<script>window.close()</script>"; } in admin/ls_comm_exit.php (he has to finish the session) put it just below the for cycle tep_db_query("delete from " . TABLE_LS_STATUS . " where session_id = '" . $osCsid . "' "); and that's it, the code it's not perfect but it works :) ....damn, this is my longest post by far :D
  2. nice, thank you im gonna try it about the onUnload on js, sometimes it does works but sometimes it doesnt so i was using the onUnload from the <body>
  3. im thinking about a new table to control the status of the call by the session_id number maybe mike got this already in mind
  4. i've made some modifications to these nice code, i got it working pretty good , there are just some details that i got to fix. btw, im not an expert so if the code it's "newbie" in someplaces, dont complain :) maybe some "code-master" can get a better results. - to fix the availability issue, i modified the file catalog/live_support.php , the customer only can login if the status of the Sales agent is yes. original $support_query = tep_db_query("select status from " . TABLE_LS_TECHS . " where status='yes' or status='busy' "); modified $support_query = tep_db_query("select status from " . TABLE_LS_TECHS . " where status='yes'"); - when a user leaves the chat , you have to clear the session, i think the better choice is to control the status of the session in the Sales side, so in catalog/ls_exit.php i added a line to the buffer so the Sales agent can notice when the customer leaves the chat put it just below the for cycle $guest =''; $message='the customer has leave the room'; tep_db_query("insert into " . TABLE_LS_CONVERSATIONS . " (id, guest, tech, session_id, message, tech_reply) values ('', '" . $guest . "', 'Sales', '" . $osCsid . "', '" . $message . "', '0')"); this is the code in the script portion of admin/ls_commwindow.php <script language="javascript"> function popup(){ window.open('ls_comm_exit.php?osCsid=<? echo $session_id; ?>'); } </script> </head> at this moment there's only one line in the buffer and the status is still busy, so in admin/ls_comm_exit.php i got this code <? require('includes/application_top.php'); $delete_query = tep_db_query("select id from " . TABLE_LS_CONVERSATIONS . " where session_id = '" . $osCsid . "' "); $delete_results = tep_db_num_rows($delete_query); echo $delete_results; for($i=0; $i < $delete_results; $i++) { tep_db_query("delete from " . TABLE_LS_CONVERSATIONS . " where session_id = '" . $osCsid . "' "); } tep_db_query("update " . TABLE_LS_TECHS . " set status = 'yes' where tech_id = '1' "); echo "<script>window.close()</script>"; ?> this will clear the buffer and with status "yes" (available) i dont know if it's my browser but im having a hard time with the popup() function (onunload wndow) in ls_commwindow.php , sometime it works and sometime id doesnt works, so im thinking that maybe i will have to use a "Close" button i still got to fix the situation when the Sales agent leaves the room first. Mike, congrats. , nice job with this mod. :D
  5. nice crontrib it would be nice to see it in english, cause the only things that i understand is the sql statsments, nothing else :(
×
×
  • Create New...