westsoftdevelopment Posted October 15, 2013 Share Posted October 15, 2013 In customer service there is a button to synchronize from mail box. Is it not possible to run a cron job to do that???? Link to comment Share on other sites More sharing options...
misthero Posted December 16, 2013 Share Posted December 16, 2013 a chron job would be ideal, anyway if you want a temporary solution you can do the following: edit the file in your admin folderthemes/default/template/controllers/customer_threads/helpers/options/options.tpl replace the content with this: {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {extends file="helpers/options/options.tpl"} {block name="after"} {if $use_sync} <fieldset><legend>{l s='Sync'}</legend> <label>{l s='Run sync:'}</label> <div class="margin-form"> <button class="button" id="run_sync" onclick="run_sync();">{l s='Run sync'}</button> <p>{l s='Click to synchronize mail automatically'}</p> <div id="ajax_loader"></div> <div class="error" style="display:none" id="ajax_error"></div> <div class="conf" style="display:none" id="ajax_conf"></div> </div> </fieldset><br/> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.3.1/jquery.cookie.min.js"></script> <script type="text/javascript"> var ajaxQueries = new Array(); function run_sync() { $('#ajax_error').html(''); $('#ajax_error').hide(); $('#ajax_conf').html(''); $('#ajax_conf').hide(); for(i = 0; i < ajaxQueries.length; i++) ajaxQueries[i].abort(); ajaxQueries = new Array(); $('#ajax_loader').html('<img src="{$smarty.const._PS_ADMIN_IMG_}ajax-loader.gif">'); ajaxQuery = $.ajax({ type: "POST", cache: false, url: "index.php", data: { ajax: "1", token: "{$token}", syncImapMail: "1", ajax:"1", action:"syncImap", tab:"AdminCustomerThreads" }, dataType : "json", success: function(jsonData) { jsonError = ''; if (jsonData.hasError) { for (i=0;i < jsonData.errors.length;i++) jsonError = jsonError+'<li>'+jsonData.errors[i]+'</li>'; $('#ajax_error').html('<ul>'+jsonError+'</ul>'); $('#ajax_error').fadeIn(); } else { jsonError = '<li>{l s='Sync success'}</li>'; for (i=0;i < jsonData.errors.length;i++) jsonError = jsonError+'<li>'+jsonData.errors[i]+'</li>'; $('#ajax_conf').html('<ul>'+jsonError+'</ul>'); $('#ajax_conf').fadeIn(); } $('#ajax_loader').html(''); }, error: function(XMLHttpRequest, textStatus, errorThrown) { jAlert("TECHNICAL ERROR: unable to sync.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); } }); ajaxQueries.push(ajaxQuery); }; $(document).ready(function(){ //Syncrea Sincronizzazione automatica if ($.cookie('syncCookie') == 'true') { // do nothing } else { var date = new Date(); var minutes = 20; date.setTime(date.getTime() + (minutes * 60 * 1000)); $.cookie('syncCookie', 'true', { expires: date }); run_sync(); } }) </script> {/if} {/block} this will sync the mail automatically (when you open the customer threads tab) once every 20 minutes, you can change the timing simply editing the variable"var minutes = 20;"Enjoy! Link to comment Share on other sites More sharing options...
samuel89 Posted March 20, 2014 Share Posted March 20, 2014 Thanks for the solution. Do you know how to make it sync whenever the customer service tab is clicked? Link to comment Share on other sites More sharing options...
misthero Posted March 20, 2014 Share Posted March 20, 2014 (edited) Thanks for the solution. Do you know how to make it sync whenever the customer service tab is clicked? just change the time like this "var minutes:-1;" this way it will sync everytime Edited March 20, 2014 by misthero (see edit history) Link to comment Share on other sites More sharing options...
samuel89 Posted March 22, 2014 Share Posted March 22, 2014 Hi I tried what you did, adding $(document).ready(function(){ //Syncrea Sincronizzazione automatica if ($.cookie('syncCookie') == 'true') { // do nothing } else { var date = new Date(); var minutes = -1; date.setTime(date.getTime() + (minutes * 60 * 1000)); $.cookie('syncCookie', 'true', { expires: date }); run_sync(); } }) to options.tpl but it doesn't seem to work. Is there aything I missed out? Thanks Link to comment Share on other sites More sharing options...
misthero Posted March 23, 2014 Share Posted March 23, 2014 that is not enough, I posted the full code you should use to make it work in comment number 2 or add at least the jquery plugin to handle cookies <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.3.1/jquery.cookie.min.js"></script> at the top of option.tpl. Link to comment Share on other sites More sharing options...
lovemyseo Posted July 3, 2014 Share Posted July 3, 2014 (edited) a chron job would be ideal, anyway if you want a temporary solution you can do the following: edit the file in your admin folder themes/default/template/controllers/customer_threads/helpers/options/options.tpl replace the content with this: {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {extends file="helpers/options/options.tpl"} {block name="after"} {if $use_sync} <fieldset><legend>{l s='Sync'}</legend> <label>{l s='Run sync:'}</label> <div class="margin-form"> <button class="button" id="run_sync" onclick="run_sync();">{l s='Run sync'}</button> <p>{l s='Click to synchronize mail automatically'}</p> <div id="ajax_loader"></div> <div class="error" style="display:none" id="ajax_error"></div> <div class="conf" style="display:none" id="ajax_conf"></div> </div> </fieldset><br/> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.3.1/jquery.cookie.min.js"></script> <script type="text/javascript"> var ajaxQueries = new Array(); function run_sync() { $('#ajax_error').html(''); $('#ajax_error').hide(); $('#ajax_conf').html(''); $('#ajax_conf').hide(); for(i = 0; i < ajaxQueries.length; i++) ajaxQueries[i].abort(); ajaxQueries = new Array(); $('#ajax_loader').html('<img src="{$smarty.const._PS_ADMIN_IMG_}ajax-loader.gif">'); ajaxQuery = $.ajax({ type: "POST", cache: false, url: "index.php", data: { ajax: "1", token: "{$token}", syncImapMail: "1", ajax:"1", action:"syncImap", tab:"AdminCustomerThreads" }, dataType : "json", success: function(jsonData) { jsonError = ''; if (jsonData.hasError) { for (i=0;i < jsonData.errors.length;i++) jsonError = jsonError+'<li>'+jsonData.errors[i]+'</li>'; $('#ajax_error').html('<ul>'+jsonError+'</ul>'); $('#ajax_error').fadeIn(); } else { jsonError = '<li>{l s='Sync success'}</li>'; for (i=0;i < jsonData.errors.length;i++) jsonError = jsonError+'<li>'+jsonData.errors[i]+'</li>'; $('#ajax_conf').html('<ul>'+jsonError+'</ul>'); $('#ajax_conf').fadeIn(); } $('#ajax_loader').html(''); }, error: function(XMLHttpRequest, textStatus, errorThrown) { jAlert("TECHNICAL ERROR: unable to sync.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); } }); ajaxQueries.push(ajaxQuery); }; $(document).ready(function(){ //Syncrea Sincronizzazione automatica if ($.cookie('syncCookie') == 'true') { // do nothing } else { var date = new Date(); var minutes = 20; date.setTime(date.getTime() + (minutes * 60 * 1000)); $.cookie('syncCookie', 'true', { expires: date }); run_sync(); } }) </script> {/if} {/block} this will sync the mail automatically (when you open the customer threads tab) once every 20 minutes, you can change the timing simply editing the variable "var minutes = 20;" Enjoy! in which file I have to change the "var minutes = 20;" value could you please specify ? Also this solutions does works for PS 1.5.4.1 Edited July 3, 2014 by lovemyseo (see edit history) Link to comment Share on other sites More sharing options...
misthero Posted July 3, 2014 Share Posted July 3, 2014 you quoted my message where is specidfied the file and there is the file content: themes/default/template/controllers/customer_threads/helpers/options/options.tpl Link to comment Share on other sites More sharing options...
lovemyseo Posted July 3, 2014 Share Posted July 3, 2014 (edited) you quoted my message where is specidfied the file and there is the file content: themes/default/template/controllers/customer_threads/helpers/options/options.tpl ok checking Edited July 3, 2014 by lovemyseo (see edit history) Link to comment Share on other sites More sharing options...
lovemyseo Posted July 3, 2014 Share Posted July 3, 2014 you quoted my message where is specidfied the file and there is the file content: themes/default/template/controllers/customer_threads/helpers/options/options.tpl Ok done above but still unable to see Customer messages options as customer thread in back office just like I was able to see in PS 149 Link to comment Share on other sites More sharing options...
jjryeste Posted November 4, 2014 Share Posted November 4, 2014 Hello, found in prestashop 1.6 , or is other codigo thank you Link to comment Share on other sites More sharing options...
mr_smiley Posted July 23, 2015 Share Posted July 23, 2015 But how it do with cron task? To click tab is good idea, but i want do it without this clicking. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now