Clement Posted January 18, 2003 Share Posted January 18, 2003 Because our customers may be ungry if they see in the left column the "Live support avaiable" picture but, if the operator is busy, they can't speack or login (after oddie mod), AND because is better to tell customers (in right column) that the operators is here but is keep busy by the other customer, I was created a new image file that I called "live_support3.gif" with "Busy" message and make some little modification in catalog/includes/boxes/live_support.php So, $support_query = tep_db_query("select status from " . TABLE_LS_TECHS . " where status='yes' or status='busy' "); $support_results = tep_db_num_rows($support_query); REPLACED WITH: $support_query = tep_db_query("select status from " . TABLE_LS_TECHS . " where support_tech ='Sales' "); $support_results = tep_db_fetch_array($support_query); A litlle bit down if($support_results > 0 ) { REPLACED WITH: if($support_results['status'] == 'yes') { A little bit down }else { REPLACED WITH: elseif ($support_results['status'] == 'busy') { $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONTACT_US, '', 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'live_support3.gif', IMAGE_LIVE_SUPPORT_NOT_AVAILABLE) . '</a>'); }else { Good luck, Quote Link to comment Share on other sites More sharing options...
Clement Posted January 18, 2003 Share Posted January 18, 2003 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> I think in the js is missing the unload condition. So, correct script is: <script language="javascript"> function popup(){ window.open('ls_comm_exit.php?osCsid=<? echo $session_id; ?>'); } window.onunload=popup; </script> At least only this works for me. Thank you, Quote Link to comment Share on other sites More sharing options...
Clement Posted January 18, 2003 Share Posted January 18, 2003 Ok. I don't know very well why but here is the code that works for situation when the Admin leave the "Live Support" : in admin/ls_callwaiting.php file FIND: <script language="javascript"> function LSWarning() { alert("Closing this window has turned off Live Support!"); window.open('ls_exit.php?tech=1', 'tech'); } </script> </head> <body onUnload="LSWarning()"> REPLACE WITH <script language="javascript"> function LSWarning() { window.open('ls_exit.php?tech=1', 'tech'); alert("Closing this window has turned off Live Support!"); } window.onunload=LSWarning; </script> </head> <body> ANOTHER solution in case that the above changes dont't work to you is: in admin/live_support.php file FIND: <tr> <td valign="top" align="center"> <a href="javascript:void(0);" onclick="NewWindow('ls_start.php','tech','200','200','no');return false"><b style="font-size:14pt;">Start Live Support</b></a> </td> </tr> AFTER THIS ADD: <tr> <td valign="top" align="center"> <br><br><br> <a href="javascript:void(0);" onclick="NewWindow('ls_exit.php?tech=1','tech');return false"><b style="font-size:14pt;">Close Live Support</b></a> Good Luck, Quote Link to comment Share on other sites More sharing options...
Clement Posted January 18, 2003 Share Posted January 18, 2003 Sorry, I forgot to explain the second solution. This add a new link in the Live support admin page right after the existing "Start Live Support". If you want to close live support, you can use this second link to close it manually. Good Luck, Quote Link to comment Share on other sites More sharing options...
oddie Posted January 18, 2003 Share Posted January 18, 2003 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> Quote Link to comment Share on other sites More sharing options...
oddie Posted January 18, 2003 Share Posted January 18, 2003 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 Quote Link to comment Share on other sites More sharing options...
Guest Posted January 21, 2003 Share Posted January 21, 2003 I appreciate the updates, however I have been working on them without checking the forum. I have added a new version that now informs the use when the operator is in a conversation. I will need to look at what was contributed, to include into the new version. I am pleased to see this program grow. :) Please email me any updates you have come up with, so that I can include them into future releases. thanks Mike Quote Link to comment Share on other sites More sharing options...
Guest Posted January 21, 2003 Share Posted January 21, 2003 Found a small bug in Live Support v1.2b in the file '/admin/ls_comm_exit' there is an error in my sql statement (DUH!) :oops: you can replace the file from the current version with the fix i uploaded or you can just replace the line in the file with this one. locate: tep_db_query("update " . TABLE_LS_TECHS . " set status = 'yes', set helping = '' where tech_id = ' " . $tech . " ' "); replace with this one: tep_db_query("update " . TABLE_LS_TECHS . " set status = 'yes', helping = '' where tech_id = ' " . $tech . " ' "); Mike Quote Link to comment Share on other sites More sharing options...
Theodorb Posted January 21, 2003 Share Posted January 21, 2003 Please can you post the link to Your live support v1.2. I have Version 1.1b and fix. I like what I see so far, and will stay in touch watching the improvements. Thanks Theo Quote Share your knowlege and you learn even more ! Link to comment Share on other sites More sharing options...
Guest Posted January 21, 2003 Share Posted January 21, 2003 Sorry that was an error on my part the current release is v1.1b I am now working on 1.2 to add some customization that is why I might have mentioned 1.2 Sorry for any confusion. Mike Quote Link to comment Share on other sites More sharing options...
Guest Posted January 21, 2003 Share Posted January 21, 2003 Should I bother replacing all the code that is talked about in the previous posts? When will the next version be out? Will it include the fixes that the are discussed? Thanks for the great contribution. Vincent Quote Link to comment Share on other sites More sharing options...
Guest Posted January 21, 2003 Share Posted January 21, 2003 Just a reminder this is beta software and is released without warranty. I would download the latest release, and try it out. the current release may be all that you need, I have been pretty busy at my full time job lately and have only been working on this when time arises. The next version may be out in 2 days or in 2 weeks. The next version is going to address some customizable options and any new bug fixes that arise. hth Mike Quote Link to comment Share on other sites More sharing options...
michellez1 Posted January 22, 2003 Share Posted January 22, 2003 I tested, and retested this many times - and the onUnload functions just don't work for me in the admin windows. So what I've done a few things for a temporary fix. Maybe someone can use this and work on it for improvements. IN THE ADMIN SECTION: First, I changed the following in admin/ls_exit.php Old: require('includes/application_top.php'); tep_db_query("update " . TABLE_LS_TECHS . " set status = 'no' where tech_id = ' " . $tech . " ' "); echo "<script>window.close()</script>"; New: require('includes/application_top.php'); tep_db_query("update " . TABLE_LS_TECHS . " set status = 'no', helping = '' where tech_id = ' " . $tech . " ' "); echo "<script>window.close()</script>"; Next, in admin/ls_commwindow.php I deleted the following code: Delete this section: <script> function popup(){ var win = window.open('ls_comm_exit?tech=1','conversation'); } window.onunload=popup; </script> Add this line right under the <body> tag: <div align="right"><a href="/admin/ls_comm_exit.php?tech=1" target="_blank" class="bluelink"><b>End Session</b></a></div> Small cosmetic fix in ls_comm_top.php: -> live_support/white/top_right_curve.gif should actually be: -> livesupport/white/top_right_curve.gif (You'll notice the same error in ls_infobar.php regarding bottom_right_curve.gif). Okay, now in ls_callwaiting.php, add this somewhere in the <head> tags: <script language="javascript"> var win = null; function NewWindow(mypage,myname,w,h,scroll){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' win = window.open(mypage,myname,settings) } </script> Then add this somewhere in your body (I added it at the bottom): <p align="center" style="font-size:7pt;"><a href="javascript:void(0);" onclick="NewWindow('ls_exit.php?tech=1','tech');return false"><b style="font-size:7pt;">Close ALL Sessions</b></a></p> IN THE CATALOG SECTION: First, change the following error in catalog/ls_start.php: Old: <script> function popup(){ var win = window.open('ls_exit','closing', 'width=100', 'height=100'); } window.onunload=popup; </script> New: <script> function popup(){ var win = window.open('ls_exit.php','closing', 'width=100', 'height=100'); } window.onunload=popup; </script> Well, I think that's it. The most frustrating part is the admin. I don't know why the onUnload function just doesn't work here - maybe a browser issue, as I saw someone else had the same problem. But I think this is the fastest quick fix for the problem. As long as you click the link in your commwindow when you done with your conversation - you can safely close the window and your callwaiting window will remain open - and your tech session will be cleared and ready for the next call. =) Regards, Michelle Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 Ok I have made several changes to the code for version 1.2 - added the ability to add some customizable features such as color, and warning sound. - now the script give the user the choice to hit the close button instead of closing the window. - now the operator can end the session and the script notifies the user and closes his window. - when the user leaves the conversation the operator is notified and closes his window. - put focus on text input so that you dont have to keep clicking the text window. - fixed the ability to add apostrophe's and quotes, before would cause MySQL error. thanks again to everyone for their nice comments on this mod. Mike Quote Link to comment Share on other sites More sharing options...
michellez1 Posted January 22, 2003 Share Posted January 22, 2003 First off, Great mod...just had to say that. Now, where are the sql function to install 'TABLE_LS_VARIABLES' and 'TABLE_LS_ATTRIBUTES'. Am I missing something or did you forget to add that to the table.sql file. Regards, Michelle Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 I am having the same problem: 1146 - Table 'trend_catalog.TABLE_LS_VARIABLES' doesn't exist select v.color, a.ls_variable_option from TABLE_LS_VARIABLES v, TABLE_LS_ATTRIBUTES a where v.color = a.ls_attributes_id Thanks for your help :lol: Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 please download the fix, I included the wrong file in the package just replace the live_support.php in the admin side with the one in the fix. btw michelle what browser are you using? I use MSIE 6.0 and the javascripts are working for me Mike Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 you also forgot to include the ls_comm_exit.php for the catalog side I bet youre eyes must be killing you from looking at the screen coding all day long Thanks Quote Link to comment Share on other sites More sharing options...
michellez1 Posted January 22, 2003 Share Posted January 22, 2003 Hi Mike, I'm using MSIE v.6.0 as well. I noticed that during testing of the original onload function, it worked 0 out of 10 times. And using the onload function that you have now implemented....that worked only 1 out of 10 times. It just simply wouldn't let me close the session out after closing the first conversation window. So say I had one conversation window open (callwaiting window in the background shows busy)...when I close the conversation window - the callwaiting window would now read 'waiting for calls'. When I get a new call (after the first conversation)...and open the conversation window a second time...after ending the second conversation and closing the window - the session would not close, and the callwaiting window would read 'busy'. I really don't know why this would happen, but I tested it about 30 different times. I'm not terribly familiar with java - but it's my understanding (from what little reading I did last night) - that the problem may lie within the onunload function when using iframes. Although there are browser compatability issues for those with MSIE versions older than 5.0. But since that didn't apply to me I really didn't research this any further - I just created a link to close the session before exiting the conversation window and it worked for me 100% of the time. So, I kinda gave up on trying to figure out why the javascript wouldn't work for me. :D Regards, Michelle Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 If the installation text calls for a ls_comm_exit.php on the catalog side, that is an error. On my site I do not have a ls_comm_exit.php. If you get the error liek page not found, please let me know. the script should go to ls_exit.php on the catalog side. and yes at the end of the day my wife asks me whats wrong with your eyes? :shock: I just cant seem to close them. LOL Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 Michelle, do you still get this problem with version 1.2b? Quote Link to comment Share on other sites More sharing options...
michellez1 Posted January 22, 2003 Share Posted January 22, 2003 I'll let you know when I've finished the changes. I'm making notes of the changes so that I can see what works and doesn't work for me. I did find something though in admin/ls_commwindow.php: <script> function popup(){ var win = window.open('ls_comm_exit?tech=1','conversation'); } window.onunload=popup; </script> Shouldn't this be: <script> function popup(){ var win = window.open('ls_comm_exit.php?tech=1','conversation'); } window.onunload=popup; </script> Regards, Michelle Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 I have the same problem, I cant end an open session. What I am doing is going into the sql table and manually changing the status to 'no' Quote Link to comment Share on other sites More sharing options...
Guest Posted January 22, 2003 Share Posted January 22, 2003 yes, i thought i fixed that but apparently i missed it yes it needs to end in .php Quote Link to comment Share on other sites More sharing options...
michellez1 Posted January 22, 2003 Share Posted January 22, 2003 I have the same problem, I cant end an open session. What I am doing is going into the sql table and manually changing the status to 'no' Did you already install the new version and test it? If it still doesn't work, try useing the link option that I posted above. You just have to remember to click the link before you close the conversation window. Regards, Michelle Quote Link to comment Share on other sites More sharing options...
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.